mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Add !slowmode command
This commit is contained in:
parent
2d8decdb4f
commit
5215dd0738
10 changed files with 122 additions and 2 deletions
|
@ -1,7 +1,13 @@
|
|||
import { isValidSnowflake } from "../utils";
|
||||
|
||||
/**
|
||||
* @return Unix timestamp in milliseconds
|
||||
*/
|
||||
export function snowflakeToTimestamp(snowflake: string) {
|
||||
if (!isValidSnowflake(snowflake)) {
|
||||
throw new Error(`Invalid snowflake: ${snowflake}`);
|
||||
}
|
||||
|
||||
// https://discord.com/developers/docs/reference#snowflakes-snowflake-id-format-structure-left-to-right
|
||||
return Number(BigInt(snowflake) >> 22n) + 1420070400000;
|
||||
return Number(BigInt(snowflake) >> 22n) + 1_420_070_400_000;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue