mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix: bot id optional on createBot
This commit is contained in:
@@ -7,3 +7,8 @@ export function removeTokenPrefix(token?: string, type: "GATEWAY" | "REST" = "RE
|
||||
// Remove the prefix and return only the token.
|
||||
return token.substring(token.indexOf(" ") + 1);
|
||||
}
|
||||
|
||||
/** Get the bot id from the bot token. WARNING: Discord staff has mentioned this may not be stable forever. Use at your own risk. However, note for over 5 years this has never broken. */
|
||||
export function getBotIdFromToken(token: string) {
|
||||
return BigInt(atob(token.split(".")[0]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user