fix models + move schemas in api and gateway
This commit is contained in:
parent
b2e3df59d3
commit
3d54ed4762
79
dist/gateway/src/schema/Activity.d.ts
vendored
Normal file
79
dist/gateway/src/schema/Activity.d.ts
vendored
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import { EmojiSchema } from "./Emoji";
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
export interface ActivitySchema {
|
||||||
|
afk: boolean;
|
||||||
|
status: string;
|
||||||
|
activities?: [
|
||||||
|
{
|
||||||
|
name: string;
|
||||||
|
type: number;
|
||||||
|
url?: string;
|
||||||
|
created_at?: number;
|
||||||
|
timestamps?: {
|
||||||
|
start: number;
|
||||||
|
end: number;
|
||||||
|
};
|
||||||
|
application_id?: bigint;
|
||||||
|
details?: string;
|
||||||
|
State?: string;
|
||||||
|
emoji?: 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;
|
||||||
|
}
|
44
dist/gateway/src/schema/Activity.js
vendored
Normal file
44
dist/gateway/src/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/gateway/src/schema/Activity.js.map
vendored
Normal file
1
dist/gateway/src/schema/Activity.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Activity.js","sourceRoot":"","sources":["../../../../../gateway/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"}
|
10
dist/gateway/src/schema/Emoji.d.ts
vendored
Normal file
10
dist/gateway/src/schema/Emoji.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export declare const EmojiSchema: {
|
||||||
|
name: StringConstructor;
|
||||||
|
$id: BigIntConstructor;
|
||||||
|
animated: BooleanConstructor;
|
||||||
|
};
|
||||||
|
export interface EmojiSchema {
|
||||||
|
name: string;
|
||||||
|
id?: bigint;
|
||||||
|
animated: Boolean;
|
||||||
|
}
|
9
dist/gateway/src/schema/Emoji.js
vendored
Normal file
9
dist/gateway/src/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/gateway/src/schema/Emoji.js.map
vendored
Normal file
1
dist/gateway/src/schema/Emoji.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../../../../gateway/src/schema/Emoji.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,QAAQ,EAAE,OAAO;CACjB,CAAC"}
|
68
dist/gateway/src/schema/Identify.d.ts
vendored
Normal file
68
dist/gateway/src/schema/Identify.d.ts
vendored
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import { ActivitySchema } from "./Activity";
|
||||||
|
export declare const IdentifySchema: {
|
||||||
|
token: StringConstructor;
|
||||||
|
intents: BigIntConstructor;
|
||||||
|
$properties: {
|
||||||
|
$$os: StringConstructor;
|
||||||
|
$$browser: StringConstructor;
|
||||||
|
$$device: StringConstructor;
|
||||||
|
};
|
||||||
|
$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;
|
||||||
|
};
|
||||||
|
export interface IdentifySchema {
|
||||||
|
token: string;
|
||||||
|
properties: {
|
||||||
|
$$os: string;
|
||||||
|
$$browser: string;
|
||||||
|
$$device: string;
|
||||||
|
};
|
||||||
|
intents: bigint;
|
||||||
|
presence?: ActivitySchema;
|
||||||
|
compress?: boolean;
|
||||||
|
large_threshold?: number;
|
||||||
|
shard?: [number];
|
||||||
|
guild_subscriptions?: boolean;
|
||||||
|
}
|
20
dist/gateway/src/schema/Identify.js
vendored
Normal file
20
dist/gateway/src/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,
|
||||||
|
intents: BigInt,
|
||||||
|
$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,
|
||||||
|
},
|
||||||
|
$presence: Activity_1.ActivitySchema,
|
||||||
|
$compress: Boolean,
|
||||||
|
$large_threshold: Number,
|
||||||
|
$shard: [Number],
|
||||||
|
$guild_subscriptions: Boolean,
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=Identify.js.map
|
1
dist/gateway/src/schema/Identify.js.map
vendored
Normal file
1
dist/gateway/src/schema/Identify.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Identify.js","sourceRoot":"","sources":["../../../../../gateway/src/schema/Identify.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAE/B,QAAA,cAAc,GAAG;IAC7B,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,MAAM;IACf,WAAW,EAAE;QACZ,yIAAyI;QACzI,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,QAAQ,EAAE,MAAM;KAChB;IACD,SAAS,EAAE,yBAAc;IACzB,SAAS,EAAE,OAAO;IAClB,gBAAgB,EAAE,MAAM;IACxB,MAAM,EAAE,CAAC,MAAM,CAAC;IAChB,oBAAoB,EAAE,OAAO;CAC7B,CAAC"}
|
6
dist/index.d.ts
vendored
6
dist/index.d.ts
vendored
@ -10,10 +10,6 @@ import { Invite } from "./models/Invite";
|
|||||||
import { Member } from "./models/Member";
|
import { Member } from "./models/Member";
|
||||||
import { Role } from "./models/Role";
|
import { Role } from "./models/Role";
|
||||||
import { User } from "./models/User";
|
import { User } from "./models/User";
|
||||||
import { EmojiSchema } from "./Schema/Emoji";
|
|
||||||
import { ActivitySchema } from "./Schema/Activity";
|
|
||||||
import { IdentifySchema } from "./Schema/Identify";
|
|
||||||
import { GuildSchema } from "./Schema/Guild";
|
|
||||||
import { trimSpecial } from "./util/String";
|
import { trimSpecial } from "./util/String";
|
||||||
import { BitField } from "./util/BitField";
|
import { BitField } from "./util/BitField";
|
||||||
import { Intents } from "./util/Intents";
|
import { Intents } from "./util/Intents";
|
||||||
@ -21,4 +17,4 @@ import { MessageFlags } from "./util/MessageFlags";
|
|||||||
import { Permissions } from "./util/Permissions";
|
import { Permissions } from "./util/Permissions";
|
||||||
import { Snowflake } from "./util/Snowflake";
|
import { Snowflake } from "./util/Snowflake";
|
||||||
import { UserFlags } from "./util/UserFlags";
|
import { UserFlags } from "./util/UserFlags";
|
||||||
export { trimSpecial, checkToken, Config, Constants, db, BitField, DefaultOptions, Permissions, MessageFlags, UserFlags, Snowflake, Intents, Channel, Event, Emoji, Guild, Invite, Member, Role, User, EmojiSchema, ActivitySchema, IdentifySchema, GuildSchema, };
|
export { trimSpecial, checkToken, Config, Constants, db, BitField, DefaultOptions, Permissions, MessageFlags, UserFlags, Snowflake, Intents, Channel, Event, Emoji, Guild, Invite, Member, Role, User, };
|
||||||
|
11
dist/index.js
vendored
11
dist/index.js
vendored
@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.GuildSchema = exports.IdentifySchema = exports.ActivitySchema = exports.EmojiSchema = exports.Intents = exports.Snowflake = exports.UserFlags = exports.MessageFlags = exports.Permissions = exports.DefaultOptions = exports.BitField = exports.db = exports.Constants = exports.Config = exports.checkToken = exports.trimSpecial = void 0;
|
exports.Intents = exports.Snowflake = exports.UserFlags = exports.MessageFlags = exports.Permissions = exports.DefaultOptions = exports.BitField = exports.db = exports.Constants = exports.Config = exports.checkToken = exports.trimSpecial = void 0;
|
||||||
const checkToken_1 = require("./util/checkToken");
|
const checkToken_1 = require("./util/checkToken");
|
||||||
Object.defineProperty(exports, "checkToken", { enumerable: true, get: function () { return checkToken_1.checkToken; } });
|
Object.defineProperty(exports, "checkToken", { enumerable: true, get: function () { return checkToken_1.checkToken; } });
|
||||||
const Config_1 = __importStar(require("./util/Config"));
|
const Config_1 = __importStar(require("./util/Config"));
|
||||||
@ -32,15 +32,6 @@ const Database_1 = __importDefault(require("./util/Database"));
|
|||||||
exports.db = Database_1.default;
|
exports.db = Database_1.default;
|
||||||
const Constants = __importStar(require("./util/Constants"));
|
const Constants = __importStar(require("./util/Constants"));
|
||||||
exports.Constants = Constants;
|
exports.Constants = Constants;
|
||||||
//* schema
|
|
||||||
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; } });
|
|
||||||
const Guild_1 = require("./Schema/Guild");
|
|
||||||
Object.defineProperty(exports, "GuildSchema", { enumerable: true, get: function () { return Guild_1.GuildSchema; } });
|
|
||||||
const String_1 = require("./util/String");
|
const String_1 = require("./util/String");
|
||||||
Object.defineProperty(exports, "trimSpecial", { enumerable: true, get: function () { return String_1.trimSpecial; } });
|
Object.defineProperty(exports, "trimSpecial", { enumerable: true, get: function () { return String_1.trimSpecial; } });
|
||||||
const BitField_1 = require("./util/BitField");
|
const BitField_1 = require("./util/BitField");
|
||||||
|
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,kDAA+C;AA8B9C,2FA9BQ,uBAAU,OA8BR;AA7BX,wDAAuD;AA8BtD,iBA9BM,gBAAM,CA8BN;AAIN,+FAlCgB,uBAAc,OAkChB;AAjCf,+DAAiC;AA+BhC,aA/BM,kBAAE,CA+BN;AA7BH,4DAA8C;AA4B7C,8BAAS;AAlBV,WAAW;AACX,0CAA6C;AAkC5C,4FAlCQ,mBAAW,OAkCR;AAjCZ,gDAAmD;AAkClD,+FAlCQ,yBAAc,OAkCR;AAjCf,gDAAmD;AAkClD,+FAlCQ,yBAAc,OAkCR;AAjCf,0CAA6C;AAkC5C,4FAlCQ,mBAAW,OAkCR;AAhCZ,0CAA4C;AAS3C,4FATQ,oBAAW,OASR;AARZ,8CAA2C;AAa1C,yFAbQ,mBAAQ,OAaR;AAZT,4CAAyC;AAkBxC,wFAlBQ,iBAAO,OAkBR;AAjBR,sDAAmD;AAclD,6FAdQ,2BAAY,OAcR;AAbb,oDAAiD;AAYhD,4FAZQ,yBAAW,OAYR;AAXZ,gDAA6C;AAc5C,0FAdQ,qBAAS,OAcR;AAbV,gDAA6C;AAY5C,0FAZQ,qBAAS,OAYR"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA+C;AAwB9C,2FAxBQ,uBAAU,OAwBR;AAvBX,wDAAuD;AAwBtD,iBAxBM,gBAAM,CAwBN;AAIN,+FA5BgB,uBAAc,OA4BhB;AA3Bf,+DAAiC;AAyBhC,aAzBM,kBAAE,CAyBN;AAvBH,4DAA8C;AAsB7C,8BAAS;AAZV,0CAA4C;AAS3C,4FATQ,oBAAW,OASR;AARZ,8CAA2C;AAa1C,yFAbQ,mBAAQ,OAaR;AAZT,4CAAyC;AAkBxC,wFAlBQ,iBAAO,OAkBR;AAjBR,sDAAmD;AAclD,6FAdQ,2BAAY,OAcR;AAbb,oDAAiD;AAYhD,4FAZQ,yBAAW,OAYR;AAXZ,gDAA6C;AAc5C,0FAdQ,qBAAS,OAcR;AAbV,gDAA6C;AAY5C,0FAZQ,qBAAS,OAYR"}
|
1
dist/models/Event.d.ts
vendored
1
dist/models/Event.d.ts
vendored
@ -1,6 +1,7 @@
|
|||||||
export interface Event {
|
export interface Event {
|
||||||
guild_id?: bigint;
|
guild_id?: bigint;
|
||||||
user_id?: bigint;
|
user_id?: bigint;
|
||||||
|
channel_id?: bigint;
|
||||||
created_at: number;
|
created_at: number;
|
||||||
data: any;
|
data: any;
|
||||||
event: string;
|
event: string;
|
||||||
|
2
dist/models/Event.js.map
vendored
2
dist/models/Event.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../src/models/Event.ts"],"names":[],"mappings":";;AAQA,+BAA+B"}
|
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../src/models/Event.ts"],"names":[],"mappings":";;AASA,+BAA+B"}
|
4
dist/models/Guild.d.ts
vendored
4
dist/models/Guild.d.ts
vendored
@ -6,8 +6,6 @@ export interface Guild {
|
|||||||
afk_channel_id?: bigint;
|
afk_channel_id?: bigint;
|
||||||
afk_timeout?: number;
|
afk_timeout?: number;
|
||||||
application_id?: bigint;
|
application_id?: bigint;
|
||||||
approximate_member_count?: number;
|
|
||||||
approximate_presence_count?: number;
|
|
||||||
banner?: string;
|
banner?: string;
|
||||||
channels: Channel[];
|
channels: Channel[];
|
||||||
default_message_notifications?: number;
|
default_message_notifications?: number;
|
||||||
@ -23,11 +21,11 @@ export interface Guild {
|
|||||||
max_presences?: number;
|
max_presences?: number;
|
||||||
max_video_channel_users?: number;
|
max_video_channel_users?: number;
|
||||||
member_count?: number;
|
member_count?: number;
|
||||||
|
presence_count?: number;
|
||||||
members?: Member[];
|
members?: Member[];
|
||||||
mfa_level?: number;
|
mfa_level?: number;
|
||||||
name: string;
|
name: string;
|
||||||
owner_id: bigint;
|
owner_id: bigint;
|
||||||
permissions?: string;
|
|
||||||
preferred_locale?: string;
|
preferred_locale?: string;
|
||||||
premium_subscription_count?: number;
|
premium_subscription_count?: number;
|
||||||
premium_tier?: number;
|
premium_tier?: number;
|
||||||
|
4
dist/models/Role.d.ts
vendored
4
dist/models/Role.d.ts
vendored
@ -1,4 +1,5 @@
|
|||||||
export interface Role {
|
export interface Role {
|
||||||
|
id: bigint;
|
||||||
color: number;
|
color: number;
|
||||||
hoist: boolean;
|
hoist: boolean;
|
||||||
managed: boolean;
|
managed: boolean;
|
||||||
@ -6,4 +7,7 @@ export interface Role {
|
|||||||
name: string;
|
name: string;
|
||||||
permissions: bigint;
|
permissions: bigint;
|
||||||
position: number;
|
position: number;
|
||||||
|
tags?: {
|
||||||
|
bot_id?: bigint;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
20
dist/server-util/src/index.d.ts
vendored
Normal file
20
dist/server-util/src/index.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
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 { Event } from "./models/Event";
|
||||||
|
import { Invite } from "./models/Invite";
|
||||||
|
import { Member } from "./models/Member";
|
||||||
|
import { Role } from "./models/Role";
|
||||||
|
import { User } from "./models/User";
|
||||||
|
import { trimSpecial } from "./util/String";
|
||||||
|
import { BitField } from "./util/BitField";
|
||||||
|
import { Intents } from "./util/Intents";
|
||||||
|
import { MessageFlags } from "./util/MessageFlags";
|
||||||
|
import { Permissions } from "./util/Permissions";
|
||||||
|
import { Snowflake } from "./util/Snowflake";
|
||||||
|
import { UserFlags } from "./util/UserFlags";
|
||||||
|
export { trimSpecial, checkToken, Config, Constants, db, BitField, DefaultOptions, Permissions, MessageFlags, UserFlags, Snowflake, Intents, Channel, Event, Emoji, Guild, Invite, Member, Role, User, };
|
49
dist/server-util/src/index.js
vendored
Normal file
49
dist/server-util/src/index.js
vendored
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Intents = exports.Snowflake = exports.UserFlags = exports.MessageFlags = exports.Permissions = exports.DefaultOptions = exports.BitField = exports.db = exports.Constants = exports.Config = exports.checkToken = exports.trimSpecial = 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("./util/Config"));
|
||||||
|
exports.Config = Config_1.default;
|
||||||
|
Object.defineProperty(exports, "DefaultOptions", { enumerable: true, get: function () { return Config_1.DefaultOptions; } });
|
||||||
|
const Database_1 = __importDefault(require("./util/Database"));
|
||||||
|
exports.db = Database_1.default;
|
||||||
|
const Constants = __importStar(require("./util/Constants"));
|
||||||
|
exports.Constants = Constants;
|
||||||
|
const String_1 = require("./util/String");
|
||||||
|
Object.defineProperty(exports, "trimSpecial", { enumerable: true, get: function () { return String_1.trimSpecial; } });
|
||||||
|
const BitField_1 = require("./util/BitField");
|
||||||
|
Object.defineProperty(exports, "BitField", { enumerable: true, get: function () { return BitField_1.BitField; } });
|
||||||
|
const Intents_1 = require("./util/Intents");
|
||||||
|
Object.defineProperty(exports, "Intents", { enumerable: true, get: function () { return Intents_1.Intents; } });
|
||||||
|
const MessageFlags_1 = require("./util/MessageFlags");
|
||||||
|
Object.defineProperty(exports, "MessageFlags", { enumerable: true, get: function () { return MessageFlags_1.MessageFlags; } });
|
||||||
|
const Permissions_1 = require("./util/Permissions");
|
||||||
|
Object.defineProperty(exports, "Permissions", { enumerable: true, get: function () { return Permissions_1.Permissions; } });
|
||||||
|
const Snowflake_1 = require("./util/Snowflake");
|
||||||
|
Object.defineProperty(exports, "Snowflake", { enumerable: true, get: function () { return Snowflake_1.Snowflake; } });
|
||||||
|
const UserFlags_1 = require("./util/UserFlags");
|
||||||
|
Object.defineProperty(exports, "UserFlags", { enumerable: true, get: function () { return UserFlags_1.UserFlags; } });
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
dist/server-util/src/index.js.map
vendored
Normal file
1
dist/server-util/src/index.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA+C;AAwB9C,2FAxBQ,uBAAU,OAwBR;AAvBX,wDAAuD;AAwBtD,iBAxBM,gBAAM,CAwBN;AAIN,+FA5BgB,uBAAc,OA4BhB;AA3Bf,+DAAiC;AAyBhC,aAzBM,kBAAE,CAyBN;AAvBH,4DAA8C;AAsB7C,8BAAS;AAZV,0CAA4C;AAS3C,4FATQ,oBAAW,OASR;AARZ,8CAA2C;AAa1C,yFAbQ,mBAAQ,OAaR;AAZT,4CAAyC;AAkBxC,wFAlBQ,iBAAO,OAkBR;AAjBR,sDAAmD;AAclD,6FAdQ,2BAAY,OAcR;AAbb,oDAAiD;AAYhD,4FAZQ,yBAAW,OAYR;AAXZ,gDAA6C;AAc5C,0FAdQ,qBAAS,OAcR;AAbV,gDAA6C;AAY5C,0FAZQ,qBAAS,OAYR"}
|
19
dist/server-util/src/models/Channel.d.ts
vendored
Normal file
19
dist/server-util/src/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/server-util/src/models/Channel.js
vendored
Normal file
3
dist/server-util/src/models/Channel.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=Channel.js.map
|
1
dist/server-util/src/models/Channel.js.map
vendored
Normal file
1
dist/server-util/src/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/server-util/src/models/Emoji.d.ts
vendored
Normal file
12
dist/server-util/src/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/server-util/src/models/Emoji.js
vendored
Normal file
3
dist/server-util/src/models/Emoji.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=Emoji.js.map
|
1
dist/server-util/src/models/Emoji.js.map
vendored
Normal file
1
dist/server-util/src/models/Emoji.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../../../src/models/Emoji.ts"],"names":[],"mappings":""}
|
8
dist/server-util/src/models/Event.d.ts
vendored
Normal file
8
dist/server-util/src/models/Event.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export interface Event {
|
||||||
|
guild_id?: bigint;
|
||||||
|
user_id?: bigint;
|
||||||
|
channel_id?: bigint;
|
||||||
|
created_at: number;
|
||||||
|
data: any;
|
||||||
|
event: string;
|
||||||
|
}
|
4
dist/server-util/src/models/Event.js
vendored
Normal file
4
dist/server-util/src/models/Event.js
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
// located in collection events
|
||||||
|
//# sourceMappingURL=Event.js.map
|
1
dist/server-util/src/models/Event.js.map
vendored
Normal file
1
dist/server-util/src/models/Event.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../../../src/models/Event.ts"],"names":[],"mappings":";;AASA,+BAA+B"}
|
47
dist/server-util/src/models/Guild.d.ts
vendored
Normal file
47
dist/server-util/src/models/Guild.d.ts
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import { Channel } from "./Channel";
|
||||||
|
import { Emoji } from "./Emoji";
|
||||||
|
import { Member } from "./Member";
|
||||||
|
import { Role } from "./Role";
|
||||||
|
export interface Guild {
|
||||||
|
afk_channel_id?: bigint;
|
||||||
|
afk_timeout?: number;
|
||||||
|
application_id?: bigint;
|
||||||
|
banner?: string;
|
||||||
|
channels: Channel[];
|
||||||
|
default_message_notifications?: number;
|
||||||
|
description?: string;
|
||||||
|
discovery_splash?: string;
|
||||||
|
emojis: Emoji[];
|
||||||
|
explicit_content_filter?: number;
|
||||||
|
features: [];
|
||||||
|
icon?: string;
|
||||||
|
id: bigint;
|
||||||
|
large?: boolean;
|
||||||
|
max_members?: number;
|
||||||
|
max_presences?: number;
|
||||||
|
max_video_channel_users?: number;
|
||||||
|
member_count?: number;
|
||||||
|
presence_count?: number;
|
||||||
|
members?: Member[];
|
||||||
|
mfa_level?: number;
|
||||||
|
name: string;
|
||||||
|
owner_id: bigint;
|
||||||
|
preferred_locale?: string;
|
||||||
|
premium_subscription_count?: number;
|
||||||
|
premium_tier?: number;
|
||||||
|
presences: [];
|
||||||
|
public_updates_channel_id?: bigint;
|
||||||
|
region?: string;
|
||||||
|
roles: Role[];
|
||||||
|
rules_channel_id?: bigint;
|
||||||
|
splash?: string;
|
||||||
|
system_channel_flags?: number;
|
||||||
|
system_channel_id?: bigint;
|
||||||
|
unavailable?: boolean;
|
||||||
|
vanity_url_code?: string;
|
||||||
|
verification_level?: number;
|
||||||
|
voice_states: [];
|
||||||
|
welcome_screen: [];
|
||||||
|
widget_channel_id?: bigint;
|
||||||
|
widget_enabled?: boolean;
|
||||||
|
}
|
3
dist/server-util/src/models/Guild.js
vendored
Normal file
3
dist/server-util/src/models/Guild.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=Guild.js.map
|
1
dist/server-util/src/models/Guild.js.map
vendored
Normal file
1
dist/server-util/src/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/server-util/src/models/Invite.d.ts
vendored
Normal file
30
dist/server-util/src/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/server-util/src/models/Invite.js
vendored
Normal file
3
dist/server-util/src/models/Invite.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=Invite.js.map
|
1
dist/server-util/src/models/Invite.js.map
vendored
Normal file
1
dist/server-util/src/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/server-util/src/models/Member.d.ts
vendored
Normal file
13
dist/server-util/src/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/server-util/src/models/Member.js
vendored
Normal file
3
dist/server-util/src/models/Member.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=Member.js.map
|
1
dist/server-util/src/models/Member.js.map
vendored
Normal file
1
dist/server-util/src/models/Member.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Member.js","sourceRoot":"","sources":["../../../../src/models/Member.ts"],"names":[],"mappings":""}
|
13
dist/server-util/src/models/Role.d.ts
vendored
Normal file
13
dist/server-util/src/models/Role.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
export interface Role {
|
||||||
|
id: bigint;
|
||||||
|
color: number;
|
||||||
|
hoist: boolean;
|
||||||
|
managed: boolean;
|
||||||
|
mentionable: boolean;
|
||||||
|
name: string;
|
||||||
|
permissions: bigint;
|
||||||
|
position: number;
|
||||||
|
tags?: {
|
||||||
|
bot_id?: bigint;
|
||||||
|
};
|
||||||
|
}
|
3
dist/server-util/src/models/Role.js
vendored
Normal file
3
dist/server-util/src/models/Role.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=Role.js.map
|
1
dist/server-util/src/models/Role.js.map
vendored
Normal file
1
dist/server-util/src/models/Role.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Role.js","sourceRoot":"","sources":["../../../../src/models/Role.ts"],"names":[],"mappings":""}
|
61
dist/server-util/src/models/User.d.ts
vendored
Normal file
61
dist/server-util/src/models/User.d.ts
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
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;
|
||||||
|
guilds: bigint[];
|
||||||
|
}
|
||||||
|
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/server-util/src/models/User.js
vendored
Normal file
3
dist/server-util/src/models/User.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=User.js.map
|
1
dist/server-util/src/models/User.js.map
vendored
Normal file
1
dist/server-util/src/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/server-util/src/util/BitField.d.ts
vendored
Normal file
66
dist/server-util/src/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/server-util/src/util/BitField.js
vendored
Normal file
127
dist/server-util/src/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/server-util/src/util/BitField.js.map
vendored
Normal file
1
dist/server-util/src/util/BitField.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"BitField.js","sourceRoot":"","sources":["../../../../src/util/BitField.ts"],"names":[],"mappings":"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"}
|
13
dist/server-util/src/util/Config.d.ts
vendored
Normal file
13
dist/server-util/src/util/Config.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import "missing-native-js-functions";
|
||||||
|
declare const _default: {
|
||||||
|
init: (opts?: DefaultOptions) => Promise<void>;
|
||||||
|
getAll: () => DefaultOptions;
|
||||||
|
setAll: (val: any) => any;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
|
export interface DefaultOptions {
|
||||||
|
api?: any;
|
||||||
|
gateway?: any;
|
||||||
|
voice?: any;
|
||||||
|
}
|
||||||
|
export declare const DefaultOptions: DefaultOptions;
|
28
dist/server-util/src/util/Config.js
vendored
Normal file
28
dist/server-util/src/util/Config.js
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
"use strict";
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.DefaultOptions = void 0;
|
||||||
|
require("missing-native-js-functions");
|
||||||
|
const Database_1 = __importDefault(require("./Database"));
|
||||||
|
var Config;
|
||||||
|
exports.default = {
|
||||||
|
init: async function init(opts = exports.DefaultOptions) {
|
||||||
|
Config = await Database_1.default.data.config({}).cache();
|
||||||
|
await Config.init();
|
||||||
|
await Config.set(opts.merge(Config.cache || {}));
|
||||||
|
},
|
||||||
|
getAll: function get() {
|
||||||
|
return Config.get();
|
||||||
|
},
|
||||||
|
setAll: function set(val) {
|
||||||
|
return Config.set(val);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
exports.DefaultOptions = {
|
||||||
|
api: {},
|
||||||
|
gateway: {},
|
||||||
|
voice: {},
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=Config.js.map
|
1
dist/server-util/src/util/Config.js.map
vendored
Normal file
1
dist/server-util/src/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,MAAM,kBAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QAC1C,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"}
|
2
dist/server-util/src/util/Constants.d.ts
vendored
Normal file
2
dist/server-util/src/util/Constants.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import { VerifyOptions } from "jsonwebtoken";
|
||||||
|
export declare const JWTOptions: VerifyOptions;
|
5
dist/server-util/src/util/Constants.js
vendored
Normal file
5
dist/server-util/src/util/Constants.js
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.JWTOptions = void 0;
|
||||||
|
exports.JWTOptions = { algorithms: ["HS256"] };
|
||||||
|
//# sourceMappingURL=Constants.js.map
|
1
dist/server-util/src/util/Constants.js.map
vendored
Normal file
1
dist/server-util/src/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"}
|
3
dist/server-util/src/util/Database.d.ts
vendored
Normal file
3
dist/server-util/src/util/Database.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { MongoDatabase } from "lambert-db";
|
||||||
|
declare const db: MongoDatabase;
|
||||||
|
export default db;
|
10
dist/server-util/src/util/Database.js
vendored
Normal file
10
dist/server-util/src/util/Database.js
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const lambert_db_1 = require("lambert-db");
|
||||||
|
// TODO: load url from config
|
||||||
|
const db = new lambert_db_1.MongoDatabase("mongodb://127.0.0.1:27017/lambert?readPreference=secondaryPreferred", {
|
||||||
|
useNewUrlParser: true,
|
||||||
|
useUnifiedTopology: false,
|
||||||
|
});
|
||||||
|
exports.default = db;
|
||||||
|
//# sourceMappingURL=Database.js.map
|
1
dist/server-util/src/util/Database.js.map
vendored
Normal file
1
dist/server-util/src/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,EAAE;IACnG,eAAe,EAAE,IAAI;IACrB,kBAAkB,EAAE,KAAK;CACzB,CAAC,CAAC;AAEH,kBAAe,EAAE,CAAC"}
|
20
dist/server-util/src/util/Intents.d.ts
vendored
Normal file
20
dist/server-util/src/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/server-util/src/util/Intents.js
vendored
Normal file
25
dist/server-util/src/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/server-util/src/util/Intents.js.map
vendored
Normal file
1
dist/server-util/src/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/server-util/src/util/MessageFlags.d.ts
vendored
Normal file
10
dist/server-util/src/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/server-util/src/util/MessageFlags.js
vendored
Normal file
17
dist/server-util/src/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/server-util/src/util/MessageFlags.js.map
vendored
Normal file
1
dist/server-util/src/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/server-util/src/util/Permissions.d.ts
vendored
Normal file
45
dist/server-util/src/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/server-util/src/util/Permissions.js
vendored
Normal file
55
dist/server-util/src/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/server-util/src/util/Permissions.js.map
vendored
Normal file
1
dist/server-util/src/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/server-util/src/util/Snowflake.d.ts
vendored
Normal file
58
dist/server-util/src/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/server-util/src/util/Snowflake.js
vendored
Normal file
116
dist/server-util/src/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/server-util/src/util/Snowflake.js.map
vendored
Normal file
1
dist/server-util/src/util/Snowflake.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Snowflake.js","sourceRoot":"","sources":["../../../../src/util/Snowflake.ts"],"names":[],"mappings":"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"}
|
3
dist/server-util/src/util/String.d.ts
vendored
Normal file
3
dist/server-util/src/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/server-util/src/util/String.js
vendored
Normal file
10
dist/server-util/src/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/server-util/src/util/String.js.map
vendored
Normal file
1
dist/server-util/src/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/server-util/src/util/UserFlags.d.ts
vendored
Normal file
18
dist/server-util/src/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/server-util/src/util/UserFlags.js
vendored
Normal file
25
dist/server-util/src/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/server-util/src/util/UserFlags.js.map
vendored
Normal file
1
dist/server-util/src/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/server-util/src/util/checkToken.d.ts
vendored
Normal file
1
dist/server-util/src/util/checkToken.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare function checkToken(token: string): Promise<any>;
|
20
dist/server-util/src/util/checkToken.js
vendored
Normal file
20
dist/server-util/src/util/checkToken.js
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
"use strict";
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.checkToken = void 0;
|
||||||
|
const Constants_1 = require("./Constants");
|
||||||
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
||||||
|
const Config_1 = __importDefault(require("./Config"));
|
||||||
|
function checkToken(token) {
|
||||||
|
return new Promise((res, rej) => {
|
||||||
|
jsonwebtoken_1.default.verify(token, Config_1.default.getAll().api.security.jwtSecret, Constants_1.JWTOptions, (err, decoded) => {
|
||||||
|
if (err || !decoded)
|
||||||
|
return rej("Invalid Token");
|
||||||
|
return res(decoded);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.checkToken = checkToken;
|
||||||
|
//# sourceMappingURL=checkToken.js.map
|
1
dist/server-util/src/util/checkToken.js.map
vendored
Normal file
1
dist/server-util/src/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"}
|
@ -1,81 +0,0 @@
|
|||||||
import { EmojiSchema } from "./Emoji";
|
|
||||||
|
|
||||||
export const ActivitySchema = {
|
|
||||||
afk: Boolean,
|
|
||||||
status: String,
|
|
||||||
$activities: [
|
|
||||||
{
|
|
||||||
name: String, // the activity's name
|
|
||||||
type: Number, // activity type // TODO: check if its between range 0-5
|
|
||||||
$url: String, // stream url, is validated when type is 1
|
|
||||||
$created_at: Number, // unix timestamp of when the activity was added to the user's session
|
|
||||||
$timestamps: {
|
|
||||||
// unix timestamps for start and/or end of the game
|
|
||||||
start: Number,
|
|
||||||
end: Number,
|
|
||||||
},
|
|
||||||
$application_id: BigInt, // application id for the game
|
|
||||||
$details: String,
|
|
||||||
$State: String,
|
|
||||||
$emoji: EmojiSchema,
|
|
||||||
$party: {
|
|
||||||
$id: String,
|
|
||||||
$size: [Number], // used to show the party's current and maximum size // TODO: array length 2
|
|
||||||
},
|
|
||||||
$assets: {
|
|
||||||
$large_image: String, // the id for a large asset of the activity, usually a snowflake
|
|
||||||
$large_text: String, // text displayed when hovering over the large image of the activity
|
|
||||||
$small_image: String, // the id for a small asset of the activity, usually a snowflake
|
|
||||||
$small_text: String, // text displayed when hovering over the small image of the activity
|
|
||||||
},
|
|
||||||
$secrets: {
|
|
||||||
$join: String, // the secret for joining a party
|
|
||||||
$spectate: String, // the secret for spectating a game
|
|
||||||
$match: String, // the secret for a specific instanced match
|
|
||||||
},
|
|
||||||
$instance: Boolean,
|
|
||||||
flags: BigInt, // activity flags OR d together, describes what the payload includes
|
|
||||||
},
|
|
||||||
],
|
|
||||||
$since: Number, // unix time (in milliseconds) of when the client went idle, or null if the client is not idle
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface ActivitySchema {
|
|
||||||
afk: boolean;
|
|
||||||
status: string;
|
|
||||||
activities?: [
|
|
||||||
{
|
|
||||||
name: string; // the activity's name
|
|
||||||
type: number; // activity type // TODO: check if its between range 0-5
|
|
||||||
url?: string; // stream url, is validated when type is 1
|
|
||||||
created_at?: number; // unix timestamp of when the activity was added to the user's session
|
|
||||||
timestamps?: {
|
|
||||||
// unix timestamps for start and/or end of the game
|
|
||||||
start: number;
|
|
||||||
end: number;
|
|
||||||
};
|
|
||||||
application_id?: bigint; // application id for the game
|
|
||||||
details?: string;
|
|
||||||
State?: string;
|
|
||||||
emoji?: EmojiSchema;
|
|
||||||
party?: {
|
|
||||||
id?: string;
|
|
||||||
size?: [number]; // used to show the party's current and maximum size // TODO: array length 2
|
|
||||||
};
|
|
||||||
assets?: {
|
|
||||||
large_image?: string; // the id for a large asset of the activity, usually a snowflake
|
|
||||||
large_text?: string; // text displayed when hovering over the large image of the activity
|
|
||||||
small_image?: string; // the id for a small asset of the activity, usually a snowflake
|
|
||||||
small_text?: string; // text displayed when hovering over the small image of the activity
|
|
||||||
};
|
|
||||||
secrets?: {
|
|
||||||
join?: string; // the secret for joining a party
|
|
||||||
spectate?: string; // the secret for spectating a game
|
|
||||||
match?: string; // the secret for a specific instanced match
|
|
||||||
};
|
|
||||||
instance?: boolean;
|
|
||||||
flags: bigint; // activity flags OR d together, describes what the payload includes
|
|
||||||
}
|
|
||||||
];
|
|
||||||
since?: number; // unix time (in milliseconds) of when the client went idle, or null if the client is not idle
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
export const EmojiSchema = {
|
|
||||||
name: String, // the name of the emoji
|
|
||||||
$id: BigInt, // the id of the emoji
|
|
||||||
animated: Boolean, // whether this emoji is animated
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface EmojiSchema {
|
|
||||||
name: string;
|
|
||||||
id?: bigint;
|
|
||||||
animated: Boolean;
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
export const GuildSchema = {
|
|
||||||
name: String, // ! 2-100 chars
|
|
||||||
$region: String, // ? voice region ?
|
|
||||||
// $icon: String, // TODO: add icon data (base64 128x128)
|
|
||||||
|
|
||||||
// * --- useless for us due to templates being a thing --- * //
|
|
||||||
// $verification_level: Number, // ! https://discord.com/developers/docs/resources/guild#guild-object-verification-level
|
|
||||||
// $default_message_notifications: Number, // ! https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
|
|
||||||
// $explicit_content_filter: Number,
|
|
||||||
// $roles: array of role objects,
|
|
||||||
// $channels: array of partial channel objects,
|
|
||||||
// $afk_channel_id: snowflake,
|
|
||||||
// * --- useless for us --- * //
|
|
||||||
|
|
||||||
// $afk_timeout: Number,
|
|
||||||
// $system_channel_id: snowflake,
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface GuildSchema {
|
|
||||||
name: string; // ! 2-100 chars
|
|
||||||
region?: string; // ? voice region ?
|
|
||||||
// icon?: string; // TODO: add icon data (base64 128x128)
|
|
||||||
|
|
||||||
// * --- useless for us due to templates being a thing --- * //
|
|
||||||
// verification_level?: number; // ! https://discord.com/developers/docs/resources/guild#guild-object-verification-level
|
|
||||||
// default_message_notifications?: number; // ! https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
|
|
||||||
// explicit_content_filter?: number;
|
|
||||||
// $roles: array of role objects,
|
|
||||||
// $channels: array of partial channel objects,
|
|
||||||
// $afk_channel_id: snowflake,
|
|
||||||
// * --- useless for us --- * //
|
|
||||||
|
|
||||||
// afk_timeout?: number;
|
|
||||||
// system_channel_id?: snowflake,
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
import { ActivitySchema } from "./Activity";
|
|
||||||
|
|
||||||
export const IdentifySchema = {
|
|
||||||
token: String,
|
|
||||||
intents: BigInt, // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt
|
|
||||||
$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,
|
|
||||||
},
|
|
||||||
$presence: ActivitySchema,
|
|
||||||
$compress: Boolean,
|
|
||||||
$large_threshold: Number,
|
|
||||||
$shard: [Number],
|
|
||||||
$guild_subscriptions: Boolean,
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface 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; // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt
|
|
||||||
presence?: ActivitySchema;
|
|
||||||
compress?: boolean;
|
|
||||||
large_threshold?: number;
|
|
||||||
shard?: [number];
|
|
||||||
guild_subscriptions?: boolean;
|
|
||||||
}
|
|
10
src/index.ts
10
src/index.ts
@ -12,12 +12,6 @@ import { Member } from "./models/Member";
|
|||||||
import { Role } from "./models/Role";
|
import { Role } from "./models/Role";
|
||||||
import { User } from "./models/User";
|
import { User } from "./models/User";
|
||||||
|
|
||||||
//* schema
|
|
||||||
import { EmojiSchema } from "./Schema/Emoji";
|
|
||||||
import { ActivitySchema } from "./Schema/Activity";
|
|
||||||
import { IdentifySchema } from "./Schema/Identify";
|
|
||||||
import { GuildSchema } from "./Schema/Guild";
|
|
||||||
|
|
||||||
import { trimSpecial } from "./util/String";
|
import { trimSpecial } from "./util/String";
|
||||||
import { BitField } from "./util/BitField";
|
import { BitField } from "./util/BitField";
|
||||||
import { Intents } from "./util/Intents";
|
import { Intents } from "./util/Intents";
|
||||||
@ -47,8 +41,4 @@ export {
|
|||||||
Member,
|
Member,
|
||||||
Role,
|
Role,
|
||||||
User,
|
User,
|
||||||
EmojiSchema,
|
|
||||||
ActivitySchema,
|
|
||||||
IdentifySchema,
|
|
||||||
GuildSchema,
|
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
export interface Event {
|
export interface Event {
|
||||||
guild_id?: bigint;
|
guild_id?: bigint;
|
||||||
user_id?: bigint;
|
user_id?: bigint;
|
||||||
|
channel_id?: bigint;
|
||||||
created_at: number;
|
created_at: number;
|
||||||
data: any;
|
data: any;
|
||||||
event: string;
|
event: string;
|
||||||
|
@ -7,8 +7,6 @@ export interface Guild {
|
|||||||
afk_channel_id?: bigint;
|
afk_channel_id?: bigint;
|
||||||
afk_timeout?: number;
|
afk_timeout?: number;
|
||||||
application_id?: bigint;
|
application_id?: bigint;
|
||||||
approximate_member_count?: number;
|
|
||||||
approximate_presence_count?: number;
|
|
||||||
banner?: string;
|
banner?: string;
|
||||||
channels: Channel[];
|
channels: Channel[];
|
||||||
default_message_notifications?: number;
|
default_message_notifications?: number;
|
||||||
@ -25,11 +23,11 @@ export interface Guild {
|
|||||||
max_presences?: number;
|
max_presences?: number;
|
||||||
max_video_channel_users?: number; // ? default: 25, is this max 25 streaming or watching
|
max_video_channel_users?: number; // ? default: 25, is this max 25 streaming or watching
|
||||||
member_count?: number;
|
member_count?: number;
|
||||||
|
presence_count?: number; // users online
|
||||||
members?: Member[];
|
members?: Member[];
|
||||||
mfa_level?: number;
|
mfa_level?: number;
|
||||||
name: string;
|
name: string;
|
||||||
owner_id: bigint;
|
owner_id: bigint;
|
||||||
permissions?: string;
|
|
||||||
preferred_locale?: string; // only community guilds can choose this
|
preferred_locale?: string; // only community guilds can choose this
|
||||||
premium_subscription_count?: number;
|
premium_subscription_count?: number;
|
||||||
premium_tier?: number; // nitro boost level
|
premium_tier?: number; // nitro boost level
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
export interface Role {
|
export interface Role {
|
||||||
|
id: bigint;
|
||||||
color: number;
|
color: number;
|
||||||
hoist: boolean;
|
hoist: boolean;
|
||||||
managed: boolean;
|
managed: boolean;
|
||||||
@ -6,4 +7,7 @@ export interface Role {
|
|||||||
name: string;
|
name: string;
|
||||||
permissions: bigint;
|
permissions: bigint;
|
||||||
position: number;
|
position: number;
|
||||||
|
tags?: {
|
||||||
|
bot_id?: bigint;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user