diff options
93 files changed, 62 insertions, 3262 deletions
diff --git a/.gitignore b/.gitignore index 92bc6247..d7fc3f74 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,6 @@ typings/ # TernJS port file .tern-port .DS_Store + +# Compiled TypeScript code +dist/ \ No newline at end of file diff --git a/README.md b/README.md index c08a72d5..c2d275c4 100644 --- a/README.md +++ b/README.md @@ -1 +1,9 @@ -# server-util \ No newline at end of file +# server-util + +add to package.json: + +```json +"start": "npm run build:util && npm run build && node dist/", +"build": "tsc -b .", +"build:util": "tsc -b ./node_modules/fosscord-server-util/" +``` diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 4bf16a66..00000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from "./util/checkToken"; -export * as Constants from "./util/Constants"; -export * from "./models/index"; -export * from "./util/index"; -import Config, { DefaultOptions } from "./util/Config"; -import db, { MongooseCache } from "./util/Database"; -export { Config, db, DefaultOptions, MongooseCache }; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 29b12d98..00000000 --- a/dist/index.js +++ /dev/null @@ -1,36 +0,0 @@ -"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 __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -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; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MongooseCache = exports.DefaultOptions = exports.db = exports.Config = exports.Constants = void 0; -__exportStar(require("./util/checkToken"), exports); -exports.Constants = __importStar(require("./util/Constants")); -__exportStar(require("./models/index"), exports); -__exportStar(require("./util/index"), exports); -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 = __importStar(require("./util/Database")); -exports.db = Database_1.default; -Object.defineProperty(exports, "MongooseCache", { enumerable: true, get: function () { return Database_1.MongooseCache; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index fe75c8ca..00000000 --- a/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAkC;AAElC,8DAA8C;AAC9C,iDAA+B;AAC/B,+CAA6B;AAE7B,wDAAuD;AAG9C,iBAHF,gBAAM,CAGE;AAAM,+FAHJ,uBAAc,OAGI;AAFnC,4DAAoD;AAEnC,aAFV,kBAAE,CAEU;AAAkB,8FAFxB,wBAAa,OAEwB"} \ No newline at end of file diff --git a/dist/models/Activity.d.ts b/dist/models/Activity.d.ts deleted file mode 100644 index 57462d60..00000000 --- a/dist/models/Activity.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { User } from ".."; -import { ClientStatus, Status } from "./Status"; -import { Types } from "mongoose"; -export interface Presence { - user: User; - guild_id?: string; - status: Status; - activities: Activity[]; - client_status: ClientStatus; -} -export interface Activity { - name: string; - type: ActivityType; - url?: string; - created_at?: Date; - timestamps?: { - start?: number; - end?: number; - }[]; - application_id?: string; - details?: string; - state?: string; - emoji?: { - name: string; - id?: string; - amimated?: boolean; - }; - party?: { - id?: string; - size?: [number, 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; -} -export declare const Activity: { - name: StringConstructor; - type: NumberConstructor; - $url: StringConstructor; - $created_at: DateConstructor; - $timestamps: { - $start: NumberConstructor; - $end: NumberConstructor; - }[]; - $application_id: StringConstructor; - $details: StringConstructor; - $state: StringConstructor; - $emoji: { - $name: StringConstructor; - $id: StringConstructor; - $amimated: 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: typeof Types.Long; -}; -export declare enum ActivityType { - GAME = 0, - STREAMING = 1, - LISTENING = 2, - CUSTOM = 4, - COMPETING = 5 -} diff --git a/dist/models/Activity.js b/dist/models/Activity.js deleted file mode 100644 index d9a19ead..00000000 --- a/dist/models/Activity.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ActivityType = exports.Activity = void 0; -const mongoose_1 = require("mongoose"); -exports.Activity = { - name: String, - type: Number, - $url: String, - $created_at: Date, - $timestamps: [ - { - $start: Number, - $end: Number, - }, - ], - $application_id: String, - $details: String, - $state: String, - $emoji: { - $name: String, - $id: String, - $amimated: Boolean, - }, - $party: { - $id: String, - $size: [Number, Number], - }, - $assets: { - $large_image: String, - $large_text: String, - $small_image: String, - $small_text: String, - }, - $secrets: { - $join: String, - $spectate: String, - $match: String, - }, - $instance: Boolean, - $flags: mongoose_1.Types.Long, -}; -var ActivityType; -(function (ActivityType) { - ActivityType[ActivityType["GAME"] = 0] = "GAME"; - ActivityType[ActivityType["STREAMING"] = 1] = "STREAMING"; - ActivityType[ActivityType["LISTENING"] = 2] = "LISTENING"; - ActivityType[ActivityType["CUSTOM"] = 4] = "CUSTOM"; - ActivityType[ActivityType["COMPETING"] = 5] = "COMPETING"; -})(ActivityType = exports.ActivityType || (exports.ActivityType = {})); -//# sourceMappingURL=Activity.js.map \ No newline at end of file diff --git a/dist/models/Activity.js.map b/dist/models/Activity.js.map deleted file mode 100644 index 8ce7d191..00000000 --- a/dist/models/Activity.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Activity.js","sourceRoot":"","sources":["../../src/models/Activity.ts"],"names":[],"mappings":";;;AAEA,uCAA0D;AA8C7C,QAAA,QAAQ,GAAG;IACvB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE;QACZ;YACC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM;SACZ;KACD;IACD,eAAe,EAAE,MAAM;IACvB,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE;QACP,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,MAAM;QACX,SAAS,EAAE,OAAO;KAClB;IACD,MAAM,EAAE;QACP,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;KACvB;IACD,OAAO,EAAE;QACR,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,MAAM;QACnB,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,MAAM;KACnB;IACD,QAAQ,EAAE;QACT,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,MAAM;QACjB,MAAM,EAAE,MAAM;KACd;IACD,SAAS,EAAE,OAAO;IAClB,MAAM,EAAE,gBAAK,CAAC,IAAI;CAClB,CAAC;AAEF,IAAY,YAMX;AAND,WAAY,YAAY;IACvB,+CAAQ,CAAA;IACR,yDAAa,CAAA;IACb,yDAAa,CAAA;IACb,mDAAU,CAAA;IACV,yDAAa,CAAA;AACd,CAAC,EANW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAMvB"} \ No newline at end of file diff --git a/dist/models/Application.d.ts b/dist/models/Application.d.ts deleted file mode 100644 index 68e026bb..00000000 --- a/dist/models/Application.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export interface ApplicationCommand { - id: string; - application_id: string; - name: string; - description: string; - options?: ApplicationCommandOption[]; -} -export interface ApplicationCommandOption { - type: ApplicationCommandOptionType; - name: string; - description: string; - required?: boolean; - choices?: ApplicationCommandOptionChoice[]; - options?: ApplicationCommandOption[]; -} -export interface ApplicationCommandOptionChoice { - name: string; - value: string | number; -} -export declare enum ApplicationCommandOptionType { - SUB_COMMAND = 1, - SUB_COMMAND_GROUP = 2, - STRING = 3, - INTEGER = 4, - BOOLEAN = 5, - USER = 6, - CHANNEL = 7, - ROLE = 8 -} -export interface ApplicationCommandInteractionData { - id: string; - name: string; - options?: ApplicationCommandInteractionDataOption[]; -} -export interface ApplicationCommandInteractionDataOption { - name: string; - value?: any; - options?: ApplicationCommandInteractionDataOption[]; -} diff --git a/dist/models/Application.js b/dist/models/Application.js deleted file mode 100644 index 6981f8a8..00000000 --- a/dist/models/Application.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ApplicationCommandOptionType = void 0; -var ApplicationCommandOptionType; -(function (ApplicationCommandOptionType) { - ApplicationCommandOptionType[ApplicationCommandOptionType["SUB_COMMAND"] = 1] = "SUB_COMMAND"; - ApplicationCommandOptionType[ApplicationCommandOptionType["SUB_COMMAND_GROUP"] = 2] = "SUB_COMMAND_GROUP"; - ApplicationCommandOptionType[ApplicationCommandOptionType["STRING"] = 3] = "STRING"; - ApplicationCommandOptionType[ApplicationCommandOptionType["INTEGER"] = 4] = "INTEGER"; - ApplicationCommandOptionType[ApplicationCommandOptionType["BOOLEAN"] = 5] = "BOOLEAN"; - ApplicationCommandOptionType[ApplicationCommandOptionType["USER"] = 6] = "USER"; - ApplicationCommandOptionType[ApplicationCommandOptionType["CHANNEL"] = 7] = "CHANNEL"; - ApplicationCommandOptionType[ApplicationCommandOptionType["ROLE"] = 8] = "ROLE"; -})(ApplicationCommandOptionType = exports.ApplicationCommandOptionType || (exports.ApplicationCommandOptionType = {})); -//# sourceMappingURL=Application.js.map \ No newline at end of file diff --git a/dist/models/Application.js.map b/dist/models/Application.js.map deleted file mode 100644 index 083b76f2..00000000 --- a/dist/models/Application.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Application.js","sourceRoot":"","sources":["../../src/models/Application.ts"],"names":[],"mappings":";;;AAsBA,IAAY,4BASX;AATD,WAAY,4BAA4B;IACvC,6FAAe,CAAA;IACf,yGAAqB,CAAA;IACrB,mFAAU,CAAA;IACV,qFAAW,CAAA;IACX,qFAAW,CAAA;IACX,+EAAQ,CAAA;IACR,qFAAW,CAAA;IACX,+EAAQ,CAAA;AACT,CAAC,EATW,4BAA4B,GAA5B,oCAA4B,KAA5B,oCAA4B,QASvC"} \ No newline at end of file diff --git a/dist/models/AuditLog.d.ts b/dist/models/AuditLog.d.ts deleted file mode 100644 index 76c21807..00000000 --- a/dist/models/AuditLog.d.ts +++ /dev/null @@ -1,187 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { Schema, Document } from "mongoose"; -import { ChannelPermissionOverwrite } from "./Channel"; -import { PublicUser } from "./User"; -export interface AuditLogResponse { - webhooks: []; - users: PublicUser[]; - audit_log_entries: AuditLogEntries[]; - integrations: []; -} -export interface AuditLogEntries { - target_id?: string; - user_id: string; - id: string; - action_type: AuditLogEvents; - options?: { - delete_member_days?: string; - members_removed?: string; - channel_id?: string; - messaged_id?: string; - count?: string; - id?: string; - type?: string; - role_name?: string; - }; - changes: AuditLogChange[]; - reason?: string; -} -export interface AuditLogChange { - new_value?: AuditLogChangeValue; - old_value?: AuditLogChangeValue; - key: string; -} -export interface AuditLogChangeValue { - name?: string; - description?: string; - icon_hash?: string; - splash_hash?: string; - discovery_splash_hash?: string; - banner_hash?: string; - owner_id?: string; - region?: string; - preferred_locale?: string; - afk_channel_id?: string; - afk_timeout?: number; - rules_channel_id?: string; - public_updates_channel_id?: string; - mfa_level?: number; - verification_level?: number; - explicit_content_filter?: number; - default_message_notifications?: number; - vanity_url_code?: string; - $add?: {}[]; - $remove?: {}[]; - prune_delete_days?: number; - widget_enabled?: boolean; - widget_channel_id?: string; - system_channel_id?: string; - position?: number; - topic?: string; - bitrate?: number; - permission_overwrites?: ChannelPermissionOverwrite[]; - nsfw?: boolean; - application_id?: string; - rate_limit_per_user?: number; - permissions?: string; - color?: number; - hoist?: boolean; - mentionable?: boolean; - allow?: string; - deny?: string; - code?: string; - channel_id?: string; - inviter_id?: string; - max_uses?: number; - uses?: number; - max_age?: number; - temporary?: boolean; - deaf?: boolean; - mute?: boolean; - nick?: string; - avatar_hash?: string; - id?: string; - type?: number; - enable_emoticons?: boolean; - expire_behavior?: number; - expire_grace_period?: number; - user_limit?: number; -} -export interface AuditLogEntriesDocument extends Document, AuditLogEntries { - id: string; -} -export declare const AuditLogChanges: { - name: StringConstructor; - description: StringConstructor; - icon_hash: StringConstructor; - splash_hash: StringConstructor; - discovery_splash_hash: StringConstructor; - banner_hash: StringConstructor; - owner_id: StringConstructor; - region: StringConstructor; - preferred_locale: StringConstructor; - afk_channel_id: StringConstructor; - afk_timeout: NumberConstructor; - rules_channel_id: StringConstructor; - public_updates_channel_id: StringConstructor; - mfa_level: NumberConstructor; - verification_level: NumberConstructor; - explicit_content_filter: NumberConstructor; - default_message_notifications: NumberConstructor; - vanity_url_code: StringConstructor; - $add: {}[]; - $remove: {}[]; - prune_delete_days: NumberConstructor; - widget_enabled: BooleanConstructor; - widget_channel_id: StringConstructor; - system_channel_id: StringConstructor; - position: NumberConstructor; - topic: StringConstructor; - bitrate: NumberConstructor; - permission_overwrites: {}[]; - nsfw: BooleanConstructor; - application_id: StringConstructor; - rate_limit_per_user: NumberConstructor; - permissions: StringConstructor; - color: NumberConstructor; - hoist: BooleanConstructor; - mentionable: BooleanConstructor; - allow: StringConstructor; - deny: StringConstructor; - code: StringConstructor; - channel_id: StringConstructor; - inviter_id: StringConstructor; - max_uses: NumberConstructor; - uses: NumberConstructor; - max_age: NumberConstructor; - temporary: BooleanConstructor; - deaf: BooleanConstructor; - mute: BooleanConstructor; - nick: StringConstructor; - avatar_hash: StringConstructor; - id: StringConstructor; - type: NumberConstructor; - enable_emoticons: BooleanConstructor; - expire_behavior: NumberConstructor; - expire_grace_period: NumberConstructor; - user_limit: NumberConstructor; -}; -export declare const AuditLogSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const AuditLogModel: import("mongoose").Model<AuditLogEntries>; -export declare enum AuditLogEvents { - GUILD_UPDATE = 1, - CHANNEL_CREATE = 10, - CHANNEL_UPDATE = 11, - CHANNEL_DELETE = 12, - CHANNEL_OVERWRITE_CREATE = 13, - CHANNEL_OVERWRITE_UPDATE = 14, - CHANNEL_OVERWRITE_DELETE = 15, - MEMBER_KICK = 20, - MEMBER_PRUNE = 21, - MEMBER_BAN_ADD = 22, - MEMBER_BAN_REMOVE = 23, - MEMBER_UPDATE = 24, - MEMBER_ROLE_UPDATE = 25, - MEMBER_MOVE = 26, - MEMBER_DISCONNECT = 27, - BOT_ADD = 28, - ROLE_CREATE = 30, - ROLE_UPDATE = 31, - ROLE_DELETE = 32, - INVITE_CREATE = 40, - INVITE_UPDATE = 41, - INVITE_DELETE = 42, - WEBHOOK_CREATE = 50, - WEBHOOK_UPDATE = 51, - WEBHOOK_DELETE = 52, - EMOJI_CREATE = 60, - EMOJI_UPDATE = 61, - EMOJI_DELETE = 62, - MESSAGE_DELETE = 72, - MESSAGE_BULK_DELETE = 73, - MESSAGE_PIN = 74, - MESSAGE_UNPIN = 75, - INTEGRATION_CREATE = 80, - INTEGRATION_UPDATE = 81, - INTEGRATION_DELETE = 82 -} diff --git a/dist/models/AuditLog.js b/dist/models/AuditLog.js deleted file mode 100644 index 2a76e5b7..00000000 --- a/dist/models/AuditLog.js +++ /dev/null @@ -1,129 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AuditLogEvents = exports.AuditLogModel = exports.AuditLogSchema = exports.AuditLogChanges = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.AuditLogChanges = { - name: String, - description: String, - icon_hash: String, - splash_hash: String, - discovery_splash_hash: String, - banner_hash: String, - owner_id: String, - region: String, - preferred_locale: String, - afk_channel_id: String, - afk_timeout: Number, - rules_channel_id: String, - public_updates_channel_id: String, - mfa_level: Number, - verification_level: Number, - explicit_content_filter: Number, - default_message_notifications: Number, - vanity_url_code: String, - $add: [{}], - $remove: [{}], - prune_delete_days: Number, - widget_enabled: Boolean, - widget_channel_id: String, - system_channel_id: String, - position: Number, - topic: String, - bitrate: Number, - permission_overwrites: [{}], - nsfw: Boolean, - application_id: String, - rate_limit_per_user: Number, - permissions: String, - color: Number, - hoist: Boolean, - mentionable: Boolean, - allow: String, - deny: String, - code: String, - channel_id: String, - inviter_id: String, - max_uses: Number, - uses: Number, - max_age: Number, - temporary: Boolean, - deaf: Boolean, - mute: Boolean, - nick: String, - avatar_hash: String, - id: String, - type: Number, - enable_emoticons: Boolean, - expire_behavior: Number, - expire_grace_period: Number, - user_limit: Number, -}; -exports.AuditLogSchema = new mongoose_1.Schema({ - target_id: String, - user_id: { type: String, required: true }, - id: { type: String, required: true }, - action_type: { type: Number, required: true }, - options: { - delete_member_days: String, - members_removed: String, - channel_id: String, - messaged_id: String, - count: String, - id: String, - type: String, - role_name: String, - }, - changes: [ - { - new_value: exports.AuditLogChanges, - old_value: exports.AuditLogChanges, - key: String, - }, - ], - reason: String, -}); -// @ts-ignore -exports.AuditLogModel = Database_1.default.model("AuditLog", exports.AuditLogSchema, "auditlogs"); -var AuditLogEvents; -(function (AuditLogEvents) { - AuditLogEvents[AuditLogEvents["GUILD_UPDATE"] = 1] = "GUILD_UPDATE"; - AuditLogEvents[AuditLogEvents["CHANNEL_CREATE"] = 10] = "CHANNEL_CREATE"; - AuditLogEvents[AuditLogEvents["CHANNEL_UPDATE"] = 11] = "CHANNEL_UPDATE"; - AuditLogEvents[AuditLogEvents["CHANNEL_DELETE"] = 12] = "CHANNEL_DELETE"; - AuditLogEvents[AuditLogEvents["CHANNEL_OVERWRITE_CREATE"] = 13] = "CHANNEL_OVERWRITE_CREATE"; - AuditLogEvents[AuditLogEvents["CHANNEL_OVERWRITE_UPDATE"] = 14] = "CHANNEL_OVERWRITE_UPDATE"; - AuditLogEvents[AuditLogEvents["CHANNEL_OVERWRITE_DELETE"] = 15] = "CHANNEL_OVERWRITE_DELETE"; - AuditLogEvents[AuditLogEvents["MEMBER_KICK"] = 20] = "MEMBER_KICK"; - AuditLogEvents[AuditLogEvents["MEMBER_PRUNE"] = 21] = "MEMBER_PRUNE"; - AuditLogEvents[AuditLogEvents["MEMBER_BAN_ADD"] = 22] = "MEMBER_BAN_ADD"; - AuditLogEvents[AuditLogEvents["MEMBER_BAN_REMOVE"] = 23] = "MEMBER_BAN_REMOVE"; - AuditLogEvents[AuditLogEvents["MEMBER_UPDATE"] = 24] = "MEMBER_UPDATE"; - AuditLogEvents[AuditLogEvents["MEMBER_ROLE_UPDATE"] = 25] = "MEMBER_ROLE_UPDATE"; - AuditLogEvents[AuditLogEvents["MEMBER_MOVE"] = 26] = "MEMBER_MOVE"; - AuditLogEvents[AuditLogEvents["MEMBER_DISCONNECT"] = 27] = "MEMBER_DISCONNECT"; - AuditLogEvents[AuditLogEvents["BOT_ADD"] = 28] = "BOT_ADD"; - AuditLogEvents[AuditLogEvents["ROLE_CREATE"] = 30] = "ROLE_CREATE"; - AuditLogEvents[AuditLogEvents["ROLE_UPDATE"] = 31] = "ROLE_UPDATE"; - AuditLogEvents[AuditLogEvents["ROLE_DELETE"] = 32] = "ROLE_DELETE"; - AuditLogEvents[AuditLogEvents["INVITE_CREATE"] = 40] = "INVITE_CREATE"; - AuditLogEvents[AuditLogEvents["INVITE_UPDATE"] = 41] = "INVITE_UPDATE"; - AuditLogEvents[AuditLogEvents["INVITE_DELETE"] = 42] = "INVITE_DELETE"; - AuditLogEvents[AuditLogEvents["WEBHOOK_CREATE"] = 50] = "WEBHOOK_CREATE"; - AuditLogEvents[AuditLogEvents["WEBHOOK_UPDATE"] = 51] = "WEBHOOK_UPDATE"; - AuditLogEvents[AuditLogEvents["WEBHOOK_DELETE"] = 52] = "WEBHOOK_DELETE"; - AuditLogEvents[AuditLogEvents["EMOJI_CREATE"] = 60] = "EMOJI_CREATE"; - AuditLogEvents[AuditLogEvents["EMOJI_UPDATE"] = 61] = "EMOJI_UPDATE"; - AuditLogEvents[AuditLogEvents["EMOJI_DELETE"] = 62] = "EMOJI_DELETE"; - AuditLogEvents[AuditLogEvents["MESSAGE_DELETE"] = 72] = "MESSAGE_DELETE"; - AuditLogEvents[AuditLogEvents["MESSAGE_BULK_DELETE"] = 73] = "MESSAGE_BULK_DELETE"; - AuditLogEvents[AuditLogEvents["MESSAGE_PIN"] = 74] = "MESSAGE_PIN"; - AuditLogEvents[AuditLogEvents["MESSAGE_UNPIN"] = 75] = "MESSAGE_UNPIN"; - AuditLogEvents[AuditLogEvents["INTEGRATION_CREATE"] = 80] = "INTEGRATION_CREATE"; - AuditLogEvents[AuditLogEvents["INTEGRATION_UPDATE"] = 81] = "INTEGRATION_UPDATE"; - AuditLogEvents[AuditLogEvents["INTEGRATION_DELETE"] = 82] = "INTEGRATION_DELETE"; -})(AuditLogEvents = exports.AuditLogEvents || (exports.AuditLogEvents = {})); -//# sourceMappingURL=AuditLog.js.map \ No newline at end of file diff --git a/dist/models/AuditLog.js.map b/dist/models/AuditLog.js.map deleted file mode 100644 index 6529c239..00000000 --- a/dist/models/AuditLog.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AuditLog.js","sourceRoot":"","sources":["../../src/models/Au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;IACnB,8EAAsB,CAAA;IACtB,sEAAkB,CAAA;IAClB,gFAAuB,CAAA;IACvB,kEAAgB,CAAA;IAChB,8EAAsB,CAAA;IACtB,0DAAY,CAAA;IACZ,kEAAgB,CAAA;IAChB,kEAAgB,CAAA;IAChB,kEAAgB,CAAA;IAChB,sEAAkB,CAAA;IAClB,sEAAkB,CAAA;IAClB,sEAAkB,CAAA;IAClB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,oEAAiB,CAAA;IACjB,oEAAiB,CAAA;IACjB,oEAAiB,CAAA;IACjB,wEAAmB,CAAA;IACnB,kFAAwB,CAAA;IACxB,kEAAgB,CAAA;IAChB,sEAAkB,CAAA;IAClB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;AACxB,CAAC,EApCW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAoCzB"} \ No newline at end of file diff --git a/dist/models/Ban.d.ts b/dist/models/Ban.d.ts deleted file mode 100644 index ad3a39b7..00000000 --- a/dist/models/Ban.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { Schema, Document } from "mongoose"; -export interface Ban extends Document { - user_id: string; - guild_id: string; - executor_id: string; - ip: string; - reason?: string; -} -export declare const BanSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const BanModel: import("mongoose").Model<Ban>; diff --git a/dist/models/Ban.js b/dist/models/Ban.js deleted file mode 100644 index 0b7f30b5..00000000 --- a/dist/models/Ban.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BanModel = exports.BanSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.BanSchema = new mongoose_1.Schema({ - user_id: { type: String, required: true }, - guild_id: { type: String, required: true }, - executor_id: { type: String, required: true }, - reason: String, - ip: String, -}); -// @ts-ignore -exports.BanModel = Database_1.default.model("Ban", exports.BanSchema, "bans"); -//# sourceMappingURL=Ban.js.map \ No newline at end of file diff --git a/dist/models/Ban.js.map b/dist/models/Ban.js.map deleted file mode 100644 index 6a10fccb..00000000 --- a/dist/models/Ban.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Ban.js","sourceRoot":"","sources":["../../src/models/Ban.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAUrB,QAAA,SAAS,GAAG,IAAI,iBAAM,CAAC;IACnC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1C,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC7C,MAAM,EAAE,MAAM;IACd,EAAE,EAAE,MAAM;CACV,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,QAAQ,GAAG,kBAAE,CAAC,KAAK,CAAM,KAAK,EAAE,iBAAS,EAAE,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Channel.d.ts b/dist/models/Channel.d.ts deleted file mode 100644 index d3048622..00000000 --- a/dist/models/Channel.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { Schema, Document } from "mongoose"; -export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel { -} -export interface ChannelDocument extends Document, AnyChannel { - id: string; -} -export declare const ChannelSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const ChannelModel: import("mongoose").Model<ChannelDocument>; -export interface Channel { - id: string; - created_at: Date; - name: string; - type: number; -} -export interface TextBasedChannel { - last_message_id?: string; - last_pin_timestamp?: number; -} -export interface GuildChannel extends Channel { - guild_id: string; - position: number; - parent_id?: string; - permission_overwrites: ChannelPermissionOverwrite[]; -} -export interface ChannelPermissionOverwrite { - allow: bigint; - deny: bigint; - id: string; - type: ChannelPermissionOverwriteType; -} -export declare enum ChannelPermissionOverwriteType { - role = 0, - member = 1 -} -export interface VoiceChannel extends GuildChannel { -} -export interface TextChannel extends GuildChannel, TextBasedChannel { - nsfw: boolean; - rate_limit_per_user: number; - topic?: string; -} -export interface DMChannel extends Channel, TextBasedChannel { - owner_id: string; - recipients: string[]; -} -export declare enum ChannelType { - GUILD_TEXT = 0, - DM = 1, - GUILD_VOICE = 2, - GROUP_DM = 3, - GUILD_CATEGORY = 4, - GUILD_NEWS = 5, - GUILD_STORE = 6 -} diff --git a/dist/models/Channel.js b/dist/models/Channel.js deleted file mode 100644 index 956b1fc5..00000000 --- a/dist/models/Channel.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ChannelType = exports.ChannelPermissionOverwriteType = exports.ChannelModel = exports.ChannelSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.ChannelSchema = new mongoose_1.Schema({ - id: String, - created_at: { type: mongoose_1.Schema.Types.Date, required: true }, - name: { type: String, required: true }, - type: { type: Number, required: true }, - guild_id: String, - owner_id: String, - parent_id: String, - recipients: [String], - position: Number, - last_message_id: String, - last_pin_timestamp: Date, - nsfw: Boolean, - rate_limit_per_user: Number, - topic: String, - permission_overwrites: [ - { - allow: mongoose_1.Types.Long, - deny: mongoose_1.Types.Long, - id: String, - type: Number, - }, - ], -}); -// @ts-ignore -exports.ChannelModel = Database_1.default.model("Channel", exports.ChannelSchema, "channels"); -var ChannelPermissionOverwriteType; -(function (ChannelPermissionOverwriteType) { - ChannelPermissionOverwriteType[ChannelPermissionOverwriteType["role"] = 0] = "role"; - ChannelPermissionOverwriteType[ChannelPermissionOverwriteType["member"] = 1] = "member"; -})(ChannelPermissionOverwriteType = exports.ChannelPermissionOverwriteType || (exports.ChannelPermissionOverwriteType = {})); -var ChannelType; -(function (ChannelType) { - ChannelType[ChannelType["GUILD_TEXT"] = 0] = "GUILD_TEXT"; - ChannelType[ChannelType["DM"] = 1] = "DM"; - ChannelType[ChannelType["GUILD_VOICE"] = 2] = "GUILD_VOICE"; - ChannelType[ChannelType["GROUP_DM"] = 3] = "GROUP_DM"; - ChannelType[ChannelType["GUILD_CATEGORY"] = 4] = "GUILD_CATEGORY"; - ChannelType[ChannelType["GUILD_NEWS"] = 5] = "GUILD_NEWS"; - ChannelType[ChannelType["GUILD_STORE"] = 6] = "GUILD_STORE"; -})(ChannelType = exports.ChannelType || (exports.ChannelType = {})); -//# sourceMappingURL=Channel.js.map \ No newline at end of file diff --git a/dist/models/Channel.js.map b/dist/models/Channel.js.map deleted file mode 100644 index ff804845..00000000 --- a/dist/models/Channel.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../../src/models/Channel.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAQrB,QAAA,aAAa,GAAG,IAAI,iBAAM,CAAC;IACvC,EAAE,EAAE,MAAM;IACV,UAAU,EAAE,EAAE,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM;IAChB,eAAe,EAAE,MAAM;IACvB,kBAAkB,EAAE,IAAI;IACxB,IAAI,EAAE,OAAO;IACb,mBAAmB,EAAE,MAAM;IAC3B,KAAK,EAAE,MAAM;IACb,qBAAqB,EAAE;QACtB;YACC,KAAK,EAAE,gBAAK,CAAC,IAAI;YACjB,IAAI,EAAE,gBAAK,CAAC,IAAI;YAChB,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,MAAM;SACZ;KACD;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,YAAY,GAAG,kBAAE,CAAC,KAAK,CAAkB,SAAS,EAAE,qBAAa,EAAE,UAAU,CAAC,CAAC;AA4B5F,IAAY,8BAGX;AAHD,WAAY,8BAA8B;IACzC,mFAAQ,CAAA;IACR,uFAAU,CAAA;AACX,CAAC,EAHW,8BAA8B,GAA9B,sCAA8B,KAA9B,sCAA8B,QAGzC;AAeD,IAAY,WAQX;AARD,WAAY,WAAW;IACtB,yDAAc,CAAA;IACd,yCAAM,CAAA;IACN,2DAAe,CAAA;IACf,qDAAY,CAAA;IACZ,iEAAkB,CAAA;IAClB,yDAAc,CAAA;IACd,2DAAe,CAAA;AAChB,CAAC,EARW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAQtB"} \ No newline at end of file diff --git a/dist/models/Emoji.d.ts b/dist/models/Emoji.d.ts deleted file mode 100644 index 9e53cc72..00000000 --- a/dist/models/Emoji.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { Schema, Document } from "mongoose"; -export interface Emoji extends Document { - id: string; - animated: boolean; - available: boolean; - guild_id: string; - managed: boolean; - name: string; - require_colons: boolean; - url: string; - roles: string[]; -} -export declare const EmojiSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const EmojiModel: import("mongoose").Model<Emoji>; diff --git a/dist/models/Emoji.js b/dist/models/Emoji.js deleted file mode 100644 index 5f9fc56f..00000000 --- a/dist/models/Emoji.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EmojiModel = exports.EmojiSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.EmojiSchema = new mongoose_1.Schema({ - id: { type: String, required: true }, - animated: Boolean, - available: Boolean, - guild_id: String, - managed: Boolean, - name: String, - require_colons: Boolean, - url: String, - roles: [String], -}); -// @ts-ignore -exports.EmojiModel = Database_1.default.model("Emoji", exports.EmojiSchema, "emojis"); -//# sourceMappingURL=Emoji.js.map \ No newline at end of file diff --git a/dist/models/Emoji.js.map b/dist/models/Emoji.js.map deleted file mode 100644 index f66fe302..00000000 --- a/dist/models/Emoji.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../src/models/Emoji.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAcrB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpC,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,OAAO;IACvB,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,CAAC,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAQ,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Event.d.ts b/dist/models/Event.d.ts deleted file mode 100644 index 00ca7cac..00000000 --- a/dist/models/Event.d.ts +++ /dev/null @@ -1,417 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { ConnectedAccount, PublicUser, User, UserSettings } from "./User"; -import { DMChannel, Channel } from "./Channel"; -import { Guild } from "./Guild"; -import { Member, PublicMember, UserGuildSettings } from "./Member"; -import { Emoji } from "./Emoji"; -import { Presence } from "./Activity"; -import { Role } from "./Role"; -import { Invite } from "./Invite"; -import { Message, PartialEmoji } from "./Message"; -import { VoiceState } from "./VoiceState"; -import { ApplicationCommand } from "./Application"; -import { Interaction } from "./Interaction"; -import { Schema, Document } from "mongoose"; -export interface Event { - guild_id?: string; - user_id?: string; - channel_id?: string; - created_at?: Date; - event: EVENT; - data?: any; -} -export interface EventDocument extends Event, Document { -} -export declare const EventSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const EventModel: import("mongoose").Model<EventDocument>; -export interface InvalidatedEvent extends Event { - event: "INVALIDATED"; -} -export interface ReadyEventData { - v: number; - user: PublicUser & { - mobile: boolean; - desktop: boolean; - email: string; - flags: bigint; - mfa_enabled: boolean; - nsfw_allowed: boolean; - phone: string; - premium: boolean; - premium_type: number; - verified: boolean; - bot: boolean; - }; - private_channels: DMChannel[]; - session_id: string; - guilds: Guild[]; - analytics_token?: string; - connected_accounts?: ConnectedAccount[]; - consents?: { - personalization?: { - consented?: boolean; - }; - }; - country_code?: string; - friend_suggestion_count?: number; - geo_ordered_rtc_regions?: string[]; - experiments?: [number, number, number, number, number][]; - guild_experiments?: [ - number, - null, - number, - [ - [number, { - e: number; - s: number; - }[]] - ], - [ - number, - [[number, [number, number]]] - ], - { - b: number; - k: bigint[]; - }[] - ][]; - guild_join_requests?: []; - shard?: [number, number]; - user_settings?: UserSettings; - relationships?: []; - read_state: { - entries: []; - partial: boolean; - version: number; - }; - user_guild_settings?: { - entries: UserGuildSettings[]; - version: number; - partial: boolean; - }; - application?: { - id: string; - flags: bigint; - }; - merged_members?: Omit<Member, "settings" | "user">[][]; - users?: { - avatar?: string; - discriminator: string; - id: string; - username: string; - bot: boolean; - public_flags: bigint; - }[]; -} -export interface ReadyEvent extends Event { - event: "READY"; - data: ReadyEventData; -} -export interface ChannelCreateEvent extends Event { - event: "CHANNEL_CREATE"; - data: Channel; -} -export interface ChannelUpdateEvent extends Event { - event: "CHANNEL_UPDATE"; - data: Channel; -} -export interface ChannelDeleteEvent extends Event { - event: "CHANNEL_DELETE"; - data: Channel; -} -export interface ChannelPinsUpdateEvent extends Event { - event: "CHANNEL_PINS_UPDATE"; - data: { - guild_id?: string; - channel_id: string; - last_pin_timestamp: number; - }; -} -export interface GuildCreateEvent extends Event { - event: "GUILD_CREATE"; - data: Guild; -} -export interface GuildUpdateEvent extends Event { - event: "GUILD_UPDATE"; - data: Guild; -} -export interface GuildDeleteEvent extends Event { - event: "GUILD_DELETE"; - data: { - id: string; - unavailable?: boolean; - }; -} -export interface GuildBanAddEvent extends Event { - event: "GUILD_BAN_ADD"; - data: { - guild_id: string; - user: User; - }; -} -export interface GuildBanRemoveEvent extends Event { - event: "GUILD_BAN_REMOVE"; - data: { - guild_id: string; - user: User; - }; -} -export interface GuildEmojiUpdateEvent extends Event { - event: "GUILD_EMOJI_UPDATE"; - data: { - guild_id: string; - emojis: Emoji[]; - }; -} -export interface GuildIntegrationUpdateEvent extends Event { - event: "GUILD_INTEGRATIONS_UPDATE"; - data: { - guild_id: string; - }; -} -export interface GuildMemberAddEvent extends Event { - event: "GUILD_MEMBER_ADD"; - data: PublicMember & { - guild_id: string; - }; -} -export interface GuildMemberRemoveEvent extends Event { - event: "GUILD_MEMBER_REMOVE"; - data: { - guild_id: string; - user: User; - }; -} -export interface GuildMemberUpdateEvent extends Event { - event: "GUILD_MEMBER_UPDATE"; - data: { - guild_id: string; - roles: string[]; - user: User; - nick?: string; - joined_at: Date; - premium_since?: number; - pending?: boolean; - }; -} -export interface GuildMembersChunkEvent extends Event { - event: "GUILD_MEMBERS_CHUNK"; - data: { - guild_id: string; - members: PublicMember[]; - chunk_index: number; - chunk_count: number; - not_found: string[]; - presences: Presence[]; - nonce?: string; - }; -} -export interface GuildRoleCreateEvent extends Event { - event: "GUILD_ROLE_CREATE"; - data: { - guild_id: string; - role: Role; - }; -} -export interface GuildRoleUpdateEvent extends Event { - event: "GUILD_ROLE_UPDATE"; - data: { - guild_id: string; - role: Role; - }; -} -export interface GuildRoleDeleteEvent extends Event { - event: "GUILD_ROLE_DELETE"; - data: { - guild_id: string; - role_id: string; - }; -} -export interface InviteCreateEvent extends Event { - event: "INVITE_CREATE"; - data: Omit<Invite, "guild" | "channel"> & { - channel_id: string; - guild_id?: string; - }; -} -export interface InviteDeleteEvent extends Event { - event: "INVITE_DELETE"; - data: { - channel_id: string; - guild_id?: string; - code: string; - }; -} -export declare type MessagePayload = Omit<Message, "author_id"> & { - channel_id: string; - guild_id?: string; - author: User; - member: PublicMember; - mentions: (User & { - member: PublicMember; - })[]; -}; -export interface MessageCreateEvent extends Event { - event: "MESSAGE_CREATE"; - data: MessagePayload; -} -export interface MessageUpdateEvent extends Event { - event: "MESSAGE_UPDATE"; - data: MessagePayload; -} -export interface MessageDeleteEvent extends Event { - event: "MESSAGE_DELETE"; - data: { - id: string; - channel_id: string; - guild_id?: string; - }; -} -export interface MessageDeleteBulkEvent extends Event { - event: "MESSAGE_DELETE_BULK"; - data: { - ids: string[]; - channel_id: string; - guild_id?: string; - }; -} -export interface MessageReactionAddEvent extends Event { - event: "MESSAGE_REACTION_ADD"; - data: { - user_id: string; - channel_id: string; - message_id: string; - guild_id?: string; - member?: PublicMember; - emoji: PartialEmoji; - }; -} -export interface MessageReactionRemoveEvent extends Event { - event: "MESSAGE_REACTION_REMOVE"; - data: { - user_id: string; - channel_id: string; - message_id: string; - guild_id?: string; - emoji: PartialEmoji; - }; -} -export interface MessageReactionRemoveAllEvent extends Event { - event: "MESSAGE_REACTION_REMOVE_ALL"; - data: { - channel_id: string; - message_id: string; - guild_id?: string; - }; -} -export interface MessageReactionRemoveEmojiEvent extends Event { - event: "MESSAGE_REACTION_REMOVE_EMOJI"; - data: { - channel_id: string; - message_id: string; - guild_id?: string; - emoji: PartialEmoji; - }; -} -export interface PresenceUpdateEvent extends Event { - event: "PRESENCE_UPDATE"; - data: Presence; -} -export interface TypingStartEvent extends Event { - event: "TYPING_START"; - data: { - channel_id: string; - user_id: string; - timestamp: number; - guild_id?: string; - member?: PublicMember; - }; -} -export interface UserUpdateEvent extends Event { - event: "USER_UPDATE"; - data: User; -} -export interface VoiceStateUpdateEvent extends Event { - event: "VOICE_STATE_UPDATE"; - data: VoiceState & { - member: PublicMember; - }; -} -export interface VoiceServerUpdateEvent extends Event { - event: "VOICE_SERVER_UPDATE"; - data: { - token: string; - guild_id: string; - endpoint: string; - }; -} -export interface WebhooksUpdateEvent extends Event { - event: "WEBHOOKS_UPDATE"; - data: { - guild_id: string; - channel_id: string; - }; -} -export declare type ApplicationCommandPayload = ApplicationCommand & { - guild_id: string; -}; -export interface ApplicationCommandCreateEvent extends Event { - event: "APPLICATION_COMMAND_CREATE"; - data: ApplicationCommandPayload; -} -export interface ApplicationCommandUpdateEvent extends Event { - event: "APPLICATION_COMMAND_UPDATE"; - data: ApplicationCommandPayload; -} -export interface ApplicationCommandDeleteEvent extends Event { - event: "APPLICATION_COMMAND_DELETE"; - data: ApplicationCommandPayload; -} -export interface InteractionCreateEvent extends Event { - event: "INTERACTION_CREATE"; - data: Interaction; -} -export declare enum EVENTEnum { - Ready = "READY", - ChannelCreate = "CHANNEL_CREATE", - ChannelUpdate = "CHANNEL_UPDATE", - ChannelDelete = "CHANNEL_DELETE", - ChannelPinsUpdate = "CHANNEL_PINS_UPDATE", - GuildCreate = "GUILD_CREATE", - GuildUpdate = "GUILD_UPDATE", - GuildDelete = "GUILD_DELETE", - GuildBanAdd = "GUILD_BAN_ADD", - GuildBanRemove = "GUILD_BAN_REMOVE", - GuildEmojUpdate = "GUILD_EMOJI_UPDATE", - GuildIntegrationsUpdate = "GUILD_INTEGRATIONS_UPDATE", - GuildMemberAdd = "GUILD_MEMBER_ADD", - GuildMemberRempve = "GUILD_MEMBER_REMOVE", - GuildMemberUpdate = "GUILD_MEMBER_UPDATE", - GuildMemberSpeaking = "GUILD_MEMBER_SPEAKING", - GuildMembersChunk = "GUILD_MEMBERS_CHUNK", - GuildRoleCreate = "GUILD_ROLE_CREATE", - GuildRoleDelete = "GUILD_ROLE_DELETE", - GuildRoleUpdate = "GUILD_ROLE_UPDATE", - InviteCreate = "INVITE_CREATE", - InviteDelete = "INVITE_DELETE", - MessageCreate = "MESSAGE_CREATE", - MessageUpdate = "MESSAGE_UPDATE", - MessageDelete = "MESSAGE_DELETE", - MessageDeleteBulk = "MESSAGE_DELETE_BULK", - MessageReactionAdd = "MESSAGE_REACTION_ADD", - MessageReactionRemove = "MESSAGE_REACTION_REMOVE", - MessageReactionRemoveAll = "MESSAGE_REACTION_REMOVE_ALL", - MessageReactionRemoveEmoji = "MESSAGE_REACTION_REMOVE_EMOJI", - PresenceUpdate = "PRESENCE_UPDATE", - TypingStart = "TYPING_START", - UserUpdate = "USER_UPDATE", - WebhooksUpdate = "WEBHOOKS_UPDATE", - InteractionCreate = "INTERACTION_CREATE", - VoiceStateUpdate = "VOICE_STATE_UPDATE", - VoiceServerUpdate = "VOICE_SERVER_UPDATE", - ApplicationCommandCreate = "APPLICATION_COMMAND_CREATE", - ApplicationCommandUpdate = "APPLICATION_COMMAND_UPDATE", - ApplicationCommandDelete = "APPLICATION_COMMAND_DELETE" -} -export declare type EVENT = "READY" | "CHANNEL_CREATE" | "CHANNEL_UPDATE" | "CHANNEL_DELETE" | "CHANNEL_PINS_UPDATE" | "GUILD_CREATE" | "GUILD_UPDATE" | "GUILD_DELETE" | "GUILD_BAN_ADD" | "GUILD_BAN_REMOVE" | "GUILD_EMOJI_UPDATE" | "GUILD_INTEGRATIONS_UPDATE" | "GUILD_MEMBER_ADD" | "GUILD_MEMBER_REMOVE" | "GUILD_MEMBER_UPDATE" | "GUILD_MEMBER_SPEAKING" | "GUILD_MEMBERS_CHUNK" | "GUILD_ROLE_CREATE" | "GUILD_ROLE_DELETE" | "GUILD_ROLE_UPDATE" | "INVITE_CREATE" | "INVITE_DELETE" | "MESSAGE_CREATE" | "MESSAGE_UPDATE" | "MESSAGE_DELETE" | "MESSAGE_DELETE_BULK" | "MESSAGE_REACTION_ADD" | "MESSAGE_REACTION_REMOVE" | "MESSAGE_REACTION_REMOVE_ALL" | "MESSAGE_REACTION_REMOVE_EMOJI" | "PRESENCE_UPDATE" | "TYPING_START" | "USER_UPDATE" | "WEBHOOKS_UPDATE" | "INTERACTION_CREATE" | "VOICE_STATE_UPDATE" | "VOICE_SERVER_UPDATE" | "APPLICATION_COMMAND_CREATE" | "APPLICATION_COMMAND_UPDATE" | "APPLICATION_COMMAND_DELETE" | CUSTOMEVENTS; -export declare type CUSTOMEVENTS = "INVALIDATED"; diff --git a/dist/models/Event.js b/dist/models/Event.js deleted file mode 100644 index 9d442aad..00000000 --- a/dist/models/Event.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EVENTEnum = exports.EventModel = exports.EventSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.EventSchema = new mongoose_1.Schema({ - guild_id: String, - user_id: String, - channel_id: String, - created_at: { type: Date, required: true }, - event: { type: String, required: true }, - data: Object, -}); -// @ts-ignore -exports.EventModel = Database_1.default.model("Event", exports.EventSchema, "events"); -// located in collection events -var EVENTEnum; -(function (EVENTEnum) { - EVENTEnum["Ready"] = "READY"; - EVENTEnum["ChannelCreate"] = "CHANNEL_CREATE"; - EVENTEnum["ChannelUpdate"] = "CHANNEL_UPDATE"; - EVENTEnum["ChannelDelete"] = "CHANNEL_DELETE"; - EVENTEnum["ChannelPinsUpdate"] = "CHANNEL_PINS_UPDATE"; - EVENTEnum["GuildCreate"] = "GUILD_CREATE"; - EVENTEnum["GuildUpdate"] = "GUILD_UPDATE"; - EVENTEnum["GuildDelete"] = "GUILD_DELETE"; - EVENTEnum["GuildBanAdd"] = "GUILD_BAN_ADD"; - EVENTEnum["GuildBanRemove"] = "GUILD_BAN_REMOVE"; - EVENTEnum["GuildEmojUpdate"] = "GUILD_EMOJI_UPDATE"; - EVENTEnum["GuildIntegrationsUpdate"] = "GUILD_INTEGRATIONS_UPDATE"; - EVENTEnum["GuildMemberAdd"] = "GUILD_MEMBER_ADD"; - EVENTEnum["GuildMemberRempve"] = "GUILD_MEMBER_REMOVE"; - EVENTEnum["GuildMemberUpdate"] = "GUILD_MEMBER_UPDATE"; - EVENTEnum["GuildMemberSpeaking"] = "GUILD_MEMBER_SPEAKING"; - EVENTEnum["GuildMembersChunk"] = "GUILD_MEMBERS_CHUNK"; - EVENTEnum["GuildRoleCreate"] = "GUILD_ROLE_CREATE"; - EVENTEnum["GuildRoleDelete"] = "GUILD_ROLE_DELETE"; - EVENTEnum["GuildRoleUpdate"] = "GUILD_ROLE_UPDATE"; - EVENTEnum["InviteCreate"] = "INVITE_CREATE"; - EVENTEnum["InviteDelete"] = "INVITE_DELETE"; - EVENTEnum["MessageCreate"] = "MESSAGE_CREATE"; - EVENTEnum["MessageUpdate"] = "MESSAGE_UPDATE"; - EVENTEnum["MessageDelete"] = "MESSAGE_DELETE"; - EVENTEnum["MessageDeleteBulk"] = "MESSAGE_DELETE_BULK"; - EVENTEnum["MessageReactionAdd"] = "MESSAGE_REACTION_ADD"; - EVENTEnum["MessageReactionRemove"] = "MESSAGE_REACTION_REMOVE"; - EVENTEnum["MessageReactionRemoveAll"] = "MESSAGE_REACTION_REMOVE_ALL"; - EVENTEnum["MessageReactionRemoveEmoji"] = "MESSAGE_REACTION_REMOVE_EMOJI"; - EVENTEnum["PresenceUpdate"] = "PRESENCE_UPDATE"; - EVENTEnum["TypingStart"] = "TYPING_START"; - EVENTEnum["UserUpdate"] = "USER_UPDATE"; - EVENTEnum["WebhooksUpdate"] = "WEBHOOKS_UPDATE"; - EVENTEnum["InteractionCreate"] = "INTERACTION_CREATE"; - EVENTEnum["VoiceStateUpdate"] = "VOICE_STATE_UPDATE"; - EVENTEnum["VoiceServerUpdate"] = "VOICE_SERVER_UPDATE"; - EVENTEnum["ApplicationCommandCreate"] = "APPLICATION_COMMAND_CREATE"; - EVENTEnum["ApplicationCommandUpdate"] = "APPLICATION_COMMAND_UPDATE"; - EVENTEnum["ApplicationCommandDelete"] = "APPLICATION_COMMAND_DELETE"; -})(EVENTEnum = exports.EVENTEnum || (exports.EVENTEnum = {})); -//# sourceMappingURL=Event.js.map \ No newline at end of file diff --git a/dist/models/Event.js.map b/dist/models/Event.js.map deleted file mode 100644 index bd27fa9e..00000000 --- a/dist/models/Event.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../src/models/Event.ts"],"names":[],"mappings":";;;;;;AAYA,uCAA0D;AAC1D,gEAAkC;AAarB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1C,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvC,IAAI,EAAE,MAAM;CACZ,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAgB,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC;AAkYlF,+BAA+B;AAE/B,IAAY,SAyCX;AAzCD,WAAY,SAAS;IACpB,4BAAe,CAAA;IACf,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,yCAA4B,CAAA;IAC5B,yCAA4B,CAAA;IAC5B,0CAA6B,CAAA;IAC7B,gDAAmC,CAAA;IACnC,mDAAsC,CAAA;IACtC,kEAAqD,CAAA;IACrD,gDAAmC,CAAA;IACnC,sDAAyC,CAAA;IACzC,sDAAyC,CAAA;IACzC,0DAA6C,CAAA;IAC7C,sDAAyC,CAAA;IACzC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,2CAA8B,CAAA;IAC9B,2CAA8B,CAAA;IAC9B,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,sDAAyC,CAAA;IACzC,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;IACjD,qEAAwD,CAAA;IACxD,yEAA4D,CAAA;IAC5D,+CAAkC,CAAA;IAClC,yCAA4B,CAAA;IAC5B,uCAA0B,CAAA;IAC1B,+CAAkC,CAAA;IAClC,qDAAwC,CAAA;IACxC,oDAAuC,CAAA;IACvC,sDAAyC,CAAA;IACzC,oEAAuD,CAAA;IACvD,oEAAuD,CAAA;IACvD,oEAAuD,CAAA;AACxD,CAAC,EAzCW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAyCpB"} \ No newline at end of file diff --git a/dist/models/Guild.d.ts b/dist/models/Guild.d.ts deleted file mode 100644 index d7d94cb2..00000000 --- a/dist/models/Guild.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { Schema, Document } from "mongoose"; -export interface GuildDocument extends Document, Guild { - id: string; -} -export interface Guild { - id: string; - afk_channel_id?: string; - afk_timeout?: number; - application_id?: string; - banner?: string; - default_message_notifications?: number; - description?: string; - discovery_splash?: string; - explicit_content_filter?: number; - features: string[]; - icon?: string; - large?: boolean; - max_members?: number; - max_presences?: number; - max_video_channel_users?: number; - member_count?: number; - presence_count?: number; - mfa_level?: number; - name: string; - owner_id: string; - preferred_locale?: string; - premium_subscription_count?: number; - premium_tier?: number; - public_updates_channel_id?: string; - region?: string; - rules_channel_id?: string; - splash?: string; - system_channel_flags?: number; - system_channel_id?: string; - unavailable?: boolean; - vanity_url_code?: string; - verification_level?: number; - welcome_screen: []; - widget_channel_id?: string; - widget_enabled?: boolean; -} -export declare const GuildSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const GuildModel: import("mongoose").Model<GuildDocument>; diff --git a/dist/models/Guild.js b/dist/models/Guild.js deleted file mode 100644 index fa87d542..00000000 --- a/dist/models/Guild.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GuildModel = exports.GuildSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -const Channel_1 = require("./Channel"); -const Emoji_1 = require("./Emoji"); -const Member_1 = require("./Member"); -const Role_1 = require("./Role"); -exports.GuildSchema = new mongoose_1.Schema({ - id: { type: String, required: true }, - afk_channel_id: String, - afk_timeout: Number, - application_id: String, - banner: String, - default_message_notifications: Number, - description: String, - discovery_splash: String, - explicit_content_filter: Number, - features: { type: [String], default: [] }, - icon: String, - large: Boolean, - max_members: { type: Number, default: 100000 }, - max_presences: Number, - max_video_channel_users: { type: Number, default: 25 }, - member_count: Number, - presence_count: Number, - mfa_level: Number, - name: { type: String, required: true }, - owner_id: { type: String, required: true }, - preferred_locale: String, - premium_subscription_count: Number, - premium_tier: Number, - public_updates_channel_id: String, - region: String, - rules_channel_id: String, - splash: String, - system_channel_flags: Number, - system_channel_id: String, - unavailable: Boolean, - vanity_url_code: String, - verification_level: Number, - voice_states: { type: [Object], default: [] }, - welcome_screen: { type: [Object], default: [] }, - widget_channel_id: String, - widget_enabled: Boolean, -}); -exports.GuildSchema.virtual("channels", { - ref: Channel_1.ChannelModel, - localField: "id", - foreignField: "guild_id", - justOne: false, -}); -exports.GuildSchema.virtual("roles", { - ref: Role_1.RoleModel, - localField: "id", - foreignField: "guild_id", - justOne: false, -}); -// nested populate is needed for member users: https://gist.github.com/yangsu/5312204 -exports.GuildSchema.virtual("members", { - ref: Member_1.MemberModel, - localField: "id", - foreignField: "member_id", - justOne: false, -}); -exports.GuildSchema.virtual("emojis", { - ref: Emoji_1.EmojiModel, - localField: "id", - foreignField: "guild_id", - justOne: false, -}); -exports.GuildSchema.virtual("joined_at", { - ref: Member_1.MemberModel, - localField: "id", - foreignField: "guild_id", - justOne: true, -}).get((member, virtual, doc) => { - console.log("get", member, this); - return member.joined_at; -}); -// @ts-ignore -exports.GuildModel = Database_1.default.model("Guild", exports.GuildSchema, "guilds"); -//# sourceMappingURL=Guild.js.map \ No newline at end of file diff --git a/dist/models/Guild.js.map b/dist/models/Guild.js.map deleted file mode 100644 index aaa3951b..00000000 --- a/dist/models/Guild.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Guild.js","sourceRoot":"","sources":["../../src/models/Guild.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAClC,uCAAyC;AACzC,mCAAqC;AACrC,qCAAuC;AACvC,iCAAmC;AAiDtB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpC,cAAc,EAAE,MAAM;IACtB,WAAW,EAAE,MAAM;IACnB,cAAc,EAAE,MAAM;IACtB,MAAM,EAAE,MAAM;IACd,6BAA6B,EAAE,MAAM;IACrC,WAAW,EAAE,MAAM;IACnB,gBAAgB,EAAE,MAAM;IACxB,uBAAuB,EAAE,MAAM;IAC/B,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACzC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;IAC9C,aAAa,EAAE,MAAM;IACrB,uBAAuB,EAAE,EAAE,I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AAI;IAChB,YAAY,EAAE,WAAW;IACzB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,mBAAW,CAAC,OAAO,CAAC,QAAQ,EAAE;IAC7B,GAAG,EAAE,kBAAU;IACf,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,UAAU;IACxB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,mBAAW,CAAC,OAAO,CAAC,WAAW,EAAE;IAChC,GAAG,EAAE,oBAAW;IAChB,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,UAAU;IACxB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,OAAY,EAAE,GAAQ,EAAE,EAAE;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,SAAS,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAgB,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Interaction.d.ts b/dist/models/Interaction.d.ts deleted file mode 100644 index 53836981..00000000 --- a/dist/models/Interaction.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { AllowedMentions, Embed } from "./Message"; -export interface Interaction { - id: string; - type: InteractionType; - data?: {}; - guild_id: string; - channel_id: string; - member_id: string; - token: string; - version: number; -} -export declare enum InteractionType { - Ping = 1, - ApplicationCommand = 2 -} -export declare enum InteractionResponseType { - Pong = 1, - Acknowledge = 2, - ChannelMessage = 3, - ChannelMessageWithSource = 4, - AcknowledgeWithSource = 5 -} -export interface InteractionApplicationCommandCallbackData { - tts?: boolean; - content: string; - embeds?: Embed[]; - allowed_mentions?: AllowedMentions; -} diff --git a/dist/models/Interaction.js b/dist/models/Interaction.js deleted file mode 100644 index 6985e399..00000000 --- a/dist/models/Interaction.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.InteractionResponseType = exports.InteractionType = void 0; -var InteractionType; -(function (InteractionType) { - InteractionType[InteractionType["Ping"] = 1] = "Ping"; - InteractionType[InteractionType["ApplicationCommand"] = 2] = "ApplicationCommand"; -})(InteractionType = exports.InteractionType || (exports.InteractionType = {})); -var InteractionResponseType; -(function (InteractionResponseType) { - InteractionResponseType[InteractionResponseType["Pong"] = 1] = "Pong"; - InteractionResponseType[InteractionResponseType["Acknowledge"] = 2] = "Acknowledge"; - InteractionResponseType[InteractionResponseType["ChannelMessage"] = 3] = "ChannelMessage"; - InteractionResponseType[InteractionResponseType["ChannelMessageWithSource"] = 4] = "ChannelMessageWithSource"; - InteractionResponseType[InteractionResponseType["AcknowledgeWithSource"] = 5] = "AcknowledgeWithSource"; -})(InteractionResponseType = exports.InteractionResponseType || (exports.InteractionResponseType = {})); -//# sourceMappingURL=Interaction.js.map \ No newline at end of file diff --git a/dist/models/Interaction.js.map b/dist/models/Interaction.js.map deleted file mode 100644 index afdf9f9d..00000000 --- a/dist/models/Interaction.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Interaction.js","sourceRoot":"","sources":["../../src/models/Interaction.ts"],"names":[],"mappings":";;;AAaA,IAAY,eAGX;AAHD,WAAY,eAAe;IAC1B,qDAAQ,CAAA;IACR,iFAAsB,CAAA;AACvB,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AAED,IAAY,uBAMX;AAND,WAAY,uBAAuB;IAClC,qEAAQ,CAAA;IACR,mFAAe,CAAA;IACf,yFAAkB,CAAA;IAClB,6GAA4B,CAAA;IAC5B,uGAAyB,CAAA;AAC1B,CAAC,EANW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAMlC"} \ No newline at end of file diff --git a/dist/models/Invite.d.ts b/dist/models/Invite.d.ts deleted file mode 100644 index e6de64d3..00000000 --- a/dist/models/Invite.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { Schema, Document } from "mongoose"; -export interface Invite extends Document { - code: string; - temporary: boolean; - uses: number; - max_uses: number; - max_age: number; - created_at: Date; - guild_id: string; - channel_id: string; - inviter_id: string; - target_user_id?: string; - target_user_type?: number; -} -export declare const InviteSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const InviteModel: import("mongoose").Model<Invite>; diff --git a/dist/models/Invite.js b/dist/models/Invite.js deleted file mode 100644 index 9113abcc..00000000 --- a/dist/models/Invite.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.InviteModel = exports.InviteSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.InviteSchema = new mongoose_1.Schema({ - code: String, - temporary: Boolean, - uses: Number, - max_uses: Number, - max_age: Number, - created_at: Date, - guild_id: String, - channel_id: String, - inviter_id: String, - // ? What the fucking shit is this - target_user_id: String, - target_user_type: Number, -}); -// @ts-ignore -exports.InviteModel = Database_1.default.model("Invite", exports.InviteSchema, "invites"); -//# sourceMappingURL=Invite.js.map \ No newline at end of file diff --git a/dist/models/Invite.js.map b/dist/models/Invite.js.map deleted file mode 100644 index 3e69e1d1..00000000 --- a/dist/models/Invite.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Invite.js","sourceRoot":"","sources":["../../src/models/Invite.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAkBrB,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAElB,kCAAkC;IAClC,cAAc,EAAE,MAAM;IACtB,gBAAgB,EAAE,MAAM;CACxB,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,WAAW,GAAG,kBAAE,CAAC,KAAK,CAAS,QAAQ,EAAE,oBAAY,EAAE,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Member.d.ts b/dist/models/Member.d.ts deleted file mode 100644 index 26079e7c..00000000 --- a/dist/models/Member.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { PublicUser, User } from "./User"; -import { Schema, Document } from "mongoose"; -export interface Member { - id: string; - guild_id: string; - nick?: string; - roles: string[]; - joined_at: Date; - premium_since?: number; - deaf: boolean; - mute: boolean; - pending: boolean; - settings: UserGuildSettings; - user?: User; -} -export interface MemberDocument extends Member, Document { - id: string; -} -export interface UserGuildSettings { - channel_overrides: { - channel_id: string; - message_notifications: number; - mute_config: MuteConfig; - muted: boolean; - }[]; - message_notifications: number; - mobile_push: boolean; - mute_config: MuteConfig; - muted: boolean; - suppress_everyone: boolean; - suppress_roles: boolean; - version: number; -} -export interface MuteConfig { - end_time: number; - selected_time_window: number; -} -export declare const MemberSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const MemberModel: import("mongoose").Model<MemberDocument>; -export interface PublicMember extends Omit<Member, "settings" | "id"> { - user: PublicUser; -} diff --git a/dist/models/Member.js b/dist/models/Member.js deleted file mode 100644 index c7717dd2..00000000 --- a/dist/models/Member.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MemberModel = exports.MemberSchema = void 0; -const User_1 = require("./User"); -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -const MuteConfig = { - end_time: Number, - selected_time_window: Number, -}; -exports.MemberSchema = new mongoose_1.Schema({ - id: { type: String, required: true }, - guild_id: String, - nick: String, - roles: [String], - joined_at: Date, - premium_since: Number, - deaf: Boolean, - mute: Boolean, - pending: Boolean, - settings: { - channel_overrides: [ - { - channel_id: String, - message_notifications: Number, - mute_config: MuteConfig, - muted: Boolean, - }, - ], - message_notifications: Number, - mobile_push: Boolean, - mute_config: MuteConfig, - muted: Boolean, - suppress_everyone: Boolean, - suppress_roles: Boolean, - version: Number, - }, -}); -exports.MemberSchema.virtual("user", { - ref: User_1.UserModel, - localField: "id", - foreignField: "id", - justOne: true, -}); -// @ts-ignore -exports.MemberModel = Database_1.default.model("Member", exports.MemberSchema, "members"); -//# sourceMappingURL=Member.js.map \ No newline at end of file diff --git a/dist/models/Member.js.map b/dist/models/Member.js.map deleted file mode 100644 index c39e4bd1..00000000 --- a/dist/models/Member.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Member.js","sourceRoot":"","sources":["../../src/models/Member.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAqD;AACrD,uCAAmD;AACnD,gEAAkC;AAyClC,MAAM,UAAU,GAAG;IAClB,QAAQ,EAAE,MAAM;IAChB,oBAAoB,EAAE,MAAM;CAC5B,CAAC;AAEW,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpC,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,CAAC,MAAM,CAAC;IACf,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,MAAM;IACrB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE;QACT,iBAAiB,EAAE;YAClB;gBACC,UAAU,EAAE,MAAM;gBAClB,qBAAqB,EAAE,MAAM;gBAC7B,WAAW,EAAE,UAAU;gBACvB,KAAK,EAAE,OAAO;aACd;SACD;QACD,qBAAqB,EAAE,MAAM;QAC7B,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE,OAAO;QACd,iBAAiB,EAAE,OAAO;QAC1B,cAAc,EAAE,OAAO;QACvB,OAAO,EAAE,MAAM;KACf;CACD,CAAC,CAAC;AAEH,oBAAY,CAAC,OAAO,CAAC,MAAM,EAAE;IAC5B,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,WAAW,GAAG,kBAAE,CAAC,KAAK,CAAiB,QAAQ,EAAE,oBAAY,EAAE,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Message.d.ts b/dist/models/Message.d.ts deleted file mode 100644 index a629f7ee..00000000 --- a/dist/models/Message.d.ts +++ /dev/null @@ -1,181 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { Schema, Document } from "mongoose"; -export interface Message { - id: string; - channel_id: string; - guild_id?: string; - author_id?: string; - webhook_id?: string; - application_id?: string; - content?: string; - timestamp: Date; - edited_timestamp?: Date; - tts?: boolean; - mention_everyone?: boolean; - mention_user_ids: string[]; - mention_role_ids: string[]; - mention_channels_ids: string[]; - attachments: Attachment[]; - embeds: Embed[]; - reactions: Reaction[]; - nonce?: string | number; - pinned?: boolean; - type: MessageType; - activity?: { - type: number; - party_id: string; - }; - flags?: bigint; - stickers?: []; - message_reference?: { - message_id: string; - channel_id?: string; - guild_id?: string; - }; -} -export interface MessageDocument extends Document, Message { - id: string; -} -export declare enum MessageType { - DEFAULT = 0, - RECIPIENT_ADD = 1, - RECIPIENT_REMOVE = 2, - CALL = 3, - CHANNEL_NAME_CHANGE = 4, - CHANNEL_ICON_CHANGE = 5, - CHANNEL_PINNED_MESSAGE = 6, - GUILD_MEMBER_JOIN = 7, - USER_PREMIUM_GUILD_SUBSCRIPTION = 8, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11, - CHANNEL_FOLLOW_ADD = 12, - GUILD_DISCOVERY_DISQUALIFIED = 14, - GUILD_DISCOVERY_REQUALIFIED = 15, - REPLY = 19, - APPLICATION_COMMAND = 20 -} -export interface Attachment { - id: string; - filename: string; - size: number; - url: string; - proxy_url: string; - height: number; - width: number; -} -export interface Embed { - title?: string; - type?: string; - description?: string; - url?: string; - timestamp?: Date; - color?: number; - footer?: { - text: string; - icon_url?: string; - proxy_icon_url?: string; - }; - image?: EmbedImage; - thumbnail?: EmbedImage; - video?: EmbedImage; - provider?: { - name?: string; - url?: string; - }; - author?: { - name?: string; - url?: string; - icon_url?: string; - proxy_icon_url?: string; - }; - fields?: { - name: string; - value: string; - inline?: boolean; - }[]; -} -export interface EmbedImage { - url?: string; - proxy_url?: string; - height?: number; - width?: number; -} -export interface Reaction { - count: number; - emoji: PartialEmoji; -} -export interface PartialEmoji { - id?: string; - name: string; - animated?: boolean; -} -export interface AllowedMentions { - parse?: ("users" | "roles" | "everyone")[]; - roles?: string[]; - users?: string[]; - replied_user?: boolean; -} -export declare const Attachment: { - id: StringConstructor; - filename: StringConstructor; - size: NumberConstructor; - url: StringConstructor; - proxy_url: StringConstructor; - height: NumberConstructor; - width: NumberConstructor; -}; -export declare const EmbedImage: { - url: StringConstructor; - proxy_url: StringConstructor; - height: NumberConstructor; - width: NumberConstructor; -}; -export declare const Embed: { - title: StringConstructor; - type: StringConstructor; - description: StringConstructor; - url: StringConstructor; - timestamp: DateConstructor; - color: NumberConstructor; - footer: { - text: StringConstructor; - icon_url: StringConstructor; - proxy_icon_url: StringConstructor; - }; - image: { - url: StringConstructor; - proxy_url: StringConstructor; - height: NumberConstructor; - width: NumberConstructor; - }; - thumbnail: { - url: StringConstructor; - proxy_url: StringConstructor; - height: NumberConstructor; - width: NumberConstructor; - }; - video: { - url: StringConstructor; - proxy_url: StringConstructor; - height: NumberConstructor; - width: NumberConstructor; - }; - provider: { - name: StringConstructor; - url: StringConstructor; - }; - author: { - name: StringConstructor; - url: StringConstructor; - icon_url: StringConstructor; - proxy_icon_url: StringConstructor; - }; - fields: { - name: StringConstructor; - value: StringConstructor; - inline: BooleanConstructor; - }[]; -}; -export declare const MessageSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const MessageModel: import("mongoose").Model<MessageDocument>; diff --git a/dist/models/Message.js b/dist/models/Message.js deleted file mode 100644 index dfa22d42..00000000 --- a/dist/models/Message.js +++ /dev/null @@ -1,168 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MessageModel = exports.MessageSchema = exports.Embed = exports.EmbedImage = exports.Attachment = exports.MessageType = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -const User_1 = require("./User"); -const Member_1 = require("./Member"); -const Role_1 = require("./Role"); -var MessageType; -(function (MessageType) { - MessageType[MessageType["DEFAULT"] = 0] = "DEFAULT"; - MessageType[MessageType["RECIPIENT_ADD"] = 1] = "RECIPIENT_ADD"; - MessageType[MessageType["RECIPIENT_REMOVE"] = 2] = "RECIPIENT_REMOVE"; - MessageType[MessageType["CALL"] = 3] = "CALL"; - MessageType[MessageType["CHANNEL_NAME_CHANGE"] = 4] = "CHANNEL_NAME_CHANGE"; - MessageType[MessageType["CHANNEL_ICON_CHANGE"] = 5] = "CHANNEL_ICON_CHANGE"; - MessageType[MessageType["CHANNEL_PINNED_MESSAGE"] = 6] = "CHANNEL_PINNED_MESSAGE"; - MessageType[MessageType["GUILD_MEMBER_JOIN"] = 7] = "GUILD_MEMBER_JOIN"; - MessageType[MessageType["USER_PREMIUM_GUILD_SUBSCRIPTION"] = 8] = "USER_PREMIUM_GUILD_SUBSCRIPTION"; - MessageType[MessageType["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1"] = 9] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1"; - MessageType[MessageType["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2"] = 10] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2"; - MessageType[MessageType["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3"] = 11] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3"; - MessageType[MessageType["CHANNEL_FOLLOW_ADD"] = 12] = "CHANNEL_FOLLOW_ADD"; - MessageType[MessageType["GUILD_DISCOVERY_DISQUALIFIED"] = 14] = "GUILD_DISCOVERY_DISQUALIFIED"; - MessageType[MessageType["GUILD_DISCOVERY_REQUALIFIED"] = 15] = "GUILD_DISCOVERY_REQUALIFIED"; - MessageType[MessageType["REPLY"] = 19] = "REPLY"; - MessageType[MessageType["APPLICATION_COMMAND"] = 20] = "APPLICATION_COMMAND"; -})(MessageType = exports.MessageType || (exports.MessageType = {})); -exports.Attachment = { - id: String, - filename: String, - size: Number, - url: String, - proxy_url: String, - height: Number, - width: Number, -}; -exports.EmbedImage = { - url: String, - proxy_url: String, - height: Number, - width: Number, -}; -const Reaction = { - count: Number, - emoji: { - id: String, - name: String, - animated: Boolean, - }, -}; -exports.Embed = { - title: String, - type: String, - description: String, - url: String, - timestamp: Date, - color: Number, - footer: { - text: String, - icon_url: String, - proxy_icon_url: String, - }, - image: exports.EmbedImage, - thumbnail: exports.EmbedImage, - video: exports.EmbedImage, - provider: { - name: String, - url: String, - }, - author: { - name: String, - url: String, - icon_url: String, - proxy_icon_url: String, - }, - fields: [ - { - name: String, - value: String, - inline: Boolean, - }, - ], -}; -exports.MessageSchema = new mongoose_1.Schema({ - id: String, - channel_id: String, - author_id: String, - webhook_id: String, - guild_id: String, - application_id: String, - content: String, - timestamp: Date, - edited_timestamp: Date, - tts: Boolean, - mention_everyone: Boolean, - mention_user_ids: [String], - mention_role_ids: [String], - mention_channel_ids: [String], - attachments: [exports.Attachment], - embeds: [exports.Embed], - reactions: [Reaction], - nonce: mongoose_1.Schema.Types.Mixed, - pinned: Boolean, - type: { type: Number }, - activity: { - type: Number, - party_id: String, - }, - flags: mongoose_1.Types.Long, - stickers: [], - message_reference: { - message_id: String, - channel_id: String, - guild_id: String, - }, -}, { - toJSON: { - transform: function (doc, ret) { - delete ret.mention_channel_ids; - delete ret.mention_user_ids; - delete ret.mention_role_ids; - }, - }, -}); -exports.MessageSchema.virtual("author", { - ref: User_1.UserModel, - localField: "author_id", - foreignField: "id", - justOne: true, -}); -exports.MessageSchema.virtual("member", { - ref: Member_1.MemberModel, - localField: "author_id", - foreignField: "id", - justOne: true, -}); -exports.MessageSchema.virtual("mentions", { - ref: User_1.UserModel, - localField: "mention_user_ids", - foreignField: "id", - justOne: false, -}); -exports.MessageSchema.virtual("mention_roles", { - ref: Role_1.RoleModel, - localField: "mention_role_ids", - foreignField: "id", - justOne: false, -}); -exports.MessageSchema.virtual("mention_channels", { - ref: Role_1.RoleModel, - localField: "mention_channel_ids", - foreignField: "id", - justOne: false, -}); -// TODO: missing Application Model -// MessageSchema.virtual("application", { -// ref: Application, -// localField: "mention_role_ids", -// foreignField: "id", -// justOne: true, -// }); -// @ts-ignore -exports.MessageModel = Database_1.default.model("Message", exports.MessageSchema, "messages"); -//# sourceMappingURL=Message.js.map \ No newline at end of file diff --git a/dist/models/Message.js.map b/dist/models/Message.js.map deleted file mode 100644 index bb0f7b83..00000000 --- a/dist/models/Message.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../src/models/Message.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAClC,iCAAmC;AACnC,qCAAuC;AACvC,iCAAmC;AAwCnC,IAAY,WAkBX;AAlBD,WAAY,WAAW;IACtB,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100644 index d6765283..00000000 --- a/dist/models/Role.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { Schema, Document } from "mongoose"; -export interface Role { - id: string; - guild_id: string; - color: number; - hoist: boolean; - managed: boolean; - mentionable: boolean; - name: string; - permissions: bigint; - position: number; - tags?: { - bot_id?: string; - }; -} -export interface RoleDocument extends Document, Role { - id: string; -} -export declare const RoleSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const RoleModel: import("mongoose").Model<RoleDocument>; diff --git a/dist/models/Role.js b/dist/models/Role.js deleted file mode 100644 index 86c06db9..00000000 --- a/dist/models/Role.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.RoleModel = exports.RoleSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.RoleSchema = new mongoose_1.Schema({ - id: String, - guild_id: String, - color: Number, - hoist: Boolean, - managed: Boolean, - mentionable: Boolean, - name: String, - permissions: mongoose_1.Types.Long, - position: Number, - tags: { - bot_id: String, - }, -}); -// @ts-ignore -exports.RoleModel = Database_1.default.model("Role", exports.RoleSchema, "roles"); -//# sourceMappingURL=Role.js.map \ No newline at end of file diff --git a/dist/models/Role.js.map b/dist/models/Role.js.map deleted file mode 100644 index 87872154..00000000 --- a/dist/models/Role.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Role.js","sourceRoot":"","sources":["../../src/models/Role.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAqBrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,gBAAK,CAAC,IAAI;IACvB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE;QACL,MAAM,EAAE,MAAM;KACd;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Status.d.ts b/dist/models/Status.d.ts deleted file mode 100644 index 424a16b2..00000000 --- a/dist/models/Status.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export declare type Status = "idle" | "dnd" | "online" | "offline"; -export interface ClientStatus { - desktop?: string; - mobile?: string; - web?: string; -} -export declare const ClientStatus: { - desktop: StringConstructor; - mobile: StringConstructor; - web: StringConstructor; -}; diff --git a/dist/models/Status.js b/dist/models/Status.js deleted file mode 100644 index 992d9cae..00000000 --- a/dist/models/Status.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClientStatus = void 0; -exports.ClientStatus = { - desktop: String, - mobile: String, - web: String, -}; -//# sourceMappingURL=Status.js.map \ No newline at end of file diff --git a/dist/models/Status.js.map b/dist/models/Status.js.map deleted file mode 100644 index 1d5d65f7..00000000 --- a/dist/models/Status.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Status.js","sourceRoot":"","sources":["../../src/models/Status.ts"],"names":[],"mappings":";;;AAQa,QAAA,YAAY,GAAG;IAC3B,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,MAAM;IACd,GAAG,EAAE,MAAM;CACX,CAAC"} \ No newline at end of file diff --git a/dist/models/User.d.ts b/dist/models/User.d.ts deleted file mode 100644 index b5ecf123..00000000 --- a/dist/models/User.d.ts +++ /dev/null @@ -1,113 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { Activity } from "./Activity"; -import { ClientStatus, Status } from "./Status"; -import { Schema, Document } from "mongoose"; -export interface User { - id: string; - username: string; - discriminator: string; - avatar: string | null; - phone?: string; - desktop: boolean; - mobile: boolean; - premium: boolean; - premium_type: number; - bot: boolean; - system: boolean; - nsfw_allowed: boolean; - mfa_enabled: boolean; - created_at: Date; - verified: boolean; - email?: string; - flags: bigint; - public_flags: bigint; - user_settings: UserSettings; - guilds: string[]; - user_data: UserData; - presence: { - status: Status; - activities: Activity[]; - client_status: ClientStatus; - }; -} -export interface UserData { - valid_tokens_since: Date; - relationships: Relationship[]; - connected_accounts: ConnectedAccount[]; - hash: string; - fingerprints: string[]; -} -export interface UserDocument extends User, Document { - id: string; -} -export interface PublicUser { - id: string; - discriminator: string; - username: string; - avatar?: string; - public_flags: bigint; -} -export interface ConnectedAccount { - access_token: string; - friend_sync: boolean; - id: string; - name: string; - revoked: boolean; - show_activity: boolean; - type: string; - verifie: boolean; - visibility: number; -} -export interface Relationship { - id: string; - nickname?: string; - type: number; - user_id: string; -} -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: string | 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; - }; - gateway_connected: boolean; - gif_auto_play: boolean; - guild_folders: { - color: number; - guild_ids: string[]; - id: number; - name: string; - }[]; - guild_positions: string[]; - 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: string[]; - show_current_game: boolean; - status: "online" | "offline" | "dnd" | "idle"; - stream_notifications_enabled: boolean; - theme: "dark" | "white"; - timezone_offset: number; -} -export declare const UserSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const UserModel: import("mongoose").Model<UserDocument>; diff --git a/dist/models/User.js b/dist/models/User.js deleted file mode 100644 index e8caec6a..00000000 --- a/dist/models/User.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.UserModel = exports.UserSchema = void 0; -const Activity_1 = require("./Activity"); -const Status_1 = require("./Status"); -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.UserSchema = new mongoose_1.Schema({ - id: String, - username: String, - discriminator: String, - avatar: String, - phone: String, - desktop: Boolean, - mobile: Boolean, - premium: Boolean, - premium_type: Number, - bot: Boolean, - system: Boolean, - nsfw_allowed: Boolean, - mfa_enabled: Boolean, - created_at: Date, - verified: Boolean, - email: String, - flags: mongoose_1.Types.Long, - public_flags: mongoose_1.Types.Long, - guilds: [String], - user_data: { - fingerprints: [String], - hash: String, - valid_tokens_since: Date, - relationships: [ - { - id: String, - nickname: String, - type: Number, - user_id: String, - }, - ], - connected_accounts: [ - { - access_token: String, - friend_sync: Boolean, - id: String, - name: String, - revoked: Boolean, - show_activity: Boolean, - type: String, - verifie: Boolean, - visibility: Number, - }, - ], - }, - user_settings: { - afk_timeout: Number, - allow_accessibility_detection: Boolean, - animate_emoji: Boolean, - animate_stickers: Number, - contact_sync_enabled: Boolean, - convert_emoticons: Boolean, - custom_status: { - emoji_id: String, - emoji_name: String, - expires_at: Number, - text: String, - }, - 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 }, - gateway_connected: Boolean, - gif_auto_play: Boolean, - // every top guild is displayed as a "folder" - guild_folders: [ - { - color: Number, - guild_ids: [String], - id: Number, - name: String, - }, - ], - guild_positions: [String], - 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: [String], - show_current_game: Boolean, - status: String, - stream_notifications_enabled: Boolean, - theme: String, - timezone_offset: Number, - }, - presence: { - status: String, - activities: [Activity_1.Activity], - client_status: Status_1.ClientStatus, - }, -}); -// @ts-ignore -exports.UserModel = Database_1.default.model("User", exports.UserSchema, "users"); -//# sourceMappingURL=User.js.map \ No newline at end of file diff --git a/dist/models/User.js.map b/dist/models/User.js.map deleted file mode 100644 index fa26f77a..00000000 --- a/dist/models/User.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AACtC,qCAAgD;AAChD,uCAAmD;AACnD,gEAAkC;AAoHrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,OAAO;IAChB,YAAY,EAAE,MAAM;IACpB,GAAG,EAAE,OAAO;IACZ,MAAM,EAAE,OAAO;IACf,YAAY,EAAE,OAAO;IACrB,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,gBAAK,CAAC,IAAI;IACjB,YAAY,EAAE,gBAAK,CAAC,IAAI;IACxB,MAAM,EAAE,CAAC,MAAM,CAAC;IAChB,SAAS,EAAE;QACV,YAAY,EAAE,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM;QACZ,kBAAkB,EAAE,IAAI;QACxB,aAAa,EAAE;YACd;gBACC,EAAE,EAAE,MAAM;gBACV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Aa,EAAE,OAAO;QACtB,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,CAAC,MAAM,CAAC;QAC3B,iBAAiB,EAAE,OAAO;QAC1B,MAAM,EAAE,MAAM;QACd,4BAA4B,EAAE,OAAO;QACrC,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;KACvB;IAED,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,CAAC,mBAAQ,CAAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/VoiceState.d.ts b/dist/models/VoiceState.d.ts deleted file mode 100644 index cf0fa523..00000000 --- a/dist/models/VoiceState.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// <reference path="../util/MongoBigInt.d.ts" /> -import { Schema, Document } from "mongoose"; -export interface VoiceState extends Document { - guild_id?: string; - channel_id: string; - user_id: string; - session_id: string; - deaf: boolean; - mute: boolean; - self_deaf: boolean; - self_mute: boolean; - self_stream?: boolean; - self_video: boolean; - suppress: boolean; -} -export declare const VoiceSateSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const VoiceStateModel: import("mongoose").Model<VoiceState>; diff --git a/dist/models/VoiceState.js b/dist/models/VoiceState.js deleted file mode 100644 index d96a5ad4..00000000 --- a/dist/models/VoiceState.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VoiceStateModel = exports.VoiceSateSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.VoiceSateSchema = new mongoose_1.Schema({ - guild_id: String, - channel_id: String, - user_id: String, - session_id: String, - deaf: Boolean, - mute: Boolean, - self_deaf: Boolean, - self_mute: Boolean, - self_stream: Boolean, - self_video: Boolean, - suppress: Boolean, -}); -// @ts-ignore -exports.VoiceStateModel = Database_1.default.model("VoiceState", exports.VoiceSateSchema, "voicestates"); -//# sourceMappingURL=VoiceState.js.map \ No newline at end of file diff --git a/dist/models/VoiceState.js.map b/dist/models/VoiceState.js.map deleted file mode 100644 index 1e7905d8..00000000 --- a/dist/models/VoiceState.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"VoiceState.js","sourceRoot":"","sources":["../../src/models/VoiceState.ts"],"names":[],"mappings":";;;;;;AACA,uCAA0D;AAC1D,gEAAkC;AAgBrB,QAAA,eAAe,GAAG,IAAI,iBAAM,CAAC;IACzC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,OAAO;IAClB,SAAS,EAAE,OAAO;IAClB,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE,OAAO;IACnB,QAAQ,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,eAAe,GAAG,kBAAE,CAAC,KAAK,CAAa,YAAY,EAAE,uBAAe,EAAE,aAAa,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/util/BitField.d.ts b/dist/util/BitField.d.ts deleted file mode 100644 index 1b08c1f8..00000000 --- a/dist/util/BitField.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -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; -} diff --git a/dist/util/BitField.js b/dist/util/BitField.js deleted file mode 100644 index 46b101ef..00000000 --- a/dist/util/BitField.js +++ /dev/null @@ -1,133 +0,0 @@ -"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.call(this, bits); - } - /** - * Checks whether the bitfield has a bit, or any of multiple bits. - */ - any(bit) { - return (this.bitfield & BitField.resolve.call(this, bit)) !== 0n; - } - /** - * Checks if this bitfield equals another - */ - equals(bit) { - return this.bitfield === BitField.resolve.call(this, 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.call(this, 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.call(this, 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.call(this, 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) { - // @ts-ignore - const FLAGS = this.FLAGS || this.constructor?.FLAGS; - if ((typeof bit === "number" || typeof bit === "bigint") && bit >= 0n) - return BigInt(bit); - if (bit instanceof BitField) - return bit.bitfield; - if (Array.isArray(bit)) { - // @ts-ignore - const resolve = this.constructor?.resolve || this.resolve; - return bit.map((p) => resolve(p)).reduce((prev, p) => BigInt(prev) | BigInt(p), 0n); - } - if (typeof bit === "string" && typeof FLAGS[bit] !== "undefined") - return FLAGS[bit]; - throw new RangeError("BITFIELD_INVALID: " + bit); - } -} -exports.BitField = BitField; -BitField.FLAGS = {}; -//# sourceMappingURL=BitField.js.map \ No newline at end of file diff --git a/dist/util/BitField.js.map b/dist/util/BitField.js.map deleted file mode 100644 index 7a783db7..00000000 --- a/dist/util/BitField.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"BitField.js","sourceRoot":"","sources":["../../src/util/BitField.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAOb;;GAEG;AACH,MAAa,QAAQ;IAKpB,YAAY,OAA2B,CAAC;QAJjC,aAAQ,GAAW,MAAM,CAAC,CAAC,CAAC,CAAC;QAKnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,GAAuB;QAC1B,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,GAAuB;QAC7B,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,GAAuB;QAC1B,IAAI,KAAK,CAAC,OAAO,CAAC,GAA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AK,QAAQ,CAAC,IAAI,GAAG,IAAI,EAAE;YAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1F,IAAI,GAAG,YAAY,QAAQ;YAAE,OAAO,GAAG,CAAC,QAAQ,CAAC;QACjD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACvB,aAAa;YACb,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;YAC1D,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACpF;QACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,WAAW;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;QACpF,MAAM,IAAI,UAAU,CAAC,oBAAoB,GAAG,GAAG,CAAC,CAAC;IAClD,CAAC;;AAnIF,4BAoIC;AAjIc,cAAK,GAA2B,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/util/Config.d.ts b/dist/util/Config.d.ts deleted file mode 100644 index efab99c2..00000000 --- a/dist/util/Config.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// <reference path="MongoBigInt.d.ts" /> -import { Schema, Document } from "mongoose"; -import "missing-native-js-functions"; -declare const _default: { - init: (defaultOpts?: any) => Promise<import("mongodb").UpdateWriteOpResult>; - getAll: () => DefaultOptions; - setAll: (val: any) => Promise<import("mongodb").UpdateWriteOpResult>; -}; -export default _default; -export declare const DefaultOptions: { - api: {}; - gateway: {}; - voice: {}; -}; -export interface DefaultOptions extends Document { - api?: any; - gateway?: any; - voice?: any; -} -export declare const ConfigSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>; -export declare const ConfigModel: import("mongoose").Model<DefaultOptions>; diff --git a/dist/util/Config.js b/dist/util/Config.js deleted file mode 100644 index e2aaa7be..00000000 --- a/dist/util/Config.js +++ /dev/null @@ -1,50 +0,0 @@ -"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; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConfigModel = exports.ConfigSchema = exports.DefaultOptions = void 0; -const mongoose_1 = require("mongoose"); -require("missing-native-js-functions"); -const Database_1 = __importStar(require("./Database")); -var Config = new Database_1.MongooseCache(Database_1.default.collection("config"), [], { onlyEvents: false }); -exports.default = { - init: async function init(defaultOpts = exports.DefaultOptions) { - await Config.init(); - return this.setAll(Config.data.merge(defaultOpts)); - }, - getAll: function get() { - return Config.data; - }, - setAll: function set(val) { - return Database_1.default.collection("config").updateOne({}, { $set: val }, { upsert: true }); - }, -}; -exports.DefaultOptions = { - api: {}, - gateway: {}, - voice: {}, -}; -exports.ConfigSchema = new mongoose_1.Schema({ - api: Object, - gateway: Object, - voice: Object, -}); -exports.ConfigModel = mongoose_1.model("Config", exports.ConfigSchema, "config"); -//# sourceMappingURL=Config.js.map \ No newline at end of file diff --git a/dist/util/Config.js.map b/dist/util/Config.js.map deleted file mode 100644 index 71297a97..00000000 --- a/dist/util/Config.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/util/Config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA0D;AAC1D,uCAAqC;AACrC,uDAA+C;AAE/C,IAAI,MAAM,GAAG,IAAI,wBAAa,CAAC,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AAEnF,kBAAe;IACd,IAAI,EAAE,KAAK,UAAU,IAAI,CAAC,cAAmB,sBAAc;QAC1D,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,EAAE,SAAS,GAAG;QACnB,OAAuB,MAAM,CAAC,IAAI,CAAC;IACpC,CAAC;IACD,MAAM,EAAE,SAAS,GAAG,CAAC,GAAQ;QAC5B,OAAO,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;CACD,CAAC;AAEW,QAAA,cAAc,GAAG;IAC7B,GAAG,EAAE,EAAE;IACP,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE;CACT,CAAC;AAQW,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,MAAM;CACb,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,gBAAK,CAAiB,QAAQ,EAAE,oBAAY,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/util/Constants.d.ts b/dist/util/Constants.d.ts deleted file mode 100644 index ecceb4e6..00000000 --- a/dist/util/Constants.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { VerifyOptions } from "jsonwebtoken"; -export declare const JWTOptions: VerifyOptions; diff --git a/dist/util/Constants.js b/dist/util/Constants.js deleted file mode 100644 index d65f8185..00000000 --- a/dist/util/Constants.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.JWTOptions = void 0; -exports.JWTOptions = { algorithms: ["HS256"] }; -//# sourceMappingURL=Constants.js.map \ No newline at end of file diff --git a/dist/util/Constants.js.map b/dist/util/Constants.js.map deleted file mode 100644 index cf06fd23..00000000 --- a/dist/util/Constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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"} \ No newline at end of file diff --git a/dist/util/Database.d.ts b/dist/util/Database.d.ts deleted file mode 100644 index 766efaef..00000000 --- a/dist/util/Database.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// <reference types="node" /> -import "./MongoBigInt"; -import mongoose, { Collection } from "mongoose"; -import { ChangeStream, ChangeEvent } from "mongodb"; -import EventEmitter from "events"; -declare const _default: mongoose.Connection; -export default _default; -export interface MongooseCache { - on(event: "delete", listener: (id: string) => void): this; - on(event: "change", listener: (data: any) => void): this; - on(event: "insert", listener: (data: any) => void): this; - on(event: "close", listener: () => void): this; -} -export declare class MongooseCache extends EventEmitter { - collection: Collection; - pipeline: Array<Record<string, unknown>>; - opts: { - onlyEvents: boolean; - }; - stream: ChangeStream; - data: any; - constructor(collection: Collection, pipeline: Array<Record<string, unknown>>, opts: { - onlyEvents: boolean; - }); - init: () => Promise<void>; - convertResult: (obj: any) => any; - change: (doc: ChangeEvent) => boolean | Promise<any> | undefined; - destroy: () => Promise<any> | undefined; -} diff --git a/dist/util/Database.js b/dist/util/Database.js deleted file mode 100644 index b80fd835..00000000 --- a/dist/util/Database.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MongooseCache = void 0; -require("./MongoBigInt"); -const mongoose_1 = __importDefault(require("mongoose")); -const mongodb_1 = require("mongodb"); -const events_1 = __importDefault(require("events")); -const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPreference=secondaryPreferred"; -console.log(`[DB] connect: ${uri}`); -const connection = mongoose_1.default.createConnection(uri, { autoIndex: true }); -exports.default = connection; -class MongooseCache extends events_1.default { - constructor(collection, pipeline, opts) { - super(); - this.collection = collection; - this.pipeline = pipeline; - this.opts = opts; - this.init = async () => { - this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" }); - this.stream.on("change", this.change); - this.stream.on("close", this.destroy); - this.stream.on("error", console.error); - if (!this.opts.onlyEvents) { - const arr = await this.collection.aggregate(this.pipeline).toArray(); - this.data = arr.length ? arr[0] : arr; - } - }; - this.convertResult = (obj) => { - if (obj instanceof mongodb_1.Long) - return BigInt(obj.toString()); - if (typeof obj === "object") { - Object.keys(obj).forEach((key) => { - obj[key] = this.convertResult(obj[key]); - }); - } - return obj; - }; - this.change = (doc) => { - try { - // @ts-ignore - if (doc.fullDocument) { - // @ts-ignore - if (!this.opts.onlyEvents) - this.data = doc.fullDocument; - } - switch (doc.operationType) { - case "dropDatabase": - return this.destroy(); - case "drop": - return this.destroy(); - case "delete": - return this.emit("delete", doc.documentKey._id.toHexString()); - case "insert": - return this.emit("insert", doc.fullDocument); - case "update": - case "replace": - return this.emit("change", doc.fullDocument); - case "invalidate": - return this.destroy(); - default: - return; - } - } - catch (error) { - this.emit("error", error); - } - }; - this.destroy = () => { - this.stream?.off("change", this.change); - this.emit("close"); - if (this.stream.isClosed()) - return; - return this.stream.close(); - }; - } -} -exports.MongooseCache = MongooseCache; -//# sourceMappingURL=Database.js.map \ No newline at end of file diff --git a/dist/util/Database.js.map b/dist/util/Database.js.map deleted file mode 100644 index 348182a0..00000000 --- a/dist/util/Database.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../src/util/Database.ts"],"names":[],"mappings":";;;;;;AAAA,yBAAuB;AACvB,wDAA4D;AAC5D,qCAA0D;AAC1D,oDAAkC;AAClC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,sEAAsE,CAAC;AAE5G,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC;AAEpC,MAAM,UAAU,GAAG,kBAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvE,kBAA2B,UAAU,CAAC;AAStC,MAAa,aAAc,SAAQ,gBAAY;IAI9C,YACQ,UAAsB,EACtB,QAAwC,EACxC,IAEN;QAED,KAAK,EAAE,CAAC;QAND,eAAU,GAAV,UAAU,CAAY;QACtB,aAAQ,GAAR,QAAQ,CAAgC;QACxC,SAAI,GAAJ,IAAI,CAEV;QAKF,SAAI,GAAG,KAAK,IAAI,EAAE;YACjB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC,CAAC;YAErF,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;YAEvC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBAC1B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Q;wBACZ,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC9C,KAAK,QAAQ,CAAC;oBACd,KAAK,SAAS;wBACb,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC9C,KAAK,YAAY;wBAChB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;oBACvB;wBACC,OAAO;iBACR;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;aAC1B;QACF,CAAC,CAAC;QAEF,YAAO,GAAG,GAAG,EAAE;YACd,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEnB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAAE,OAAO;YAEnC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC,CAAC;IA/DF,CAAC;CAgED;AA5ED,sCA4EC"} \ No newline at end of file diff --git a/dist/util/Intents.d.ts b/dist/util/Intents.d.ts deleted file mode 100644 index bf8bac90..00000000 --- a/dist/util/Intents.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -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; - }; -} diff --git a/dist/util/Intents.js b/dist/util/Intents.js deleted file mode 100644 index 5a7baa8c..00000000 --- a/dist/util/Intents.js +++ /dev/null @@ -1,25 +0,0 @@ -"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 \ No newline at end of file diff --git a/dist/util/Intents.js.map b/dist/util/Intents.js.map deleted file mode 100644 index 7250c839..00000000 --- a/dist/util/Intents.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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"} \ No newline at end of file diff --git a/dist/util/MessageFlags.d.ts b/dist/util/MessageFlags.d.ts deleted file mode 100644 index 9a0a8e40..00000000 --- a/dist/util/MessageFlags.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -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; - }; -} diff --git a/dist/util/MessageFlags.js b/dist/util/MessageFlags.js deleted file mode 100644 index bdfed0fe..00000000 --- a/dist/util/MessageFlags.js +++ /dev/null @@ -1,17 +0,0 @@ -"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 \ No newline at end of file diff --git a/dist/util/MessageFlags.js.map b/dist/util/MessageFlags.js.map deleted file mode 100644 index 3aad5ea1..00000000 --- a/dist/util/MessageFlags.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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"} \ No newline at end of file diff --git a/dist/util/MongoBigInt.d.ts b/dist/util/MongoBigInt.d.ts deleted file mode 100644 index a809f8c4..00000000 --- a/dist/util/MongoBigInt.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import mongoose from "mongoose"; -declare class LongSchema extends mongoose.SchemaType { - $conditionalHandlers: { - $lt: (val: any) => any; - $lte: (val: any) => any; - $gt: (val: any) => any; - $gte: (val: any) => any; - $ne: (val: any) => any; - $in: (val: any) => any; - $nin: (val: any) => any; - $mod: (val: any) => any; - $all: (val: any) => any; - $bitsAnySet: (val: any) => any; - $bitsAllSet: (val: any) => any; - }; - handleSingle(val: any): any; - handleArray(val: any): any; - checkRequired(val: any): boolean; - cast(val: any, scope?: any, init?: any, type?: string): any; - castForQuery($conditional: string, value: any): any; -} -declare module "mongoose" { - namespace Types { - class Long extends mongoose.mongo.Long { - } - } - namespace Schema { - namespace Types { - class Long extends LongSchema { - } - } - } -} -export {}; diff --git a/dist/util/MongoBigInt.js b/dist/util/MongoBigInt.js deleted file mode 100644 index 3e04fac4..00000000 --- a/dist/util/MongoBigInt.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const mongoose_1 = __importDefault(require("mongoose")); -class LongSchema extends mongoose_1.default.SchemaType { - constructor() { - super(...arguments); - this.$conditionalHandlers = { - $lt: this.handleSingle, - $lte: this.handleSingle, - $gt: this.handleSingle, - $gte: this.handleSingle, - $ne: this.handleSingle, - $in: this.handleArray, - $nin: this.handleArray, - $mod: this.handleArray, - $all: this.handleArray, - $bitsAnySet: this.handleArray, - $bitsAllSet: this.handleArray, - }; - } - handleSingle(val) { - return this.cast(val, null, null, "handle"); - } - handleArray(val) { - var self = this; - return val.map(function (m) { - return self.cast(m, null, null, "handle"); - }); - } - checkRequired(val) { - return null != val; - } - cast(val, scope, init, type) { - if (null === val) - return val; - if ("" === val) - return null; - if (typeof val === "bigint") { - return mongoose_1.default.mongo.Long.fromString(val.toString()); - } - if (val instanceof mongoose_1.default.mongo.Long) { - if (type === "handle" || init == false) - return val; - return BigInt(val.toString()); - } - if (val instanceof Number || "number" == typeof val) - return BigInt(val); - if (!Array.isArray(val) && val.toString) - return BigInt(val.toString()); - // @ts-ignore - throw new SchemaType.CastError("Long", val); - } - castForQuery($conditional, value) { - var handler; - if (2 === arguments.length) { - // @ts-ignore - handler = this.$conditionalHandlers[$conditional]; - if (!handler) { - throw new Error("Can't use " + $conditional + " with Long."); - } - return handler.call(this, value); - } - else { - return this.cast($conditional, null, null, "query"); - } - } -} -LongSchema.cast = mongoose_1.default.SchemaType.cast; -LongSchema.set = mongoose_1.default.SchemaType.set; -LongSchema.get = mongoose_1.default.SchemaType.get; -mongoose_1.default.Schema.Types.Long = LongSchema; -mongoose_1.default.Types.Long = mongoose_1.default.mongo.Long; -//# sourceMappingURL=MongoBigInt.js.map \ No newline at end of file diff --git a/dist/util/MongoBigInt.js.map b/dist/util/MongoBigInt.js.map deleted file mode 100644 index 962b0454..00000000 --- a/dist/util/MongoBigInt.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MongoBigInt.js","sourceRoot":"","sources":["../../src/util/MongoBigInt.ts"],"names":[],"mappings":";;;;;AAAA,wDAAgC;A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BAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;AAazC,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AACxC,kBAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,kBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC"} \ No newline at end of file diff --git a/dist/util/Permissions.d.ts b/dist/util/Permissions.d.ts deleted file mode 100644 index 19135666..00000000 --- a/dist/util/Permissions.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { MemberDocument } from "../models/Member"; -import { ChannelDocument } from "../models/Channel"; -import { ChannelPermissionOverwrite } from "../models/Channel"; -import { Role } from "../models/Role"; -import { BitField } from "./BitField"; -export declare type PermissionResolvable = bigint | number | Permissions | PermissionResolvable[] | PermissionString; -declare type PermissionString = "CREATE_INSTANT_INVITE" | "KICK_MEMBERS" | "BAN_MEMBERS" | "ADMINISTRATOR" | "MANAGE_CHANNELS" | "MANAGE_GUILD" | "ADD_REACTIONS" | "VIEW_AUDIT_LOG" | "PRIORITY_SPEAKER" | "STREAM" | "VIEW_CHANNEL" | "SEND_MESSAGES" | "SEND_TTS_MESSAGES" | "MANAGE_MESSAGES" | "EMBED_LINKS" | "ATTACH_FILES" | "READ_MESSAGE_HISTORY" | "MENTION_EVERYONE" | "USE_EXTERNAL_EMOJIS" | "VIEW_GUILD_INSIGHTS" | "CONNECT" | "SPEAK" | "MUTE_MEMBERS" | "DEAFEN_MEMBERS" | "MOVE_MEMBERS" | "USE_VAD" | "CHANGE_NICKNAME" | "MANAGE_NICKNAMES" | "MANAGE_ROLES" | "MANAGE_WEBHOOKS" | "MANAGE_EMOJIS"; -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. - */ - has(permission: PermissionResolvable, checkAdmin?: boolean): boolean; - static channelPermission(overwrites: ChannelPermissionOverwrite[], init?: bigint): bigint; - static rolePermission(roles: Role[]): bigint; - static finalPermission({ user, guild, channel, }: { - user: { - id: string; - roles: string[]; - }; - guild: { - roles: Role[]; - }; - channel?: { - overwrites?: ChannelPermissionOverwrite[]; - }; - }): bigint; -} -export declare function getPermission(user_id: string, guild_id: string, channel_id?: string, cache?: { - channel?: ChannelDocument | null; - member?: MemberDocument | null; -}): Promise<Permissions>; -export {}; diff --git a/dist/util/Permissions.js b/dist/util/Permissions.js deleted file mode 100644 index c170f3f9..00000000 --- a/dist/util/Permissions.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getPermission = exports.Permissions = void 0; -// https://github.com/discordjs/discord.js/blob/master/src/util/Permissions.js -// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah -const Member_1 = require("../models/Member"); -const Channel_1 = require("../models/Channel"); -const Role_1 = require("../models/Role"); -const BitField_1 = require("./BitField"); -const Guild_1 = require("../models/Guild"); -const CUSTOM_PERMISSION_OFFSET = 1n << 48n; // 16 free custom permission bits, and 16 for discord to add new ones -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. - */ - has(permission, checkAdmin = true) { - return (checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.has(permission); - } - static channelPermission(overwrites, init) { - // TODO: do not deny any permissions if admin - return overwrites.reduce((permission, overwrite) => { - // apply disallowed permission - // * permission: current calculated permission (e.g. 010) - // * deny contains all denied permissions (e.g. 011) - // * allow contains all explicitly allowed permisions (e.g. 100) - return (permission & ~overwrite.deny) | overwrite.allow; - // ~ operator inverts deny (e.g. 011 -> 100) - // & operator only allows 1 for both ~deny and permission (e.g. 010 & 100 -> 000) - // | operators adds both together (e.g. 000 + 100 -> 100) - }, 0n ?? init); - } - static rolePermission(roles) { - // adds all permissions of all roles together (Bit OR) - return roles.reduce((permission, role) => permission | role.permissions, 0n); - } - static finalPermission({ user, guild, channel, }) { - let roles = guild.roles.filter((x) => user.roles.includes(x.id)); - let permission = Permissions.rolePermission(roles); - if (channel?.overwrites) { - let overwrites = channel.overwrites.filter((x) => { - if (x.type === 0 && user.roles.includes(x.id)) - return true; - if (x.type === 1 && x.id == user.id) - return true; - return false; - }); - permission = Permissions.channelPermission(overwrites, permission); - } - return 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, -}; -async function getPermission(user_id, guild_id, channel_id, cache) { - var { channel, member } = cache || {}; - const guild = await Guild_1.GuildModel.findOne({ id: guild_id }, { owner_id: true }).exec(); - if (!guild) - throw new Error("Guild not found"); - if (guild.owner_id === user_id) - return new Permissions(Permissions.FLAGS.ADMINISTRATOR); - member = await Member_1.MemberModel.findOne({ guild_id, id: user_id }, "roles").exec(); - if (!member) - throw new Error("Member not found"); - var roles = await Role_1.RoleModel.find({ guild_id, id: { $in: member.roles } }) - .lean() - .exec(); - if (channel_id) { - channel = await Channel_1.ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec(); - } - var permission = Permissions.finalPermission({ - user: { - id: user_id, - roles: member.roles, - }, - guild: { - roles: roles, - }, - channel: { - overwrites: channel?.permission_overwrites, - }, - }); - return new Permissions(permission); -} -exports.getPermission = getPermission; -//# sourceMappingURL=Permissions.js.map \ No newline at end of file diff --git a/dist/util/Permissions.js.map b/dist/util/Permissions.js.map deleted file mode 100644 index 14774970..00000000 --- a/dist/util/Permissions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Permissions.js","sourceRoot":"","sources":["../../src/util/Permissions.ts"],"names":[],"mappings":";;;AAAA,8EAA8E;AAC9E,8DA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AAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAExF,MAAM,GAAG,MAAM,oBAAW,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9E,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEjD,IAAI,KAAK,GAAG,MAAM,gBAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;SACvE,IAAI,EAAE;SACN,IAAI,EAAE,CAAC;IACT,IAAI,UAAU,EAAE;QACf,OAAO,GAAG,MAAM,sBAAY,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,uBAAuB,CAAC,CAAC,IAAI,EAAE,CAAC;KACzF;IAED,IAAI,UAAU,GAAG,WAAW,CAAC,eAAe,CAAC;QAC5C,IAAI,EAAE;YACL,EAAE,EAAE,OAAO;YACX,KAAK,EAAE,MAAM,CAAC,KAAK;SACnB;QACD,KAAK,EAAE;YACN,KAAK,EAAE,KAAK;SACZ;QACD,OAAO,EAAE;YACR,UAAU,EAAE,OAAO,EAAE,qBAAqB;SAC1C;KACD,CAAC,CAAC;IAEH,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC;AApCD,sCAoCC"} \ No newline at end of file diff --git a/dist/util/Snowflake.d.ts b/dist/util/Snowflake.d.ts deleted file mode 100644 index 06e98492..00000000 --- a/dist/util/Snowflake.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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(): string; - /** - * 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; - }; -} diff --git a/dist/util/Snowflake.js b/dist/util/Snowflake.js deleted file mode 100644 index 1217b0c8..00000000 --- a/dist/util/Snowflake.js +++ /dev/null @@ -1,116 +0,0 @@ -// @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).toString(); - } - /** - * 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 \ No newline at end of file diff --git a/dist/util/Snowflake.js.map b/dist/util/Snowflake.js.map deleted file mode 100644 index df2df3f6..00000000 --- a/dist/util/Snowflake.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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;g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AAC;IACZ,CAAC;;AAjHF,8BAkHC;AAjHgB,eAAK,GAAG,aAAa,CAAC;AAC/B,mBAAS,GAAG,EAAE,CAAC,CAAC,WAAW;AAC3B,mBAAS,GAAG,EAAE,CAAC,CAAC,SAAS;AACzB,kBAAQ,GAAG,EAAE,CAAC,CAAC,SAAS"} \ No newline at end of file diff --git a/dist/util/String.d.ts b/dist/util/String.d.ts deleted file mode 100644 index 0ec4281e..00000000 --- a/dist/util/String.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare const DOUBLE_WHITE_SPACE: RegExp; -export declare const SPECIAL_CHAR: RegExp; -export declare function trimSpecial(str: string): string; diff --git a/dist/util/String.js b/dist/util/String.js deleted file mode 100644 index 712328ef..00000000 --- a/dist/util/String.js +++ /dev/null @@ -1,10 +0,0 @@ -"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 \ No newline at end of file diff --git a/dist/util/String.js.map b/dist/util/String.js.map deleted file mode 100644 index 83644ad9..00000000 --- a/dist/util/String.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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"} \ No newline at end of file diff --git a/dist/util/UserFlags.d.ts b/dist/util/UserFlags.d.ts deleted file mode 100644 index b721d61c..00000000 --- a/dist/util/UserFlags.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -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; - }; -} diff --git a/dist/util/UserFlags.js b/dist/util/UserFlags.js deleted file mode 100644 index 4df3f232..00000000 --- a/dist/util/UserFlags.js +++ /dev/null @@ -1,25 +0,0 @@ -"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 \ No newline at end of file diff --git a/dist/util/UserFlags.js.map b/dist/util/UserFlags.js.map deleted file mode 100644 index 997bd6da..00000000 --- a/dist/util/UserFlags.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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"} \ No newline at end of file diff --git a/dist/util/checkToken.d.ts b/dist/util/checkToken.d.ts deleted file mode 100644 index f8dcbe12..00000000 --- a/dist/util/checkToken.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function checkToken(token: string): Promise<any>; diff --git a/dist/util/checkToken.js b/dist/util/checkToken.js deleted file mode 100644 index 17d88178..00000000 --- a/dist/util/checkToken.js +++ /dev/null @@ -1,20 +0,0 @@ -"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 \ No newline at end of file diff --git a/dist/util/checkToken.js.map b/dist/util/checkToken.js.map deleted file mode 100644 index 173dd43d..00000000 --- a/dist/util/checkToken.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4e40ede6..0e721c0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,8 @@ "jsonwebtoken": "^8.5.1", "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2", - "mongodb": "^3.6.4" + "mongodb": "^3.6.6", + "mongoose": "^5.12.3" }, "devDependencies": { "@types/jsonwebtoken": "^8.5.0", @@ -562,14 +563,14 @@ } }, "node_modules/mongodb": { - "version": "3.6.4", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz", - "integrity": "sha512-Y+Ki9iXE9jI+n9bVtbTOOdK0B95d6wVGSucwtBkvQ+HIvVdTCfpVRp01FDC24uhC/Q2WXQ8Lpq3/zwtB5Op9Qw==", + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", + "integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==", "dependencies": { "bl": "^2.2.1", "bson": "^1.1.4", "denque": "^1.4.1", - "require_optional": "^1.0.1", + "optional-require": "^1.0.2", "safe-buffer": "^5.1.2", "saslprep": "^1.0.0" }, @@ -674,17 +675,17 @@ } }, "node_modules/mongoose": { - "version": "5.11.15", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.11.15.tgz", - "integrity": "sha512-8T4bT6eCGB7MqCm40oVhnhT/1AyAdwe+y1rYUhdl3ljsks3BpYz8whZgcMkIoh6VoCCjipOXRqZqdk1UByvlYA==", + "version": "5.12.3", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.3.tgz", + "integrity": "sha512-frsSR9yeldaRpSUeTegXCSB0Tu5UGq8sHuHBuEV31Jk3COyxlKFQPL7UsdMhxPUCmk74FpOYSmNwxhWBEqgzQg==", "dependencies": { "@types/mongodb": "^3.5.27", "bson": "^1.1.4", "kareem": "2.3.2", - "mongodb": "3.6.3", + "mongodb": "3.6.5", "mongoose-legacy-pluralize": "1.0.2", "mpath": "0.8.3", - "mquery": "3.2.3", + "mquery": "3.2.5", "ms": "2.1.2", "regexp-clone": "1.0.0", "safe-buffer": "5.2.1", @@ -708,9 +709,9 @@ } }, "node_modules/mongoose/node_modules/mongodb": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.3.tgz", - "integrity": "sha512-rOZuR0QkodZiM+UbQE5kDsJykBqWi0CL4Ec2i1nrGrUI3KO11r6Fbxskqmq3JK2NH7aW4dcccBuUujAP0ERl5w==", + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", + "integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==", "dependencies": { "bl": "^2.2.1", "bson": "^1.1.4", @@ -755,9 +756,9 @@ } }, "node_modules/mquery": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.3.tgz", - "integrity": "sha512-cIfbP4TyMYX+SkaQ2MntD+F2XbqaBHUYWk3j+kqdDztPWok3tgyssOZxMHMtzbV1w9DaSlvEea0Iocuro41A4g==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.5.tgz", + "integrity": "sha512-VjOKHHgU84wij7IUoZzFRU07IAxd5kWJaDmyUzQlbjHjyoeK5TNeeo8ZsFDtTYnSgpW6n/nMNIHvE3u8Lbrf4A==", "dependencies": { "bluebird": "3.5.1", "debug": "3.1.0", @@ -800,6 +801,14 @@ "wrappy": "1" } }, + "node_modules/optional-require": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz", + "integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg==", + "engines": { + "node": ">=4" + } + }, "node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -1544,14 +1553,14 @@ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" }, "mongodb": { - "version": "3.6.4", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz", - "integrity": "sha512-Y+Ki9iXE9jI+n9bVtbTOOdK0B95d6wVGSucwtBkvQ+HIvVdTCfpVRp01FDC24uhC/Q2WXQ8Lpq3/zwtB5Op9Qw==", + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", + "integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==", "requires": { "bl": "^2.2.1", "bson": "^1.1.4", "denque": "^1.4.1", - "require_optional": "^1.0.1", + "optional-require": "^1.0.2", "safe-buffer": "^5.1.2", "saslprep": "^1.0.0" } @@ -1613,17 +1622,17 @@ } }, "mongoose": { - "version": "5.11.15", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.11.15.tgz", - "integrity": "sha512-8T4bT6eCGB7MqCm40oVhnhT/1AyAdwe+y1rYUhdl3ljsks3BpYz8whZgcMkIoh6VoCCjipOXRqZqdk1UByvlYA==", + "version": "5.12.3", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.3.tgz", + "integrity": "sha512-frsSR9yeldaRpSUeTegXCSB0Tu5UGq8sHuHBuEV31Jk3COyxlKFQPL7UsdMhxPUCmk74FpOYSmNwxhWBEqgzQg==", "requires": { "@types/mongodb": "^3.5.27", "bson": "^1.1.4", "kareem": "2.3.2", - "mongodb": "3.6.3", + "mongodb": "3.6.5", "mongoose-legacy-pluralize": "1.0.2", "mpath": "0.8.3", - "mquery": "3.2.3", + "mquery": "3.2.5", "ms": "2.1.2", "regexp-clone": "1.0.0", "safe-buffer": "5.2.1", @@ -1632,9 +1641,9 @@ }, "dependencies": { "mongodb": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.3.tgz", - "integrity": "sha512-rOZuR0QkodZiM+UbQE5kDsJykBqWi0CL4Ec2i1nrGrUI3KO11r6Fbxskqmq3JK2NH7aW4dcccBuUujAP0ERl5w==", + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", + "integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==", "requires": { "bl": "^2.2.1", "bson": "^1.1.4", @@ -1658,9 +1667,9 @@ "integrity": "sha512-eb9rRvhDltXVNL6Fxd2zM9D4vKBxjVVQNLNijlj7uoXUy19zNDsIif5zR+pWmPCWNKwAtqyo4JveQm4nfD5+eA==" }, "mquery": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.3.tgz", - "integrity": "sha512-cIfbP4TyMYX+SkaQ2MntD+F2XbqaBHUYWk3j+kqdDztPWok3tgyssOZxMHMtzbV1w9DaSlvEea0Iocuro41A4g==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.5.tgz", + "integrity": "sha512-VjOKHHgU84wij7IUoZzFRU07IAxd5kWJaDmyUzQlbjHjyoeK5TNeeo8ZsFDtTYnSgpW6n/nMNIHvE3u8Lbrf4A==", "requires": { "bluebird": "3.5.1", "debug": "3.1.0", @@ -1702,6 +1711,11 @@ "wrappy": "1" } }, + "optional-require": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz", + "integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg==" + }, "p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", diff --git a/package.json b/package.json index 4e2b4c1e..7900d301 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "jsonwebtoken": "^8.5.1", "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2", - "mongodb": "^3.6.4" + "mongodb": "^3.6.6", + "mongoose": "^5.12.3" }, "devDependencies": { "@types/jsonwebtoken": "^8.5.0", diff --git a/src/util/Database.ts b/src/util/Database.ts index fee3cc31..883c8dcd 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -6,7 +6,7 @@ const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPre console.log(`[DB] connect: ${uri}`); -const connection = mongoose.createConnection(uri, { autoIndex: true }); +const connection = mongoose.createConnection(uri, { autoIndex: true, useNewUrlParser: true, useUnifiedTopology: true }); export default <Connection>connection; @@ -32,6 +32,7 @@ export class MongooseCache extends EventEmitter { } init = async () => { + // @ts-ignore this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" }); this.stream.on("change", this.change); diff --git a/tsconfig.json b/tsconfig.json index 6cc2a681..520774d3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "include": ["src"], + "include": ["src/**/*.ts"], "compilerOptions": { /* Visit https://aka.ms/tsconfig.json to read more about this file */ |