Created
July 30, 2019 19:09
-
-
Save midknightmare666/e14e4b1fc971425012a2cd585d00749f to your computer and use it in GitHub Desktop.
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
/** | |
* toHex(inputNumber) | |
* | |
* @param {number} inputNumber | |
* @return {string} hash | |
* | |
* @example | |
* | |
* toHex(394540642987933707 + Date.now()) | |
* | |
*/ | |
const toHex = (inputNumber) => { | |
let hash = '', | |
alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', | |
alphabetLength = alphabet.length; | |
do { | |
hash = alphabet[inputNumber % alphabetLength] + hash; | |
inputNumber = parseInt(inputNumber / alphabetLength, 10); | |
} while (inputNumber); | |
return hash | |
}; | |
let userId = parseInt(message.author.id); | |
message.channel.send(`**userName:** ${message.author.username} | |
\n**userId:** ${message.author.id} | |
\n**userHex:** ${toHex(userId + Date.now())}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment