Skip to content

Instantly share code, notes, and snippets.

@meowabyte
Last active July 30, 2025 14:49
Show Gist options
  • Save meowabyte/11d7ca9631e76a75acdd6a91ce4f3a89 to your computer and use it in GitHub Desktop.
Save meowabyte/11d7ca9631e76a75acdd6a91ce4f3a89 to your computer and use it in GitHub Desktop.
A fairly simple snippet for MessageLatency plugin manipulation for Vencord. It doesn't use any Vencord-depending variables so you can use Vanilla Discord to troll others
/** _changeLatency(days) to change your latency */
window._changeLatency = await (async () => {
const NONCE_SHIFT = 14200704e5,
SHOULD_MANIPULATE_SYMBOL = Symbol("should manipulate?"),
ORIGINAL_NONCE_SYMBOL = Symbol("original nonce")
const fromNonce = val => Math.floor(Number(val) / 4194304) + NONCE_SHIFT
const toNonce = val => {
let t = val - NONCE_SHIFT;
return t <= 0 ? "0" : (BigInt(t) << 22n).toString()
}
const _XMLHttpRequest = window.XMLHttpRequest
window.XMLHttpRequest = class extends _XMLHttpRequest {
open(method, url) {
if (url.includes("/channels/") && url.endsWith("/messages") && method === "POST") this[SHOULD_MANIPULATE_SYMBOL] = true
return super.open(...arguments)
}
send(body) {
if(typeof this[SHOULD_MANIPULATE_SYMBOL] !== "undefined") {
const json = JSON.parse(body)
this[ORIGINAL_NONCE_SYMBOL] = json.nonce
// rounding fix
const targetTimestamp = Date.now() - (daysDelay * 86400000);
const t_intent_big = BigInt(targetTimestamp) - BigInt(NONCE_SHIFT);
const temp_nonce_str = (t_intent_big << 22n).toString();
const t_observed = Math.floor(Number(temp_nonce_str) / 4194304);
const error = BigInt(t_observed) - t_intent_big;
const t_adjusted_big = t_intent_big - error;
const finalTimestamp = Number(t_adjusted_big + BigInt(NONCE_SHIFT));
json.nonce = toNonce(finalTimestamp);
body = JSON.stringify(json);
}
return super.send(body)
}
get responseText() {
const str = super.responseText;
if(typeof this[SHOULD_MANIPULATE_SYMBOL] !== "undefined") {
const json = JSON.parse(str);
json.nonce = this[ORIGINAL_NONCE_SYMBOL];
return JSON.stringify(json)
}
return str;
}
}
let daysDelay = 1337
return (newValue) => {
if (typeof newValue !== "number" || newValue < 0) return console.error("invalid value. please type a value number")
daysDelay = newValue;
}
})();
@RODIOMG7
Copy link

i need this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment