SupportBot 7.3

This commit is contained in:
ItzEmerald committed 2021-10-04 13:54:30 +01:00
1 parent 19a12f6c8f
commit 09f0873f27
4762 files changed
+504608 -52

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
import { DeconstructedSnowflake, Snowflake, SnowflakeGenerateOptions } from './Snowflake';
/**
* A class for parsing snowflake ids using Discord's snowflake epoch
*
* Which is 2015-01-01 at 00:00:00.000 UTC+0, {@linkplain https://discord.com/developers/docs/reference#snowflakes}
*/
export declare class DiscordSnowflake extends Snowflake {
constructor();
/**
* Discord epoch (`2015-01-01T00:00:00.000Z`)
* @see {@linkplain https://discord.com/developers/docs/reference#snowflakes}
*/
static readonly Epoch = 1420070400000n;
/**
* Deconstructs a snowflake given a snowflake ID
* @param id the snowflake to deconstruct
* @returns a deconstructed snowflake
* @example
* ```ts
* const snowflake = DiscordSnowflake.decode('3971046231244935168');
* ```
*/
static decode: typeof DiscordSnowflake.deconstruct;
/**
* Deconstructs a snowflake given a snowflake ID
* @param id the snowflake to deconstruct
* @returns a deconstructed snowflake
* @example
* ```ts
* const snowflake = DiscordSnowflake.deconstruct('3971046231244935168');
* ```
*/
static deconstruct(id: string | bigint): DeconstructedSnowflake;
/**
* Generates a snowflake given an epoch and optionally a timestamp
* @param options {@link SnowflakeGenerateOptions} to pass into the generator
*
* **note** when increment is not provided it defaults to `0n`
* @example
* ```ts
* const snowflake = DiscordSnowflake.generate();
* ```
* @returns A unique snowflake
*/
static generate(options?: SnowflakeGenerateOptions): bigint;
}
//# sourceMappingURL=DiscordSnowflake.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"DiscordSnowflake.d.ts","sourceRoot":"","sources":["../../src/lib/DiscordSnowflake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE1F;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;;IAK9C;;;OAGG;IACH,gBAAuB,KAAK,kBAAkB;IAE9C;;;;;;;;OAQG;IAEH,OAAc,MAAM,sCAAgC;IAEpD;;;;;;;;OAQG;WACW,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,sBAAsB;IAItE;;;;;;;;;;OAUG;WACW,QAAQ,CAAC,OAAO,GAAE,wBAAoD;CAGpF"}
+94
View File
@@ -0,0 +1,94 @@
/**
* A class for parsing snowflake ids
*/
export declare class Snowflake {
#private;
/**
* Alias for {@link deconstruct}
*/
decode: (id: string | bigint) => DeconstructedSnowflake;
/**
* @param epoch the epoch to use
*/
constructor(epoch: number | bigint | Date);
/**
* Generates a snowflake given an epoch and optionally a timestamp
* @param options options to pass into the generator, see {@link SnowflakeGenerateOptions}
*
* **note** when increment is not provided it defaults to the private increment of the instance
* @example
* ```ts
* const epoch = new Date('2000-01-01T00:00:00.000Z');
* const snowflake = new Snowflake(epoch).generate();
* ```
* @returns A unique snowflake
*/
generate({ increment, timestamp, workerID, processID }?: SnowflakeGenerateOptions): bigint;
/**
* Deconstructs a snowflake given a snowflake ID
* @param id the snowflake to deconstruct
* @returns a deconstructed snowflake
* @example
* ```ts
* const epoch = new Date('2000-01-01T00:00:00.000Z');
* const snowflake = new Snowflake(epoch).deconstruct('3971046231244935168');
* ```
*/
deconstruct(id: string | bigint): DeconstructedSnowflake;
}
/**
* Options for Snowflake#generate
*/
export interface SnowflakeGenerateOptions {
/**
* Timestamp or date of the snowflake to generate
* @default Date.now()
*/
timestamp?: number | bigint | Date;
/**
* The increment to use
* @default 0n
* @remark keep in mind that this bigint is auto-incremented between generate calls
*/
increment?: bigint;
/**
* The worker ID to use
* @default 1n
*/
workerID?: bigint;
/**
* The process ID to use
* @default 1n
*/
processID?: bigint;
}
/**
* Object returned by Snowflake#deconstruct
*/
export interface DeconstructedSnowflake {
/**
* The id in BigInt form
*/
id: bigint;
/**
* The timestamp stored in the snowflake
*/
timestamp: bigint;
/**
* The worker id stored in the snowflake
*/
workerID: bigint;
/**
* The process id stored in the snowflake
*/
processID: bigint;
/**
* The increment stored in the snowflake
*/
increment: bigint;
/**
* The epoch to use in the snowflake
*/
epoch: bigint;
}
//# sourceMappingURL=Snowflake.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Snowflake.d.ts","sourceRoot":"","sources":["../../src/lib/Snowflake.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,SAAS;;IAarB;;OAEG;IAEI,MAAM,OAsDU,MAAM,GAAG,MAAM,KAAG,sBAAsB,CAtD9B;IAEjC;;OAEG;gBACgB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIhD;;;;;;;;;;;OAWG;IACI,QAAQ,CACd,EAAE,SAA2B,EAAE,SAAsB,EAAE,QAAa,EAAE,SAAc,EAAE,GAAE,wBAKvF;IAiBF;;;;;;;;;OASG;IACI,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,sBAAsB;CAW/D;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACd"}
+47
View File
@@ -0,0 +1,47 @@
import { DeconstructedSnowflake, Snowflake, SnowflakeGenerateOptions } from './Snowflake';
/**
* A class for parsing snowflake ids using Twitter's snowflake epoch
*
* Which is 2006-03-21 at 20:50:14.000 UTC+0, the time and date of the first tweet ever made {@linkplain https://twitter.com/jack/status/20}
*/
export declare class TwitterSnowflake extends Snowflake {
constructor();
/**
* Twitter epoch (`2006-03-21T20:50:14.000Z`)
* @see {@linkplain https://twitter.com/jack/status/20}, first tweet ever made
*/
static readonly Epoch = 1142974214000n;
/**
* Deconstructs a snowflake given a snowflake ID
* @param id the snowflake to deconstruct
* @returns a deconstructed snowflake
* @example
* ```ts
* const snowflake = TwitterSnowflake.decode('3971046231244935168');
* ```
*/
static decode: typeof TwitterSnowflake.deconstruct;
/**
* Deconstructs a snowflake given a snowflake ID
* @param id the snowflake to deconstruct
* @returns a deconstructed snowflake
* @example
* ```ts
* const snowflake = TwitterSnowflake.deconstruct('3971046231244935168');
* ```
*/
static deconstruct(id: string | bigint): DeconstructedSnowflake;
/**
* Generates a snowflake given an epoch and optionally a timestamp
* @param options options to pass into the generator, see {@link SnowflakeGenerateOptions}
*
* **note** when increment is not provided it defaults to `0n`
* @example
* ```ts
* const snowflake = TwitterSnowflake.generate();
* ```
* @returns A unique snowflake
*/
static generate(options?: SnowflakeGenerateOptions): bigint;
}
//# sourceMappingURL=TwitterSnowflake.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"TwitterSnowflake.d.ts","sourceRoot":"","sources":["../../src/lib/TwitterSnowflake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE1F;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;;IAK9C;;;OAGG;IACH,gBAAuB,KAAK,kBAAkB;IAE9C;;;;;;;;OAQG;IAEH,OAAc,MAAM,sCAAgC;IAEpD;;;;;;;;OAQG;WACW,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,sBAAsB;IAItE;;;;;;;;;;OAUG;WACW,QAAQ,CAAC,OAAO,GAAE,wBAAoD;CAGpF"}