mirror of
https://github.com/danbulant/discord.js
synced 2026-07-05 03:00:35 +00:00
Webpack build: 8cff77726a
This commit is contained in:
parent
608ee177cb
commit
3ef39c8c2b
1 changed files with 19 additions and 16 deletions
|
|
@ -13201,20 +13201,10 @@ const Long = __webpack_require__(44);
|
||||||
const EPOCH = 1420070400000;
|
const EPOCH = 1420070400000;
|
||||||
let INCREMENT = 0;
|
let INCREMENT = 0;
|
||||||
|
|
||||||
function pad(v, n, c = '0') {
|
/**
|
||||||
return String(v).length >= n ? String(v) : (String(c).repeat(n) + v).slice(-n);
|
* A container for useful snowflake-related methods
|
||||||
}
|
*/
|
||||||
|
class Snowflake {
|
||||||
/**
|
|
||||||
* A deconstructed snowflake
|
|
||||||
* @typedef {Object} DeconstructedSnowflake
|
|
||||||
* @property {Date} date Date in the snowflake
|
|
||||||
* @property {number} workerID Worker id in the snowflake
|
|
||||||
* @property {number} processID Process id in the snowflake
|
|
||||||
* @property {number} increment Increment in the snowflake
|
|
||||||
* @property {string} binary Binary representation of the snowflake
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
|
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
|
||||||
* ```
|
* ```
|
||||||
|
|
@ -13226,9 +13216,8 @@ function pad(v, n, c = '0') {
|
||||||
* ```
|
* ```
|
||||||
* Note: this generator hardcodes the worker id as 1 and the process id as 0
|
* Note: this generator hardcodes the worker id as 1 and the process id as 0
|
||||||
* @typedef {string} Snowflake
|
* @typedef {string} Snowflake
|
||||||
* @class Snowflake
|
|
||||||
*/
|
*/
|
||||||
class Snowflake {
|
|
||||||
/**
|
/**
|
||||||
* Generate a Discord snowflake
|
* Generate a Discord snowflake
|
||||||
* @returns {Snowflake} The generated snowflake
|
* @returns {Snowflake} The generated snowflake
|
||||||
|
|
@ -13239,6 +13228,16 @@ class Snowflake {
|
||||||
return Long.fromString(BINARY, 2).toString();
|
return Long.fromString(BINARY, 2).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A deconstructed snowflake
|
||||||
|
* @typedef {Object} DeconstructedSnowflake
|
||||||
|
* @property {Date} date Date in the snowflake
|
||||||
|
* @property {number} workerID Worker id in the snowflake
|
||||||
|
* @property {number} processID Process id in the snowflake
|
||||||
|
* @property {number} increment Increment in the snowflake
|
||||||
|
* @property {string} binary Binary representation of the snowflake
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deconstruct a Discord snowflake
|
* Deconstruct a Discord snowflake
|
||||||
* @param {Snowflake} snowflake Snowflake to deconstruct
|
* @param {Snowflake} snowflake Snowflake to deconstruct
|
||||||
|
|
@ -13256,6 +13255,10 @@ class Snowflake {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pad(v, n, c = '0') {
|
||||||
|
return String(v).length >= n ? String(v) : (String(c).repeat(n) + v).slice(-n);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = Snowflake;
|
module.exports = Snowflake;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue