🔧 build
This commit is contained in:
parent
9b7f4e2b66
commit
ea41892fef
1
dist/Config.js.map
vendored
1
dist/Config.js.map
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../src/Config.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAqC;AACrC,0DAA4B;AAE5B,IAAI,MAAqB,CAAC;AAE1B,kBAAe;IACd,IAAI,EAAE,KAAK,UAAU,IAAI,CAAC,OAAuB,sBAAc;QAC9D,MAAM,GAAG,kBAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QACpC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,EAAE,SAAS,GAAG;QACnB,OAAuB,MAAM,CAAC,GAAG,EAAE,CAAC;IACrC,CAAC;IACD,MAAM,EAAE,SAAS,GAAG,CAAC,GAAQ;QAC5B,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CACD,CAAC;AAQW,QAAA,cAAc,GAAmB;IAC7C,GAAG,EAAE,EAAE;IACP,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE;CACT,CAAC"}
|
1
dist/Constants.js.map
vendored
1
dist/Constants.js.map
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAkB,EAAE,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC"}
|
1
dist/Database.js.map
vendored
1
dist/Database.js.map
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"Database.js","sourceRoot":"","sources":["../src/Database.ts"],"names":[],"mappings":";;AAAA,2CAA2C;AAE3C,6BAA6B;AAC7B,MAAM,EAAE,GAAG,IAAI,0BAAa,CAAC,qEAAqE,CAAC,CAAC;AAEpG,kBAAe,EAAE,CAAC"}
|
40
dist/Schema/Activity.d.ts
vendored
Normal file
40
dist/Schema/Activity.d.ts
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
export declare const ActivitySchema: {
|
||||
afk: BooleanConstructor;
|
||||
status: StringConstructor;
|
||||
$activities: {
|
||||
name: StringConstructor;
|
||||
type: NumberConstructor;
|
||||
$url: StringConstructor;
|
||||
$created_at: NumberConstructor;
|
||||
$timestamps: {
|
||||
start: NumberConstructor;
|
||||
end: NumberConstructor;
|
||||
};
|
||||
$application_id: BigIntConstructor;
|
||||
$details: StringConstructor;
|
||||
$State: StringConstructor;
|
||||
$emoji: {
|
||||
name: StringConstructor;
|
||||
id: BigIntConstructor;
|
||||
animated: BooleanConstructor;
|
||||
};
|
||||
$party: {
|
||||
$id: StringConstructor;
|
||||
$size: NumberConstructor[];
|
||||
};
|
||||
$assets: {
|
||||
$large_image: StringConstructor;
|
||||
$large_text: StringConstructor;
|
||||
$small_image: StringConstructor;
|
||||
$small_text: StringConstructor;
|
||||
};
|
||||
$secrets: {
|
||||
$join: StringConstructor;
|
||||
$spectate: StringConstructor;
|
||||
$match: StringConstructor;
|
||||
};
|
||||
$instance: BooleanConstructor;
|
||||
flags: BigIntConstructor;
|
||||
}[];
|
||||
$since: NumberConstructor;
|
||||
};
|
44
dist/Schema/Activity.js
vendored
Normal file
44
dist/Schema/Activity.js
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ActivitySchema = void 0;
|
||||
const Emoji_1 = require("./Emoji");
|
||||
exports.ActivitySchema = {
|
||||
afk: Boolean,
|
||||
status: String,
|
||||
$activities: [
|
||||
{
|
||||
name: String,
|
||||
type: Number,
|
||||
$url: String,
|
||||
$created_at: Number,
|
||||
$timestamps: {
|
||||
// unix timestamps for start and/or end of the game
|
||||
start: Number,
|
||||
end: Number,
|
||||
},
|
||||
$application_id: BigInt,
|
||||
$details: String,
|
||||
$State: String,
|
||||
$emoji: Emoji_1.EmojiSchema,
|
||||
$party: {
|
||||
$id: String,
|
||||
$size: [Number],
|
||||
},
|
||||
$assets: {
|
||||
$large_image: String,
|
||||
$large_text: String,
|
||||
$small_image: String,
|
||||
$small_text: String,
|
||||
},
|
||||
$secrets: {
|
||||
$join: String,
|
||||
$spectate: String,
|
||||
$match: String,
|
||||
},
|
||||
$instance: Boolean,
|
||||
flags: BigInt,
|
||||
},
|
||||
],
|
||||
$since: Number,
|
||||
};
|
||||
//# sourceMappingURL=Activity.js.map
|
1
dist/Schema/Activity.js.map
vendored
Normal file
1
dist/Schema/Activity.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Activity.js","sourceRoot":"","sources":["../../src/Schema/Activity.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAEzB,QAAA,cAAc,GAAG;IAC7B,GAAG,EAAE,OAAO;IACZ,MAAM,EAAE,MAAM;IACd,WAAW,EAAE;QACZ;YACC,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE;gBACZ,mDAAmD;gBACnD,KAAK,EAAE,MAAM;gBACb,GAAG,EAAE,MAAM;aACX;YACD,eAAe,EAAE,MAAM;YACvB,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,mBAAW;YACnB,MAAM,EAAE;gBACP,GAAG,EAAE,MAAM;gBACX,KAAK,EAAE,CAAC,MAAM,CAAC;aACf;YACD,OAAO,EAAE;gBACR,YAAY,EAAE,MAAM;gBACpB,WAAW,EAAE,MAAM;gBACnB,YAAY,EAAE,MAAM;gBACpB,WAAW,EAAE,MAAM;aACnB;YACD,QAAQ,EAAE;gBACT,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,MAAM;gBACjB,MAAM,EAAE,MAAM;aACd;YACD,SAAS,EAAE,OAAO;YAClB,KAAK,EAAE,MAAM;SACb;KACD;IACD,MAAM,EAAE,MAAM;CACd,CAAC"}
|
5
dist/Schema/Emoji.d.ts
vendored
Normal file
5
dist/Schema/Emoji.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
export declare const EmojiSchema: {
|
||||
name: StringConstructor;
|
||||
id: BigIntConstructor;
|
||||
animated: BooleanConstructor;
|
||||
};
|
9
dist/Schema/Emoji.js
vendored
Normal file
9
dist/Schema/Emoji.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EmojiSchema = void 0;
|
||||
exports.EmojiSchema = {
|
||||
name: String,
|
||||
id: BigInt,
|
||||
animated: Boolean,
|
||||
};
|
||||
//# sourceMappingURL=Emoji.js.map
|
1
dist/Schema/Emoji.js.map
vendored
Normal file
1
dist/Schema/Emoji.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../src/Schema/Emoji.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,MAAM;IACV,QAAQ,EAAE,OAAO;CACjB,CAAC"}
|
53
dist/Schema/Identify.d.ts
vendored
Normal file
53
dist/Schema/Identify.d.ts
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
export declare const IdentifySchema: {
|
||||
token: StringConstructor;
|
||||
properties: {
|
||||
$$os: StringConstructor;
|
||||
$$browser: StringConstructor;
|
||||
$$device: StringConstructor;
|
||||
};
|
||||
intents: BigIntConstructor;
|
||||
$presence: {
|
||||
afk: BooleanConstructor;
|
||||
status: StringConstructor;
|
||||
$activities: {
|
||||
name: StringConstructor;
|
||||
type: NumberConstructor;
|
||||
$url: StringConstructor;
|
||||
$created_at: NumberConstructor;
|
||||
$timestamps: {
|
||||
start: NumberConstructor;
|
||||
end: NumberConstructor;
|
||||
};
|
||||
$application_id: BigIntConstructor;
|
||||
$details: StringConstructor;
|
||||
$State: StringConstructor;
|
||||
$emoji: {
|
||||
name: StringConstructor;
|
||||
id: BigIntConstructor;
|
||||
animated: BooleanConstructor;
|
||||
};
|
||||
$party: {
|
||||
$id: StringConstructor;
|
||||
$size: NumberConstructor[];
|
||||
};
|
||||
$assets: {
|
||||
$large_image: StringConstructor;
|
||||
$large_text: StringConstructor;
|
||||
$small_image: StringConstructor;
|
||||
$small_text: StringConstructor;
|
||||
};
|
||||
$secrets: {
|
||||
$join: StringConstructor;
|
||||
$spectate: StringConstructor;
|
||||
$match: StringConstructor;
|
||||
};
|
||||
$instance: BooleanConstructor;
|
||||
flags: BigIntConstructor;
|
||||
}[];
|
||||
$since: NumberConstructor;
|
||||
};
|
||||
$compress: BooleanConstructor;
|
||||
$large_threshold: NumberConstructor;
|
||||
$shard: NumberConstructor[];
|
||||
$guild_subscriptions: BooleanConstructor;
|
||||
};
|
20
dist/Schema/Identify.js
vendored
Normal file
20
dist/Schema/Identify.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IdentifySchema = void 0;
|
||||
const Activity_1 = require("./Activity");
|
||||
exports.IdentifySchema = {
|
||||
token: String,
|
||||
properties: {
|
||||
// bruh discord really uses $ in the property key, so we need to double prefix it, because instanceOf treats $ (prefix) as a optional key
|
||||
$$os: String,
|
||||
$$browser: String,
|
||||
$$device: String,
|
||||
},
|
||||
intents: BigInt,
|
||||
$presence: Activity_1.ActivitySchema,
|
||||
$compress: Boolean,
|
||||
$large_threshold: Number,
|
||||
$shard: [Number],
|
||||
$guild_subscriptions: Boolean,
|
||||
};
|
||||
//# sourceMappingURL=Identify.js.map
|
1
dist/Schema/Identify.js.map
vendored
Normal file
1
dist/Schema/Identify.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Identify.js","sourceRoot":"","sources":["../../src/Schema/Identify.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAE/B,QAAA,cAAc,GAAG;IAC7B,KAAK,EAAE,MAAM;IACb,UAAU,EAAE;QACX,yIAAyI;QACzI,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,QAAQ,EAAE,MAAM;KAChB;IACD,OAAO,EAAE,MAAM;IACf,SAAS,EAAE,yBAAc;IACzB,SAAS,EAAE,OAAO;IAClB,gBAAgB,EAAE,MAAM;IACxB,MAAM,EAAE,CAAC,MAAM,CAAC;IAChB,oBAAoB,EAAE,OAAO;CAC7B,CAAC"}
|
1
dist/checkToken.js.map
vendored
1
dist/checkToken.js.map
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"checkToken.js","sourceRoot":"","sources":["../src/checkToken.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAyC;AACzC,gEAA+B;AAC/B,sDAA8B;AAE9B,SAAgB,UAAU,CAAC,KAAa;IACvC,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC/B,sBAAG,CAAC,MAAM,CAAC,KAAK,EAAE,gBAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,EAAE,sBAAU,EAAE,CAAC,GAAG,EAAE,OAAY,EAAE,EAAE;YAC3F,IAAI,GAAG,IAAI,CAAC,OAAO;gBAAE,OAAO,GAAG,CAAC,eAAe,CAAC,CAAC;YAEjD,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AARD,gCAQC"}
|
21
dist/index.d.ts
vendored
21
dist/index.d.ts
vendored
@ -1,6 +1,15 @@
|
||||
import { checkToken } from "./checkToken";
|
||||
import Config, { DefaultOptions } from "./Config";
|
||||
import { db } from "discord-server-util";
|
||||
|
||||
import * as Constants from "./Constants";
|
||||
export { checkToken, Config, Constants, db, DefaultOptions };
|
||||
import { checkToken } from "./util/checkToken";
|
||||
import Config, { DefaultOptions } from "./util/Config";
|
||||
import db from "./util/Database";
|
||||
import * as Constants from "./util/Constants";
|
||||
import { Channel } from "./models/Channel";
|
||||
import { Emoji } from "./models/Emoji";
|
||||
import { Guild } from "./models/Guild";
|
||||
import { Invite } from "./models/Invite";
|
||||
import { Member } from "./models/Member";
|
||||
import { Role } from "./models/Role";
|
||||
import { User } from "./models/User";
|
||||
import { EmojiSchema } from "./Schema/Emoji";
|
||||
import { ActivitySchema } from "./Schema/Activity";
|
||||
import { IdentifySchema } from "./Schema/Identify";
|
||||
export { checkToken, Config, Constants, db, DefaultOptions, Channel, Emoji, Guild, Invite, Member, Role, User, EmojiSchema, ActivitySchema, IdentifySchema, };
|
||||
|
16
dist/index.js
vendored
16
dist/index.js
vendored
@ -22,14 +22,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DefaultOptions = exports.db = exports.Constants = exports.Config = exports.checkToken = void 0;
|
||||
const checkToken_1 = require("./checkToken");
|
||||
exports.IdentifySchema = exports.ActivitySchema = exports.EmojiSchema = exports.DefaultOptions = exports.db = exports.Constants = exports.Config = exports.checkToken = void 0;
|
||||
const checkToken_1 = require("./util/checkToken");
|
||||
Object.defineProperty(exports, "checkToken", { enumerable: true, get: function () { return checkToken_1.checkToken; } });
|
||||
const Config_1 = __importStar(require("./Config"));
|
||||
const Config_1 = __importStar(require("./util/Config"));
|
||||
exports.Config = Config_1.default;
|
||||
Object.defineProperty(exports, "DefaultOptions", { enumerable: true, get: function () { return Config_1.DefaultOptions; } });
|
||||
const Database_1 = __importDefault(require("./Database"));
|
||||
const Database_1 = __importDefault(require("./util/Database"));
|
||||
exports.db = Database_1.default;
|
||||
const Constants = __importStar(require("./Constants"));
|
||||
const Constants = __importStar(require("./util/Constants"));
|
||||
exports.Constants = Constants;
|
||||
const Emoji_1 = require("./Schema/Emoji");
|
||||
Object.defineProperty(exports, "EmojiSchema", { enumerable: true, get: function () { return Emoji_1.EmojiSchema; } });
|
||||
const Activity_1 = require("./Schema/Activity");
|
||||
Object.defineProperty(exports, "ActivitySchema", { enumerable: true, get: function () { return Activity_1.ActivitySchema; } });
|
||||
const Identify_1 = require("./Schema/Identify");
|
||||
Object.defineProperty(exports, "IdentifySchema", { enumerable: true, get: function () { return Identify_1.IdentifySchema; } });
|
||||
//# sourceMappingURL=index.js.map
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA0C;AAKjC,2FALA,uBAAU,OAKA;AAJnB,mDAAkD;AAI7B,iBAJd,gBAAM,CAIc;AAAiB,+FAJ3B,uBAAc,OAI2B;AAH1D,0DAA4B;AAGY,aAHjC,kBAAE,CAGiC;AAF1C,uDAAyC;AAEZ,8BAAS"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA+C;AAgB9C,2FAhBQ,uBAAU,OAgBR;AAfX,wDAAuD;AAgBtD,iBAhBM,gBAAM,CAgBN;AAGN,+FAnBgB,uBAAc,OAmBhB;AAlBf,+DAAiC;AAiBhC,aAjBM,kBAAE,CAiBN;AAhBH,4DAA8C;AAe7C,8BAAS;AAPV,0CAA6C;AAiB5C,4FAjBQ,mBAAW,OAiBR;AAhBZ,gDAAmD;AAiBlD,+FAjBQ,yBAAc,OAiBR;AAhBf,gDAAmD;AAiBlD,+FAjBQ,yBAAc,OAiBR"}
|
19
dist/models/Channel.d.ts
vendored
Normal file
19
dist/models/Channel.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
export interface Channel {
|
||||
id: bigint;
|
||||
guild_id: bigint;
|
||||
last_message_id: string;
|
||||
last_pin_timestamp: string;
|
||||
name: string;
|
||||
nsfw: boolean;
|
||||
parent_id: bigint;
|
||||
position: number;
|
||||
rate_limit_per_user: number;
|
||||
topic: string | null;
|
||||
type: number;
|
||||
permission_overwrites: {
|
||||
allow: bigint;
|
||||
deny: bigint;
|
||||
id: bigint;
|
||||
type: number;
|
||||
}[];
|
||||
}
|
3
dist/models/Channel.js
vendored
Normal file
3
dist/models/Channel.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=Channel.js.map
|
1
dist/models/Channel.js.map
vendored
Normal file
1
dist/models/Channel.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../../src/models/Channel.ts"],"names":[],"mappings":""}
|
12
dist/models/Emoji.d.ts
vendored
Normal file
12
dist/models/Emoji.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
export interface Emoji {
|
||||
allNamesString: string;
|
||||
animated: boolean;
|
||||
available: boolean;
|
||||
guildId: bigint;
|
||||
id: bigint;
|
||||
managed: boolean;
|
||||
name: string;
|
||||
require_colons: boolean;
|
||||
url: string;
|
||||
roles: [];
|
||||
}
|
3
dist/models/Emoji.js
vendored
Normal file
3
dist/models/Emoji.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=Emoji.js.map
|
1
dist/models/Emoji.js.map
vendored
Normal file
1
dist/models/Emoji.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../src/models/Emoji.ts"],"names":[],"mappings":""}
|
52
dist/models/Guild.d.ts
vendored
Normal file
52
dist/models/Guild.d.ts
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
import { Channel } from "./Channel";
|
||||
import { Emoji } from "./Emoji";
|
||||
import { Member } from "./Member";
|
||||
import { Role } from "./Role";
|
||||
export interface Guild {
|
||||
id: bigint;
|
||||
name: string;
|
||||
icon: string;
|
||||
icon_hash: string;
|
||||
splash: string;
|
||||
discovery_splash: string;
|
||||
owner: boolean;
|
||||
owner_id: bigint;
|
||||
permissions: string;
|
||||
region: string;
|
||||
afk_channel_id: bigint;
|
||||
afk_timeout: number;
|
||||
widget_enabled: boolean;
|
||||
widget_channel_id: bigint;
|
||||
verification_level: number;
|
||||
default_message_notifications: number;
|
||||
explicit_content_filter: number;
|
||||
roles: Role[];
|
||||
emojis: Emoji[];
|
||||
features: [];
|
||||
mfa_level: number;
|
||||
application_id: bigint;
|
||||
system_channel_id: bigint;
|
||||
system_channel_flags: number;
|
||||
rules_channel_id: bigint;
|
||||
joined_at: number;
|
||||
large: boolean;
|
||||
unavailable: boolean;
|
||||
member_count: number;
|
||||
voice_states: [];
|
||||
members: Member[];
|
||||
channels: Channel[];
|
||||
presences: [];
|
||||
max_presences: number;
|
||||
max_members: number;
|
||||
vanity_url_code: string;
|
||||
description: string;
|
||||
banner: string;
|
||||
premium_tier: number;
|
||||
premium_subscription_count: number;
|
||||
preferred_locale: string;
|
||||
public_updates_channel_id: bigint;
|
||||
max_video_channel_users: number;
|
||||
approximate_member_count: number;
|
||||
approximate_presence_count: number;
|
||||
welcome_screen: [];
|
||||
}
|
3
dist/models/Guild.js
vendored
Normal file
3
dist/models/Guild.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=Guild.js.map
|
1
dist/models/Guild.js.map
vendored
Normal file
1
dist/models/Guild.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Guild.js","sourceRoot":"","sources":["../../src/models/Guild.ts"],"names":[],"mappings":""}
|
30
dist/models/Invite.d.ts
vendored
Normal file
30
dist/models/Invite.d.ts
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
export interface Invite {
|
||||
code: string;
|
||||
guild: {
|
||||
id: bigint;
|
||||
name: string;
|
||||
splash: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
features: Object;
|
||||
verification_level: number;
|
||||
};
|
||||
channel: {
|
||||
id: bigint;
|
||||
name: string;
|
||||
type: number;
|
||||
};
|
||||
inviter: {
|
||||
id: bigint;
|
||||
username: string;
|
||||
avatar: string;
|
||||
discriminator: number;
|
||||
};
|
||||
target_user: {
|
||||
id: bigint;
|
||||
username: string;
|
||||
avatar: string;
|
||||
discriminator: number;
|
||||
};
|
||||
target_user_type: number;
|
||||
}
|
3
dist/models/Invite.js
vendored
Normal file
3
dist/models/Invite.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=Invite.js.map
|
1
dist/models/Invite.js.map
vendored
Normal file
1
dist/models/Invite.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Invite.js","sourceRoot":"","sources":["../../src/models/Invite.ts"],"names":[],"mappings":""}
|
13
dist/models/Member.d.ts
vendored
Normal file
13
dist/models/Member.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import { Role } from "./Role";
|
||||
import { User } from "./User";
|
||||
export interface Member {
|
||||
user: User;
|
||||
nick: string;
|
||||
roles: Role[];
|
||||
joined_at: number;
|
||||
premium_since: number;
|
||||
deaf: boolean;
|
||||
mute: boolean;
|
||||
pending: boolean;
|
||||
permissions: string;
|
||||
}
|
3
dist/models/Member.js
vendored
Normal file
3
dist/models/Member.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=Member.js.map
|
1
dist/models/Member.js.map
vendored
Normal file
1
dist/models/Member.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Member.js","sourceRoot":"","sources":["../../src/models/Member.ts"],"names":[],"mappings":""}
|
9
dist/models/Role.d.ts
vendored
Normal file
9
dist/models/Role.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
export interface Role {
|
||||
color: number;
|
||||
hoist: boolean;
|
||||
managed: boolean;
|
||||
mentionable: boolean;
|
||||
name: string;
|
||||
permissions: bigint;
|
||||
position: number;
|
||||
}
|
3
dist/models/Role.js
vendored
Normal file
3
dist/models/Role.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=Role.js.map
|
1
dist/models/Role.js.map
vendored
Normal file
1
dist/models/Role.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Role.js","sourceRoot":"","sources":["../../src/models/Role.ts"],"names":[],"mappings":""}
|
60
dist/models/User.d.ts
vendored
Normal file
60
dist/models/User.d.ts
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
export interface User {
|
||||
id: bigint;
|
||||
username: string;
|
||||
discriminator: string;
|
||||
avatar: string | null;
|
||||
bot: boolean;
|
||||
system: boolean;
|
||||
mfa_enabled: boolean;
|
||||
created_at: number;
|
||||
verified: boolean;
|
||||
email: string;
|
||||
flags: bigint;
|
||||
hash: string;
|
||||
valid_tokens_since: number;
|
||||
user_settings: UserSettings;
|
||||
}
|
||||
export interface UserSettings {
|
||||
afk_timeout: number;
|
||||
allow_accessibility_detection: boolean;
|
||||
animate_emoji: boolean;
|
||||
animate_stickers: number;
|
||||
contact_sync_enabled: boolean;
|
||||
convert_emoticons: boolean;
|
||||
custom_status: {
|
||||
emoji_id: bigint | null;
|
||||
emoji_name: string | null;
|
||||
expires_at: number | null;
|
||||
text: string | null;
|
||||
};
|
||||
default_guilds_restricted: boolean;
|
||||
detect_platform_accounts: boolean;
|
||||
developer_mode: boolean;
|
||||
disable_games_tab: boolean;
|
||||
enable_tts_command: boolean;
|
||||
explicit_content_filter: number;
|
||||
friend_source_flags: {
|
||||
all: boolean;
|
||||
};
|
||||
gif_auto_play: boolean;
|
||||
guild_folders: {
|
||||
color: number;
|
||||
guild_ids: bigint[];
|
||||
id: number;
|
||||
name: string;
|
||||
}[];
|
||||
guild_positions: bigint[];
|
||||
inline_attachment_media: boolean;
|
||||
inline_embed_media: boolean;
|
||||
locale: string;
|
||||
message_display_compact: boolean;
|
||||
native_phone_integration_enabled: boolean;
|
||||
render_embeds: boolean;
|
||||
render_reactions: boolean;
|
||||
restricted_guilds: bigint[];
|
||||
show_current_game: boolean;
|
||||
status: "online" | "offline" | "dnd" | "idle";
|
||||
stream_notifications_enabled: boolean;
|
||||
theme: "dark" | "white";
|
||||
timezone_offset: number;
|
||||
}
|
3
dist/models/User.js
vendored
Normal file
3
dist/models/User.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=User.js.map
|
1
dist/models/User.js.map
vendored
Normal file
1
dist/models/User.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":""}
|
66
dist/util/BitField.d.ts
vendored
Normal file
66
dist/util/BitField.d.ts
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
export declare type BitFieldResolvable = number | BigInt | BitField | string | BitFieldResolvable[];
|
||||
/**
|
||||
* Data structure that makes it easy to interact with a bitfield.
|
||||
*/
|
||||
export declare class BitField {
|
||||
bitfield: bigint;
|
||||
static FLAGS: Record<string, bigint>;
|
||||
constructor(bits?: BitFieldResolvable);
|
||||
/**
|
||||
* Checks whether the bitfield has a bit, or any of multiple bits.
|
||||
*/
|
||||
any(bit: BitFieldResolvable): boolean;
|
||||
/**
|
||||
* Checks if this bitfield equals another
|
||||
*/
|
||||
equals(bit: BitFieldResolvable): boolean;
|
||||
/**
|
||||
* Checks whether the bitfield has a bit, or multiple bits.
|
||||
*/
|
||||
has(bit: BitFieldResolvable): boolean;
|
||||
/**
|
||||
* Gets all given bits that are missing from the bitfield.
|
||||
*/
|
||||
missing(bits: BitFieldResolvable): BitFieldResolvable[];
|
||||
/**
|
||||
* Freezes these bits, making them immutable.
|
||||
*/
|
||||
freeze(): Readonly<BitField>;
|
||||
/**
|
||||
* Adds bits to these ones.
|
||||
* @param {...BitFieldResolvable} [bits] Bits to add
|
||||
* @returns {BitField} These bits or new BitField if the instance is frozen.
|
||||
*/
|
||||
add(...bits: BitFieldResolvable[]): BitField;
|
||||
/**
|
||||
* Removes bits from these.
|
||||
* @param {...BitFieldResolvable} [bits] Bits to remove
|
||||
*/
|
||||
remove(...bits: BitFieldResolvable[]): BitField;
|
||||
/**
|
||||
* Gets an object mapping field names to a {@link boolean} indicating whether the
|
||||
* bit is available.
|
||||
* @param {...*} hasParams Additional parameters for the has method, if any
|
||||
*/
|
||||
serialize(): Record<string, boolean>;
|
||||
/**
|
||||
* Gets an {@link Array} of bitfield names based on the bits available.
|
||||
*/
|
||||
toArray(): string[];
|
||||
toJSON(): bigint;
|
||||
valueOf(): bigint;
|
||||
[Symbol.iterator](): Generator<string, void, undefined>;
|
||||
/**
|
||||
* Data that can be resolved to give a bitfield. This can be:
|
||||
* * A bit number (this can be a number literal or a value taken from {@link BitField.FLAGS})
|
||||
* * An instance of BitField
|
||||
* * An Array of BitFieldResolvable
|
||||
* @typedef {number|BitField|BitFieldResolvable[]} BitFieldResolvable
|
||||
*/
|
||||
/**
|
||||
* Resolves bitfields to their numeric form.
|
||||
* @param {BitFieldResolvable} [bit=0] - bit(s) to resolve
|
||||
* @returns {number}
|
||||
*/
|
||||
static resolve(bit?: BitFieldResolvable): bigint;
|
||||
}
|
127
dist/util/BitField.js
vendored
Normal file
127
dist/util/BitField.js
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BitField = void 0;
|
||||
/**
|
||||
* Data structure that makes it easy to interact with a bitfield.
|
||||
*/
|
||||
class BitField {
|
||||
constructor(bits = 0) {
|
||||
this.bitfield = BigInt(0);
|
||||
this.bitfield = BitField.resolve(bits);
|
||||
}
|
||||
/**
|
||||
* Checks whether the bitfield has a bit, or any of multiple bits.
|
||||
*/
|
||||
any(bit) {
|
||||
return (this.bitfield & BitField.resolve(bit)) !== 0n;
|
||||
}
|
||||
/**
|
||||
* Checks if this bitfield equals another
|
||||
*/
|
||||
equals(bit) {
|
||||
return this.bitfield === BitField.resolve(bit);
|
||||
}
|
||||
/**
|
||||
* Checks whether the bitfield has a bit, or multiple bits.
|
||||
*/
|
||||
has(bit) {
|
||||
if (Array.isArray(bit))
|
||||
return bit.every((p) => this.has(p));
|
||||
const BIT = BitField.resolve(bit);
|
||||
return (this.bitfield & BIT) === BIT;
|
||||
}
|
||||
/**
|
||||
* Gets all given bits that are missing from the bitfield.
|
||||
*/
|
||||
missing(bits) {
|
||||
if (!Array.isArray(bits))
|
||||
bits = new BitField(bits).toArray();
|
||||
return bits.filter((p) => !this.has(p));
|
||||
}
|
||||
/**
|
||||
* Freezes these bits, making them immutable.
|
||||
*/
|
||||
freeze() {
|
||||
return Object.freeze(this);
|
||||
}
|
||||
/**
|
||||
* Adds bits to these ones.
|
||||
* @param {...BitFieldResolvable} [bits] Bits to add
|
||||
* @returns {BitField} These bits or new BitField if the instance is frozen.
|
||||
*/
|
||||
add(...bits) {
|
||||
let total = 0n;
|
||||
for (const bit of bits) {
|
||||
total |= BitField.resolve(bit);
|
||||
}
|
||||
if (Object.isFrozen(this))
|
||||
return new BitField(this.bitfield | total);
|
||||
this.bitfield |= total;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Removes bits from these.
|
||||
* @param {...BitFieldResolvable} [bits] Bits to remove
|
||||
*/
|
||||
remove(...bits) {
|
||||
let total = 0n;
|
||||
for (const bit of bits) {
|
||||
total |= BitField.resolve(bit);
|
||||
}
|
||||
if (Object.isFrozen(this))
|
||||
return new BitField(this.bitfield & ~total);
|
||||
this.bitfield &= ~total;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Gets an object mapping field names to a {@link boolean} indicating whether the
|
||||
* bit is available.
|
||||
* @param {...*} hasParams Additional parameters for the has method, if any
|
||||
*/
|
||||
serialize() {
|
||||
const serialized = {};
|
||||
for (const [flag, bit] of Object.entries(BitField.FLAGS))
|
||||
serialized[flag] = this.has(bit);
|
||||
return serialized;
|
||||
}
|
||||
/**
|
||||
* Gets an {@link Array} of bitfield names based on the bits available.
|
||||
*/
|
||||
toArray() {
|
||||
return Object.keys(BitField.FLAGS).filter((bit) => this.has(bit));
|
||||
}
|
||||
toJSON() {
|
||||
return this.bitfield;
|
||||
}
|
||||
valueOf() {
|
||||
return this.bitfield;
|
||||
}
|
||||
*[Symbol.iterator]() {
|
||||
yield* this.toArray();
|
||||
}
|
||||
/**
|
||||
* Data that can be resolved to give a bitfield. This can be:
|
||||
* * A bit number (this can be a number literal or a value taken from {@link BitField.FLAGS})
|
||||
* * An instance of BitField
|
||||
* * An Array of BitFieldResolvable
|
||||
* @typedef {number|BitField|BitFieldResolvable[]} BitFieldResolvable
|
||||
*/
|
||||
/**
|
||||
* Resolves bitfields to their numeric form.
|
||||
* @param {BitFieldResolvable} [bit=0] - bit(s) to resolve
|
||||
* @returns {number}
|
||||
*/
|
||||
static resolve(bit = 0n) {
|
||||
if ((typeof bit === "number" || typeof bit === "bigint") && bit >= 0n)
|
||||
return BigInt(bit);
|
||||
if (bit instanceof BitField)
|
||||
return bit.bitfield;
|
||||
if (Array.isArray(bit))
|
||||
return bit.map((p) => this.resolve(p)).reduce((prev, p) => BigInt(prev) | BigInt(p), 0n);
|
||||
if (typeof bit === "string" && typeof this.FLAGS[bit] !== "undefined")
|
||||
return this.FLAGS[bit];
|
||||
throw new RangeError("BITFIELD_INVALID: " + bit);
|
||||
}
|
||||
}
|
||||
exports.BitField = BitField;
|
||||
//# sourceMappingURL=BitField.js.map
|
1
dist/util/BitField.js.map
vendored
Normal file
1
dist/util/BitField.js.map
vendored
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0
dist/Config.js → dist/util/Config.js
vendored
1
dist/util/Config.js.map
vendored
Normal file
1
dist/util/Config.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/util/Config.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAqC;AACrC,0DAA4B;AAE5B,IAAI,MAAqB,CAAC;AAE1B,kBAAe;IACd,IAAI,EAAE,KAAK,UAAU,IAAI,CAAC,OAAuB,sBAAc;QAC9D,MAAM,GAAG,kBAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QACpC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,EAAE,SAAS,GAAG;QACnB,OAAuB,MAAM,CAAC,GAAG,EAAE,CAAC;IACrC,CAAC;IACD,MAAM,EAAE,SAAS,GAAG,CAAC,GAAQ;QAC5B,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CACD,CAAC;AAQW,QAAA,cAAc,GAAmB;IAC7C,GAAG,EAAE,EAAE;IACP,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE;CACT,CAAC"}
|
1
dist/util/Constants.js.map
vendored
Normal file
1
dist/util/Constants.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/util/Constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAkB,EAAE,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC"}
|
1
dist/util/Database.js.map
vendored
Normal file
1
dist/util/Database.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../src/util/Database.ts"],"names":[],"mappings":";;AAAA,2CAA2C;AAE3C,6BAA6B;AAC7B,MAAM,EAAE,GAAG,IAAI,0BAAa,CAAC,qEAAqE,CAAC,CAAC;AAEpG,kBAAe,EAAE,CAAC"}
|
20
dist/util/Intents.d.ts
vendored
Normal file
20
dist/util/Intents.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
import { BitField } from "./BitField";
|
||||
export declare class Intents extends BitField {
|
||||
static FLAGS: {
|
||||
GUILDS: bigint;
|
||||
GUILD_MEMBERS: bigint;
|
||||
GUILD_BANS: bigint;
|
||||
GUILD_EMOJIS: bigint;
|
||||
GUILD_INTEGRATIONS: bigint;
|
||||
GUILD_WEBHOOKS: bigint;
|
||||
GUILD_INVITES: bigint;
|
||||
GUILD_VOICE_STATES: bigint;
|
||||
GUILD_PRESENCES: bigint;
|
||||
GUILD_MESSAGES: bigint;
|
||||
GUILD_MESSAGE_REACTIONS: bigint;
|
||||
GUILD_MESSAGE_TYPING: bigint;
|
||||
DIRECT_MESSAGES: bigint;
|
||||
DIRECT_MESSAGE_REACTIONS: bigint;
|
||||
DIRECT_MESSAGE_TYPING: bigint;
|
||||
};
|
||||
}
|
25
dist/util/Intents.js
vendored
Normal file
25
dist/util/Intents.js
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Intents = void 0;
|
||||
const BitField_1 = require("./BitField");
|
||||
class Intents extends BitField_1.BitField {
|
||||
}
|
||||
exports.Intents = Intents;
|
||||
Intents.FLAGS = {
|
||||
GUILDS: 1n << 0n,
|
||||
GUILD_MEMBERS: 1n << 1n,
|
||||
GUILD_BANS: 1n << 2n,
|
||||
GUILD_EMOJIS: 1n << 3n,
|
||||
GUILD_INTEGRATIONS: 1n << 4n,
|
||||
GUILD_WEBHOOKS: 1n << 5n,
|
||||
GUILD_INVITES: 1n << 6n,
|
||||
GUILD_VOICE_STATES: 1n << 7n,
|
||||
GUILD_PRESENCES: 1n << 8n,
|
||||
GUILD_MESSAGES: 1n << 9n,
|
||||
GUILD_MESSAGE_REACTIONS: 1n << 10n,
|
||||
GUILD_MESSAGE_TYPING: 1n << 11n,
|
||||
DIRECT_MESSAGES: 1n << 12n,
|
||||
DIRECT_MESSAGE_REACTIONS: 1n << 13n,
|
||||
DIRECT_MESSAGE_TYPING: 1n << 14n,
|
||||
};
|
||||
//# sourceMappingURL=Intents.js.map
|
1
dist/util/Intents.js.map
vendored
Normal file
1
dist/util/Intents.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Intents.js","sourceRoot":"","sources":["../../src/util/Intents.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAEtC,MAAa,OAAQ,SAAQ,mBAAQ;;AAArC,0BAkBC;AAjBO,aAAK,GAAG;IACd,MAAM,EAAE,EAAE,IAAI,EAAE;IAChB,aAAa,EAAE,EAAE,IAAI,EAAE;IACvB,UAAU,EAAE,EAAE,IAAI,EAAE;IACpB,YAAY,EAAE,EAAE,IAAI,EAAE;IACtB,kBAAkB,EAAE,EAAE,IAAI,EAAE;IAC5B,cAAc,EAAE,EAAE,IAAI,EAAE;IACxB,aAAa,EAAE,EAAE,IAAI,EAAE;IACvB,kBAAkB,EAAE,EAAE,IAAI,EAAE;IAC5B,eAAe,EAAE,EAAE,IAAI,EAAE;IACzB,cAAc,EAAE,EAAE,IAAI,EAAE;IACxB,uBAAuB,EAAE,EAAE,IAAI,GAAG;IAClC,oBAAoB,EAAE,EAAE,IAAI,GAAG;IAC/B,eAAe,EAAE,EAAE,IAAI,GAAG;IAC1B,wBAAwB,EAAE,EAAE,IAAI,GAAG;IACnC,qBAAqB,EAAE,EAAE,IAAI,GAAG;CAChC,CAAC"}
|
10
dist/util/MessageFlags.d.ts
vendored
Normal file
10
dist/util/MessageFlags.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import { BitField } from "./BitField";
|
||||
export declare class MessageFlags extends BitField {
|
||||
static FLAGS: {
|
||||
CROSSPOSTED: bigint;
|
||||
IS_CROSSPOST: bigint;
|
||||
SUPPRESS_EMBEDS: bigint;
|
||||
SOURCE_MESSAGE_DELETED: bigint;
|
||||
URGENT: bigint;
|
||||
};
|
||||
}
|
17
dist/util/MessageFlags.js
vendored
Normal file
17
dist/util/MessageFlags.js
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
// https://github.com/discordjs/discord.js/blob/master/src/util/MessageFlags.js
|
||||
// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MessageFlags = void 0;
|
||||
const BitField_1 = require("./BitField");
|
||||
class MessageFlags extends BitField_1.BitField {
|
||||
}
|
||||
exports.MessageFlags = MessageFlags;
|
||||
MessageFlags.FLAGS = {
|
||||
CROSSPOSTED: 1n << 0n,
|
||||
IS_CROSSPOST: 1n << 1n,
|
||||
SUPPRESS_EMBEDS: 1n << 2n,
|
||||
SOURCE_MESSAGE_DELETED: 1n << 3n,
|
||||
URGENT: 1n << 4n,
|
||||
};
|
||||
//# sourceMappingURL=MessageFlags.js.map
|
1
dist/util/MessageFlags.js.map
vendored
Normal file
1
dist/util/MessageFlags.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"MessageFlags.js","sourceRoot":"","sources":["../../src/util/MessageFlags.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,8DAA8D;;;AAE9D,yCAAsC;AAEtC,MAAa,YAAa,SAAQ,mBAAQ;;AAA1C,oCAQC;AAPO,kBAAK,GAAG;IACd,WAAW,EAAE,EAAE,IAAI,EAAE;IACrB,YAAY,EAAE,EAAE,IAAI,EAAE;IACtB,eAAe,EAAE,EAAE,IAAI,EAAE;IACzB,sBAAsB,EAAE,EAAE,IAAI,EAAE;IAChC,MAAM,EAAE,EAAE,IAAI,EAAE;CAChB,CAAC"}
|
45
dist/util/Permissions.d.ts
vendored
Normal file
45
dist/util/Permissions.d.ts
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
import { BitField } from "./BitField";
|
||||
export declare type PermissionResolvable = string | number | Permissions | PermissionResolvable[];
|
||||
export declare class Permissions extends BitField {
|
||||
static FLAGS: {
|
||||
CREATE_INSTANT_INVITE: bigint;
|
||||
KICK_MEMBERS: bigint;
|
||||
BAN_MEMBERS: bigint;
|
||||
ADMINISTRATOR: bigint;
|
||||
MANAGE_CHANNELS: bigint;
|
||||
MANAGE_GUILD: bigint;
|
||||
ADD_REACTIONS: bigint;
|
||||
VIEW_AUDIT_LOG: bigint;
|
||||
PRIORITY_SPEAKER: bigint;
|
||||
STREAM: bigint;
|
||||
VIEW_CHANNEL: bigint;
|
||||
SEND_MESSAGES: bigint;
|
||||
SEND_TTS_MESSAGES: bigint;
|
||||
MANAGE_MESSAGES: bigint;
|
||||
EMBED_LINKS: bigint;
|
||||
ATTACH_FILES: bigint;
|
||||
READ_MESSAGE_HISTORY: bigint;
|
||||
MENTION_EVERYONE: bigint;
|
||||
USE_EXTERNAL_EMOJIS: bigint;
|
||||
VIEW_GUILD_INSIGHTS: bigint;
|
||||
CONNECT: bigint;
|
||||
SPEAK: bigint;
|
||||
MUTE_MEMBERS: bigint;
|
||||
DEAFEN_MEMBERS: bigint;
|
||||
MOVE_MEMBERS: bigint;
|
||||
USE_VAD: bigint;
|
||||
CHANGE_NICKNAME: bigint;
|
||||
MANAGE_NICKNAMES: bigint;
|
||||
MANAGE_ROLES: bigint;
|
||||
MANAGE_WEBHOOKS: bigint;
|
||||
MANAGE_EMOJIS: bigint;
|
||||
};
|
||||
any(permission: PermissionResolvable, checkAdmin?: boolean): boolean;
|
||||
/**
|
||||
* Checks whether the bitfield has a permission, or multiple permissions.
|
||||
* @param {PermissionResolvable} permission Permission(s) to check for
|
||||
* @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override
|
||||
* @returns {boolean}
|
||||
*/
|
||||
has(permission: PermissionResolvable, checkAdmin?: boolean): boolean;
|
||||
}
|
55
dist/util/Permissions.js
vendored
Normal file
55
dist/util/Permissions.js
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
// https://github.com/discordjs/discord.js/blob/master/src/util/Permissions.js
|
||||
// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Permissions = void 0;
|
||||
const BitField_1 = require("./BitField");
|
||||
class Permissions extends BitField_1.BitField {
|
||||
any(permission, checkAdmin = true) {
|
||||
return (checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.any(permission);
|
||||
}
|
||||
/**
|
||||
* Checks whether the bitfield has a permission, or multiple permissions.
|
||||
* @param {PermissionResolvable} permission Permission(s) to check for
|
||||
* @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override
|
||||
* @returns {boolean}
|
||||
*/
|
||||
has(permission, checkAdmin = true) {
|
||||
return (checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.has(permission);
|
||||
}
|
||||
}
|
||||
exports.Permissions = Permissions;
|
||||
Permissions.FLAGS = {
|
||||
CREATE_INSTANT_INVITE: 1n << 0n,
|
||||
KICK_MEMBERS: 1n << 1n,
|
||||
BAN_MEMBERS: 1n << 2n,
|
||||
ADMINISTRATOR: 1n << 3n,
|
||||
MANAGE_CHANNELS: 1n << 4n,
|
||||
MANAGE_GUILD: 1n << 5n,
|
||||
ADD_REACTIONS: 1n << 6n,
|
||||
VIEW_AUDIT_LOG: 1n << 7n,
|
||||
PRIORITY_SPEAKER: 1n << 8n,
|
||||
STREAM: 1n << 9n,
|
||||
VIEW_CHANNEL: 1n << 10n,
|
||||
SEND_MESSAGES: 1n << 11n,
|
||||
SEND_TTS_MESSAGES: 1n << 12n,
|
||||
MANAGE_MESSAGES: 1n << 13n,
|
||||
EMBED_LINKS: 1n << 14n,
|
||||
ATTACH_FILES: 1n << 15n,
|
||||
READ_MESSAGE_HISTORY: 1n << 16n,
|
||||
MENTION_EVERYONE: 1n << 17n,
|
||||
USE_EXTERNAL_EMOJIS: 1n << 18n,
|
||||
VIEW_GUILD_INSIGHTS: 1n << 19n,
|
||||
CONNECT: 1n << 20n,
|
||||
SPEAK: 1n << 21n,
|
||||
MUTE_MEMBERS: 1n << 22n,
|
||||
DEAFEN_MEMBERS: 1n << 23n,
|
||||
MOVE_MEMBERS: 1n << 24n,
|
||||
USE_VAD: 1n << 25n,
|
||||
CHANGE_NICKNAME: 1n << 26n,
|
||||
MANAGE_NICKNAMES: 1n << 27n,
|
||||
MANAGE_ROLES: 1n << 28n,
|
||||
MANAGE_WEBHOOKS: 1n << 29n,
|
||||
MANAGE_EMOJIS: 1n << 30n,
|
||||
};
|
||||
//# sourceMappingURL=Permissions.js.map
|
1
dist/util/Permissions.js.map
vendored
Normal file
1
dist/util/Permissions.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Permissions.js","sourceRoot":"","sources":["../../src/util/Permissions.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,8DAA8D;;;AAE9D,yCAAsC;AAItC,MAAa,WAAY,SAAQ,mBAAQ;IAmCxC,GAAG,CAAC,UAAgC,EAAE,UAAU,GAAG,IAAI;QACtD,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5F,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,UAAgC,EAAE,UAAU,GAAG,IAAI;QACtD,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5F,CAAC;;AA/CF,kCAgDC;AA/CO,iBAAK,GAAG;IACd,qBAAqB,EAAE,EAAE,IAAI,EAAE;IAC/B,YAAY,EAAE,EAAE,IAAI,EAAE;IACtB,WAAW,EAAE,EAAE,IAAI,EAAE;IACrB,aAAa,EAAE,EAAE,IAAI,EAAE;IACvB,eAAe,EAAE,EAAE,IAAI,EAAE;IACzB,YAAY,EAAE,EAAE,IAAI,EAAE;IACtB,aAAa,EAAE,EAAE,IAAI,EAAE;IACvB,cAAc,EAAE,EAAE,IAAI,EAAE;IACxB,gBAAgB,EAAE,EAAE,IAAI,EAAE;IAC1B,MAAM,EAAE,EAAE,IAAI,EAAE;IAChB,YAAY,EAAE,EAAE,IAAI,GAAG;IACvB,aAAa,EAAE,EAAE,IAAI,GAAG;IACxB,iBAAiB,EAAE,EAAE,IAAI,GAAG;IAC5B,eAAe,EAAE,EAAE,IAAI,GAAG;IAC1B,WAAW,EAAE,EAAE,IAAI,GAAG;IACtB,YAAY,EAAE,EAAE,IAAI,GAAG;IACvB,oBAAoB,EAAE,EAAE,IAAI,GAAG;IAC/B,gBAAgB,EAAE,EAAE,IAAI,GAAG;IAC3B,mBAAmB,EAAE,EAAE,IAAI,GAAG;IAC9B,mBAAmB,EAAE,EAAE,IAAI,GAAG;IAC9B,OAAO,EAAE,EAAE,IAAI,GAAG;IAClB,KAAK,EAAE,EAAE,IAAI,GAAG;IAChB,YAAY,EAAE,EAAE,IAAI,GAAG;IACvB,cAAc,EAAE,EAAE,IAAI,GAAG;IACzB,YAAY,EAAE,EAAE,IAAI,GAAG;IACvB,OAAO,EAAE,EAAE,IAAI,GAAG;IAClB,eAAe,EAAE,EAAE,IAAI,GAAG;IAC1B,gBAAgB,EAAE,EAAE,IAAI,GAAG;IAC3B,YAAY,EAAE,EAAE,IAAI,GAAG;IACvB,eAAe,EAAE,EAAE,IAAI,GAAG;IAC1B,aAAa,EAAE,EAAE,IAAI,GAAG;CACxB,CAAC"}
|
58
dist/util/Snowflake.d.ts
vendored
Normal file
58
dist/util/Snowflake.d.ts
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* A container for useful snowflake-related methods.
|
||||
*/
|
||||
export declare class Snowflake {
|
||||
static readonly EPOCH = 1420070400000;
|
||||
static INCREMENT: bigint;
|
||||
static processId: bigint;
|
||||
static workerId: bigint;
|
||||
constructor();
|
||||
/**
|
||||
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
|
||||
* ```
|
||||
* If we have a snowflake '266241948824764416' we can represent it as binary:
|
||||
*
|
||||
* 64 22 17 12 0
|
||||
* 000000111011000111100001101001000101000000 00001 00000 000000000000
|
||||
* number of ms since Discord epoch worker pid increment
|
||||
* ```
|
||||
* @typedef {string} Snowflake
|
||||
*/
|
||||
/**
|
||||
* Transforms a snowflake from a decimal string to a bit string.
|
||||
* @param {Snowflake} num Snowflake to be transformed
|
||||
* @returns {string}
|
||||
* @private
|
||||
*/
|
||||
static idToBinary(num: any): string;
|
||||
/**
|
||||
* Transforms a snowflake from a bit string to a decimal string.
|
||||
* @param {string} num Bit string to be transformed
|
||||
* @returns {Snowflake}
|
||||
* @private
|
||||
*/
|
||||
static binaryToID(num: any): string;
|
||||
static generate(): bigint;
|
||||
/**
|
||||
* A deconstructed snowflake.
|
||||
* @typedef {Object} DeconstructedSnowflake
|
||||
* @property {number} timestamp Timestamp the snowflake was created
|
||||
* @property {Date} date Date the snowflake was created
|
||||
* @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
|
||||
*/
|
||||
/**
|
||||
* Deconstructs a Discord snowflake.
|
||||
* @param {Snowflake} snowflake Snowflake to deconstruct
|
||||
* @returns {DeconstructedSnowflake} Deconstructed snowflake
|
||||
*/
|
||||
static deconstruct(snowflake: any): {
|
||||
timestamp: any;
|
||||
workerID: number;
|
||||
processID: number;
|
||||
increment: number;
|
||||
binary: string;
|
||||
};
|
||||
}
|
116
dist/util/Snowflake.js
vendored
Normal file
116
dist/util/Snowflake.js
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
// @ts-nocheck
|
||||
// https://github.com/discordjs/discord.js/blob/master/src/util/Snowflake.js
|
||||
// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Snowflake = void 0;
|
||||
// Discord epoch (2015-01-01T00:00:00.000Z)
|
||||
/**
|
||||
* A container for useful snowflake-related methods.
|
||||
*/
|
||||
class Snowflake {
|
||||
constructor() {
|
||||
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
||||
}
|
||||
/**
|
||||
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
|
||||
* ```
|
||||
* If we have a snowflake '266241948824764416' we can represent it as binary:
|
||||
*
|
||||
* 64 22 17 12 0
|
||||
* 000000111011000111100001101001000101000000 00001 00000 000000000000
|
||||
* number of ms since Discord epoch worker pid increment
|
||||
* ```
|
||||
* @typedef {string} Snowflake
|
||||
*/
|
||||
/**
|
||||
* Transforms a snowflake from a decimal string to a bit string.
|
||||
* @param {Snowflake} num Snowflake to be transformed
|
||||
* @returns {string}
|
||||
* @private
|
||||
*/
|
||||
static idToBinary(num) {
|
||||
let bin = "";
|
||||
let high = parseInt(num.slice(0, -10)) || 0;
|
||||
let low = parseInt(num.slice(-10));
|
||||
while (low > 0 || high > 0) {
|
||||
bin = String(low & 1) + bin;
|
||||
low = Math.floor(low / 2);
|
||||
if (high > 0) {
|
||||
low += 5000000000 * (high % 2);
|
||||
high = Math.floor(high / 2);
|
||||
}
|
||||
}
|
||||
return bin;
|
||||
}
|
||||
/**
|
||||
* Transforms a snowflake from a bit string to a decimal string.
|
||||
* @param {string} num Bit string to be transformed
|
||||
* @returns {Snowflake}
|
||||
* @private
|
||||
*/
|
||||
static binaryToID(num) {
|
||||
let dec = "";
|
||||
while (num.length > 50) {
|
||||
const high = parseInt(num.slice(0, -32), 2);
|
||||
const low = parseInt((high % 10).toString(2) + num.slice(-32), 2);
|
||||
dec = (low % 10).toString() + dec;
|
||||
num =
|
||||
Math.floor(high / 10).toString(2) +
|
||||
Math.floor(low / 10)
|
||||
.toString(2)
|
||||
.padStart(32, "0");
|
||||
}
|
||||
num = parseInt(num, 2);
|
||||
while (num > 0) {
|
||||
dec = (num % 10).toString() + dec;
|
||||
num = Math.floor(num / 10);
|
||||
}
|
||||
return dec;
|
||||
}
|
||||
static generate() {
|
||||
var time = BigInt(Date.now() - Snowflake.EPOCH) << 22n;
|
||||
var worker = Snowflake.workerId << 17n;
|
||||
var process = Snowflake.processId << 12n;
|
||||
var increment = Snowflake.INCREMENT++;
|
||||
return time | worker | process | increment;
|
||||
}
|
||||
/**
|
||||
* A deconstructed snowflake.
|
||||
* @typedef {Object} DeconstructedSnowflake
|
||||
* @property {number} timestamp Timestamp the snowflake was created
|
||||
* @property {Date} date Date the snowflake was created
|
||||
* @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
|
||||
*/
|
||||
/**
|
||||
* Deconstructs a Discord snowflake.
|
||||
* @param {Snowflake} snowflake Snowflake to deconstruct
|
||||
* @returns {DeconstructedSnowflake} Deconstructed snowflake
|
||||
*/
|
||||
static deconstruct(snowflake) {
|
||||
const BINARY = Snowflake.idToBinary(snowflake).toString(2).padStart(64, "0");
|
||||
const res = {
|
||||
timestamp: parseInt(BINARY.substring(0, 42), 2) + EPOCH,
|
||||
workerID: parseInt(BINARY.substring(42, 47), 2),
|
||||
processID: parseInt(BINARY.substring(47, 52), 2),
|
||||
increment: parseInt(BINARY.substring(52, 64), 2),
|
||||
binary: BINARY,
|
||||
};
|
||||
Object.defineProperty(res, "date", {
|
||||
get: function get() {
|
||||
return new Date(this.timestamp);
|
||||
},
|
||||
enumerable: true,
|
||||
});
|
||||
return res;
|
||||
}
|
||||
}
|
||||
exports.Snowflake = Snowflake;
|
||||
Snowflake.EPOCH = 1420070400000;
|
||||
Snowflake.INCREMENT = 0n; // max 4095
|
||||
Snowflake.processId = 0n; // max 31
|
||||
Snowflake.workerId = 0n; // max 31
|
||||
//# sourceMappingURL=Snowflake.js.map
|
1
dist/util/Snowflake.js.map
vendored
Normal file
1
dist/util/Snowflake.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Snowflake.js","sourceRoot":"","sources":["../../src/util/Snowflake.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,4EAA4E;AAC5E,8DAA8D;AAC9D,YAAY,CAAC;;;AAEb,2CAA2C;AAE3C;;GAEG;AACH,MAAa,SAAS;IAMrB;QACC,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,iCAAiC,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;;;;;OAUG;IAEH;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG;QACpB,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,IAAI,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACnC,OAAO,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE;YAC3B,GAAG,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;YAC5B,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;YAC1B,IAAI,IAAI,GAAG,CAAC,EAAE;gBACb,GAAG,IAAI,UAAU,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;gBAC/B,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;aAC5B;SACD;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG;Q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|
3
dist/util/String.d.ts
vendored
Normal file
3
dist/util/String.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export declare const DOUBLE_WHITE_SPACE: RegExp;
|
||||
export declare const SPECIAL_CHAR: RegExp;
|
||||
export declare function trimSpecial(str: string): string;
|
10
dist/util/String.js
vendored
Normal file
10
dist/util/String.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.trimSpecial = exports.SPECIAL_CHAR = exports.DOUBLE_WHITE_SPACE = void 0;
|
||||
exports.DOUBLE_WHITE_SPACE = /\s\s+/g;
|
||||
exports.SPECIAL_CHAR = /[@#`:\r\n\t\f\v\p{C}]/gu;
|
||||
function trimSpecial(str) {
|
||||
return str.replace(exports.SPECIAL_CHAR, "").replace(exports.DOUBLE_WHITE_SPACE, " ").trim();
|
||||
}
|
||||
exports.trimSpecial = trimSpecial;
|
||||
//# sourceMappingURL=String.js.map
|
1
dist/util/String.js.map
vendored
Normal file
1
dist/util/String.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"String.js","sourceRoot":"","sources":["../../src/util/String.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,QAAQ,CAAC;AAC9B,QAAA,YAAY,GAAG,yBAAyB,CAAC;AAEtD,SAAgB,WAAW,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAY,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,0BAAkB,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9E,CAAC;AAFD,kCAEC"}
|
18
dist/util/UserFlags.d.ts
vendored
Normal file
18
dist/util/UserFlags.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import { BitField } from "./BitField";
|
||||
export declare class UserFlags extends BitField {
|
||||
static FLAGS: {
|
||||
DISCORD_EMPLOYEE: bigint;
|
||||
PARTNERED_SERVER_OWNER: bigint;
|
||||
HYPESQUAD_EVENTS: bigint;
|
||||
BUGHUNTER_LEVEL_1: bigint;
|
||||
HOUSE_BRAVERY: bigint;
|
||||
HOUSE_BRILLIANCE: bigint;
|
||||
HOUSE_BALANCE: bigint;
|
||||
EARLY_SUPPORTER: bigint;
|
||||
TEAM_USER: bigint;
|
||||
SYSTEM: bigint;
|
||||
BUGHUNTER_LEVEL_2: bigint;
|
||||
VERIFIED_BOT: bigint;
|
||||
EARLY_VERIFIED_BOT_DEVELOPER: bigint;
|
||||
};
|
||||
}
|
25
dist/util/UserFlags.js
vendored
Normal file
25
dist/util/UserFlags.js
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
// https://github.com/discordjs/discord.js/blob/master/src/util/UserFlags.js
|
||||
// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UserFlags = void 0;
|
||||
const BitField_1 = require("./BitField");
|
||||
class UserFlags extends BitField_1.BitField {
|
||||
}
|
||||
exports.UserFlags = UserFlags;
|
||||
UserFlags.FLAGS = {
|
||||
DISCORD_EMPLOYEE: 1n << 0n,
|
||||
PARTNERED_SERVER_OWNER: 1n << 1n,
|
||||
HYPESQUAD_EVENTS: 1n << 2n,
|
||||
BUGHUNTER_LEVEL_1: 1n << 3n,
|
||||
HOUSE_BRAVERY: 1n << 6n,
|
||||
HOUSE_BRILLIANCE: 1n << 7n,
|
||||
HOUSE_BALANCE: 1n << 8n,
|
||||
EARLY_SUPPORTER: 1n << 9n,
|
||||
TEAM_USER: 1n << 10n,
|
||||
SYSTEM: 1n << 12n,
|
||||
BUGHUNTER_LEVEL_2: 1n << 14n,
|
||||
VERIFIED_BOT: 1n << 16n,
|
||||
EARLY_VERIFIED_BOT_DEVELOPER: 1n << 17n,
|
||||
};
|
||||
//# sourceMappingURL=UserFlags.js.map
|
1
dist/util/UserFlags.js.map
vendored
Normal file
1
dist/util/UserFlags.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"UserFlags.js","sourceRoot":"","sources":["../../src/util/UserFlags.ts"],"names":[],"mappings":";AAAA,4EAA4E;AAC5E,8DAA8D;;;AAE9D,yCAAsC;AAEtC,MAAa,SAAU,SAAQ,mBAAQ;;AAAvC,8BAgBC;AAfO,eAAK,GAAG;IACd,gBAAgB,EAAE,EAAE,IAAI,EAAE;IAC1B,sBAAsB,EAAE,EAAE,IAAI,EAAE;IAChC,gBAAgB,EAAE,EAAE,IAAI,EAAE;IAC1B,iBAAiB,EAAE,EAAE,IAAI,EAAE;IAC3B,aAAa,EAAE,EAAE,IAAI,EAAE;IACvB,gBAAgB,EAAE,EAAE,IAAI,EAAE;IAC1B,aAAa,EAAE,EAAE,IAAI,EAAE;IACvB,eAAe,EAAE,EAAE,IAAI,EAAE;IACzB,SAAS,EAAE,EAAE,IAAI,GAAG;IACpB,MAAM,EAAE,EAAE,IAAI,GAAG;IACjB,iBAAiB,EAAE,EAAE,IAAI,GAAG;IAC5B,YAAY,EAAE,EAAE,IAAI,GAAG;IACvB,4BAA4B,EAAE,EAAE,IAAI,GAAG;CACvC,CAAC"}
|
1
dist/util/checkToken.js.map
vendored
Normal file
1
dist/util/checkToken.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"checkToken.js","sourceRoot":"","sources":["../../src/util/checkToken.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAyC;AACzC,gEAA+B;AAC/B,sDAA8B;AAE9B,SAAgB,UAAU,CAAC,KAAa;IACvC,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC/B,sBAAG,CAAC,MAAM,CAAC,KAAK,EAAE,gBAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,EAAE,sBAAU,EAAE,CAAC,GAAG,EAAE,OAAY,EAAE,EAAE;YAC3F,IAAI,GAAG,IAAI,CAAC,OAAO;gBAAE,OAAO,GAAG,CAAC,eAAe,CAAC,CAAC;YAEjD,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AARD,gCAQC"}
|
29
src/index.ts
29
src/index.ts
@ -1,7 +1,7 @@
|
||||
import { checkToken } from "./checkToken";
|
||||
import Config, { DefaultOptions } from "./Config";
|
||||
import db from "./Database";
|
||||
import * as Constants from "./Constants";
|
||||
import { checkToken } from "./util/checkToken";
|
||||
import Config, { DefaultOptions } from "./util/Config";
|
||||
import db from "./util/Database";
|
||||
import * as Constants from "./util/Constants";
|
||||
import { Channel } from "./models/Channel";
|
||||
import { Emoji } from "./models/Emoji";
|
||||
import { Guild } from "./models/Guild";
|
||||
@ -9,5 +9,24 @@ import { Invite } from "./models/Invite";
|
||||
import { Member } from "./models/Member";
|
||||
import { Role } from "./models/Role";
|
||||
import { User } from "./models/User";
|
||||
import { EmojiSchema } from "./Schema/Emoji";
|
||||
import { ActivitySchema } from "./Schema/Activity";
|
||||
import { IdentifySchema } from "./Schema/Identify";
|
||||
|
||||
export { checkToken, Config, Constants, db, DefaultOptions, Channel, Emoji, Guild, Invite, Member, Role, User };
|
||||
export {
|
||||
checkToken,
|
||||
Config,
|
||||
Constants,
|
||||
db,
|
||||
DefaultOptions,
|
||||
Channel,
|
||||
Emoji,
|
||||
Guild,
|
||||
Invite,
|
||||
Member,
|
||||
Role,
|
||||
User,
|
||||
EmojiSchema,
|
||||
ActivitySchema,
|
||||
IdentifySchema,
|
||||
};
|
||||
|
138
src/util/BitField.ts
Normal file
138
src/util/BitField.ts
Normal file
@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
|
||||
// https://github.com/discordjs/discord.js/blob/master/src/util/BitField.js
|
||||
// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah
|
||||
|
||||
export type BitFieldResolvable = number | BigInt | BitField | string | BitFieldResolvable[];
|
||||
|
||||
/**
|
||||
* Data structure that makes it easy to interact with a bitfield.
|
||||
*/
|
||||
export class BitField {
|
||||
public bitfield: bigint = BigInt(0);
|
||||
|
||||
public static FLAGS: Record<string, bigint>;
|
||||
|
||||
constructor(bits: BitFieldResolvable = 0) {
|
||||
this.bitfield = BitField.resolve(bits);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the bitfield has a bit, or any of multiple bits.
|
||||
*/
|
||||
any(bit: BitFieldResolvable): boolean {
|
||||
return (this.bitfield & BitField.resolve(bit)) !== 0n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this bitfield equals another
|
||||
*/
|
||||
equals(bit: BitFieldResolvable): boolean {
|
||||
return this.bitfield === BitField.resolve(bit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the bitfield has a bit, or multiple bits.
|
||||
*/
|
||||
has(bit: BitFieldResolvable): boolean {
|
||||
if (Array.isArray(bit)) return bit.every((p) => this.has(p));
|
||||
const BIT = BitField.resolve(bit);
|
||||
return (this.bitfield & BIT) === BIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all given bits that are missing from the bitfield.
|
||||
*/
|
||||
missing(bits: BitFieldResolvable) {
|
||||
if (!Array.isArray(bits)) bits = new BitField(bits).toArray();
|
||||
return bits.filter((p) => !this.has(p));
|
||||
}
|
||||
|
||||
/**
|
||||
* Freezes these bits, making them immutable.
|
||||
*/
|
||||
freeze(): Readonly<BitField> {
|
||||
return Object.freeze(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds bits to these ones.
|
||||
* @param {...BitFieldResolvable} [bits] Bits to add
|
||||
* @returns {BitField} These bits or new BitField if the instance is frozen.
|
||||
*/
|
||||
add(...bits: BitFieldResolvable[]): BitField {
|
||||
let total = 0n;
|
||||
for (const bit of bits) {
|
||||
total |= BitField.resolve(bit);
|
||||
}
|
||||
if (Object.isFrozen(this)) return new BitField(this.bitfield | total);
|
||||
this.bitfield |= total;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes bits from these.
|
||||
* @param {...BitFieldResolvable} [bits] Bits to remove
|
||||
*/
|
||||
remove(...bits: BitFieldResolvable[]) {
|
||||
let total = 0n;
|
||||
for (const bit of bits) {
|
||||
total |= BitField.resolve(bit);
|
||||
}
|
||||
if (Object.isFrozen(this)) return new BitField(this.bitfield & ~total);
|
||||
this.bitfield &= ~total;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an object mapping field names to a {@link boolean} indicating whether the
|
||||
* bit is available.
|
||||
* @param {...*} hasParams Additional parameters for the has method, if any
|
||||
*/
|
||||
serialize() {
|
||||
const serialized: Record<string, boolean> = {};
|
||||
for (const [flag, bit] of Object.entries(BitField.FLAGS)) serialized[flag] = this.has(bit);
|
||||
return serialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link Array} of bitfield names based on the bits available.
|
||||
*/
|
||||
toArray(): string[] {
|
||||
return Object.keys(BitField.FLAGS).filter((bit) => this.has(bit));
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return this.bitfield;
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.bitfield;
|
||||
}
|
||||
|
||||
*[Symbol.iterator]() {
|
||||
yield* this.toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Data that can be resolved to give a bitfield. This can be:
|
||||
* * A bit number (this can be a number literal or a value taken from {@link BitField.FLAGS})
|
||||
* * An instance of BitField
|
||||
* * An Array of BitFieldResolvable
|
||||
* @typedef {number|BitField|BitFieldResolvable[]} BitFieldResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves bitfields to their numeric form.
|
||||
* @param {BitFieldResolvable} [bit=0] - bit(s) to resolve
|
||||
* @returns {number}
|
||||
*/
|
||||
static resolve(bit: BitFieldResolvable = 0n): bigint {
|
||||
if ((typeof bit === "number" || typeof bit === "bigint") && bit >= 0n) return BigInt(bit);
|
||||
if (bit instanceof BitField) return bit.bitfield;
|
||||
if (Array.isArray(bit))
|
||||
return bit.map((p) => this.resolve(p)).reduce((prev, p) => BigInt(prev) | BigInt(p), 0n);
|
||||
if (typeof bit === "string" && typeof this.FLAGS[bit] !== "undefined") return this.FLAGS[bit];
|
||||
throw new RangeError("BITFIELD_INVALID: " + bit);
|
||||
}
|
||||
}
|
21
src/util/Intents.ts
Normal file
21
src/util/Intents.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { BitField } from "./BitField";
|
||||
|
||||
export class Intents extends BitField {
|
||||
static FLAGS = {
|
||||
GUILDS: 1n << 0n,
|
||||
GUILD_MEMBERS: 1n << 1n,
|
||||
GUILD_BANS: 1n << 2n,
|
||||
GUILD_EMOJIS: 1n << 3n,
|
||||
GUILD_INTEGRATIONS: 1n << 4n,
|
||||
GUILD_WEBHOOKS: 1n << 5n,
|
||||
GUILD_INVITES: 1n << 6n,
|
||||
GUILD_VOICE_STATES: 1n << 7n,
|
||||
GUILD_PRESENCES: 1n << 8n,
|
||||
GUILD_MESSAGES: 1n << 9n,
|
||||
GUILD_MESSAGE_REACTIONS: 1n << 10n,
|
||||
GUILD_MESSAGE_TYPING: 1n << 11n,
|
||||
DIRECT_MESSAGES: 1n << 12n,
|
||||
DIRECT_MESSAGE_REACTIONS: 1n << 13n,
|
||||
DIRECT_MESSAGE_TYPING: 1n << 14n,
|
||||
};
|
||||
}
|
14
src/util/MessageFlags.ts
Normal file
14
src/util/MessageFlags.ts
Normal file
@ -0,0 +1,14 @@
|
||||
// https://github.com/discordjs/discord.js/blob/master/src/util/MessageFlags.js
|
||||
// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah
|
||||
|
||||
import { BitField } from "./BitField";
|
||||
|
||||
export class MessageFlags extends BitField {
|
||||
static FLAGS = {
|
||||
CROSSPOSTED: 1n << 0n,
|
||||
IS_CROSSPOST: 1n << 1n,
|
||||
SUPPRESS_EMBEDS: 1n << 2n,
|
||||
SOURCE_MESSAGE_DELETED: 1n << 3n,
|
||||
URGENT: 1n << 4n,
|
||||
};
|
||||
}
|
56
src/util/Permissions.ts
Normal file
56
src/util/Permissions.ts
Normal file
@ -0,0 +1,56 @@
|
||||
// https://github.com/discordjs/discord.js/blob/master/src/util/Permissions.js
|
||||
// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah
|
||||
|
||||
import { BitField } from "./BitField";
|
||||
|
||||
export type PermissionResolvable = string | number | Permissions | PermissionResolvable[];
|
||||
|
||||
export class Permissions extends BitField {
|
||||
static FLAGS = {
|
||||
CREATE_INSTANT_INVITE: 1n << 0n,
|
||||
KICK_MEMBERS: 1n << 1n,
|
||||
BAN_MEMBERS: 1n << 2n,
|
||||
ADMINISTRATOR: 1n << 3n,
|
||||
MANAGE_CHANNELS: 1n << 4n,
|
||||
MANAGE_GUILD: 1n << 5n,
|
||||
ADD_REACTIONS: 1n << 6n,
|
||||
VIEW_AUDIT_LOG: 1n << 7n,
|
||||
PRIORITY_SPEAKER: 1n << 8n,
|
||||
STREAM: 1n << 9n,
|
||||
VIEW_CHANNEL: 1n << 10n,
|
||||
SEND_MESSAGES: 1n << 11n,
|
||||
SEND_TTS_MESSAGES: 1n << 12n,
|
||||
MANAGE_MESSAGES: 1n << 13n,
|
||||
EMBED_LINKS: 1n << 14n,
|
||||
ATTACH_FILES: 1n << 15n,
|
||||
READ_MESSAGE_HISTORY: 1n << 16n,
|
||||
MENTION_EVERYONE: 1n << 17n,
|
||||
USE_EXTERNAL_EMOJIS: 1n << 18n,
|
||||
VIEW_GUILD_INSIGHTS: 1n << 19n,
|
||||
CONNECT: 1n << 20n,
|
||||
SPEAK: 1n << 21n,
|
||||
MUTE_MEMBERS: 1n << 22n,
|
||||
DEAFEN_MEMBERS: 1n << 23n,
|
||||
MOVE_MEMBERS: 1n << 24n,
|
||||
USE_VAD: 1n << 25n,
|
||||
CHANGE_NICKNAME: 1n << 26n,
|
||||
MANAGE_NICKNAMES: 1n << 27n,
|
||||
MANAGE_ROLES: 1n << 28n,
|
||||
MANAGE_WEBHOOKS: 1n << 29n,
|
||||
MANAGE_EMOJIS: 1n << 30n,
|
||||
};
|
||||
|
||||
any(permission: PermissionResolvable, checkAdmin = true) {
|
||||
return (checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.any(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the bitfield has a permission, or multiple permissions.
|
||||
* @param {PermissionResolvable} permission Permission(s) to check for
|
||||
* @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override
|
||||
* @returns {boolean}
|
||||
*/
|
||||
has(permission: PermissionResolvable, checkAdmin = true) {
|
||||
return (checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.has(permission);
|
||||
}
|
||||
}
|
126
src/util/Snowflake.ts
Normal file
126
src/util/Snowflake.ts
Normal file
@ -0,0 +1,126 @@
|
||||
// @ts-nocheck
|
||||
|
||||
// https://github.com/discordjs/discord.js/blob/master/src/util/Snowflake.js
|
||||
// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah
|
||||
"use strict";
|
||||
|
||||
// Discord epoch (2015-01-01T00:00:00.000Z)
|
||||
|
||||
/**
|
||||
* A container for useful snowflake-related methods.
|
||||
*/
|
||||
export class Snowflake {
|
||||
static readonly EPOCH = 1420070400000;
|
||||
static INCREMENT = 0n; // max 4095
|
||||
static processId = 0n; // max 31
|
||||
static workerId = 0n; // max 31
|
||||
|
||||
constructor() {
|
||||
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
||||
}
|
||||
|
||||
/**
|
||||
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
|
||||
* ```
|
||||
* If we have a snowflake '266241948824764416' we can represent it as binary:
|
||||
*
|
||||
* 64 22 17 12 0
|
||||
* 000000111011000111100001101001000101000000 00001 00000 000000000000
|
||||
* number of ms since Discord epoch worker pid increment
|
||||
* ```
|
||||
* @typedef {string} Snowflake
|
||||
*/
|
||||
|
||||
/**
|
||||
* Transforms a snowflake from a decimal string to a bit string.
|
||||
* @param {Snowflake} num Snowflake to be transformed
|
||||
* @returns {string}
|
||||
* @private
|
||||
*/
|
||||
static idToBinary(num) {
|
||||
let bin = "";
|
||||
let high = parseInt(num.slice(0, -10)) || 0;
|
||||
let low = parseInt(num.slice(-10));
|
||||
while (low > 0 || high > 0) {
|
||||
bin = String(low & 1) + bin;
|
||||
low = Math.floor(low / 2);
|
||||
if (high > 0) {
|
||||
low += 5000000000 * (high % 2);
|
||||
high = Math.floor(high / 2);
|
||||
}
|
||||
}
|
||||
return bin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a snowflake from a bit string to a decimal string.
|
||||
* @param {string} num Bit string to be transformed
|
||||
* @returns {Snowflake}
|
||||
* @private
|
||||
*/
|
||||
static binaryToID(num) {
|
||||
let dec = "";
|
||||
|
||||
while (num.length > 50) {
|
||||
const high = parseInt(num.slice(0, -32), 2);
|
||||
const low = parseInt((high % 10).toString(2) + num.slice(-32), 2);
|
||||
|
||||
dec = (low % 10).toString() + dec;
|
||||
num =
|
||||
Math.floor(high / 10).toString(2) +
|
||||
Math.floor(low / 10)
|
||||
.toString(2)
|
||||
.padStart(32, "0");
|
||||
}
|
||||
|
||||
num = parseInt(num, 2);
|
||||
while (num > 0) {
|
||||
dec = (num % 10).toString() + dec;
|
||||
num = Math.floor(num / 10);
|
||||
}
|
||||
|
||||
return dec;
|
||||
}
|
||||
|
||||
static generate() {
|
||||
var time = BigInt(Date.now() - Snowflake.EPOCH) << 22n;
|
||||
var worker = Snowflake.workerId << 17n;
|
||||
var process = Snowflake.processId << 12n;
|
||||
var increment = Snowflake.INCREMENT++;
|
||||
return time | worker | process | increment;
|
||||
}
|
||||
|
||||
/**
|
||||
* A deconstructed snowflake.
|
||||
* @typedef {Object} DeconstructedSnowflake
|
||||
* @property {number} timestamp Timestamp the snowflake was created
|
||||
* @property {Date} date Date the snowflake was created
|
||||
* @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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Deconstructs a Discord snowflake.
|
||||
* @param {Snowflake} snowflake Snowflake to deconstruct
|
||||
* @returns {DeconstructedSnowflake} Deconstructed snowflake
|
||||
*/
|
||||
static deconstruct(snowflake) {
|
||||
const BINARY = Snowflake.idToBinary(snowflake).toString(2).padStart(64, "0");
|
||||
const res = {
|
||||
timestamp: parseInt(BINARY.substring(0, 42), 2) + EPOCH,
|
||||
workerID: parseInt(BINARY.substring(42, 47), 2),
|
||||
processID: parseInt(BINARY.substring(47, 52), 2),
|
||||
increment: parseInt(BINARY.substring(52, 64), 2),
|
||||
binary: BINARY,
|
||||
};
|
||||
Object.defineProperty(res, "date", {
|
||||
get: function get() {
|
||||
return new Date(this.timestamp);
|
||||
},
|
||||
enumerable: true,
|
||||
});
|
||||
return res;
|
||||
}
|
||||
}
|
6
src/util/String.ts
Normal file
6
src/util/String.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export const DOUBLE_WHITE_SPACE = /\s\s+/g;
|
||||
export const SPECIAL_CHAR = /[@#`:\r\n\t\f\v\p{C}]/gu;
|
||||
|
||||
export function trimSpecial(str: string) {
|
||||
return str.replace(SPECIAL_CHAR, "").replace(DOUBLE_WHITE_SPACE, " ").trim();
|
||||
}
|
22
src/util/UserFlags.ts
Normal file
22
src/util/UserFlags.ts
Normal file
@ -0,0 +1,22 @@
|
||||
// https://github.com/discordjs/discord.js/blob/master/src/util/UserFlags.js
|
||||
// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah
|
||||
|
||||
import { BitField } from "./BitField";
|
||||
|
||||
export class UserFlags extends BitField {
|
||||
static FLAGS = {
|
||||
DISCORD_EMPLOYEE: 1n << 0n,
|
||||
PARTNERED_SERVER_OWNER: 1n << 1n,
|
||||
HYPESQUAD_EVENTS: 1n << 2n,
|
||||
BUGHUNTER_LEVEL_1: 1n << 3n,
|
||||
HOUSE_BRAVERY: 1n << 6n,
|
||||
HOUSE_BRILLIANCE: 1n << 7n,
|
||||
HOUSE_BALANCE: 1n << 8n,
|
||||
EARLY_SUPPORTER: 1n << 9n,
|
||||
TEAM_USER: 1n << 10n,
|
||||
SYSTEM: 1n << 12n,
|
||||
BUGHUNTER_LEVEL_2: 1n << 14n,
|
||||
VERIFIED_BOT: 1n << 16n,
|
||||
EARLY_VERIFIED_BOT_DEVELOPER: 1n << 17n,
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user