Created
May 29, 2024 00:04
-
-
Save kvba0000/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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;((sn,n)=>{ | |
if(window[n] instanceof Array && window[n].includes(sn)) return "Snippet has already been loaded. Restart discord to update the code." | |
// Number of days to show on MessageLatency plugin | |
const days = 1337 | |
// ONLY ISSUE!!! -> Some messages might look like duplicated but it's only Client Side | |
const shift = 14200704e5 | |
const fromNonce = e => Math.floor(Number(e) / 4194304) + shift | |
const toNonce = e => { | |
let t = e - shift; | |
return t <= 0 ? "0" : (BigInt(t) << 22n).toString() | |
} | |
window.XMLHttpRequest = class extends XMLHttpRequest { | |
open(method, url) { | |
this.specialRequest = /https?:\/\/.*?\.?discord\.com\/api\/v\d+\/channels\/\d+?\/messages\/?/.test(url) && method === "POST"; | |
return super.open(...arguments); | |
} | |
send(body) { | |
if(this.specialRequest) { | |
const json = JSON.parse(body); | |
this.nonce = json.nonce | |
json.nonce = toNonce(fromNonce(json.nonce) - (days * 86400000)) | |
body = JSON.stringify(json) | |
} | |
return super.send(body); | |
} | |
get responseText() { | |
if(this.specialRequest) { | |
const json = JSON.parse(super.responseText); | |
json.nonce = this.nonce | |
return JSON.stringify(json) | |
} | |
return super.responseText | |
} | |
} | |
if (!(window[n] instanceof Array)) window[n] = [] | |
window[n].push(sn) | |
return "Loaded" | |
})("MessageLatency Manipulation", "__KVBA__LOADED_SNIPPETS"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment