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/LICENSE b/LICENSE index 5c3f22a6..425b12be 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,98 @@ -MIT License +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License -Copyright (c) 2021 Discord Open Source +Copyright (c) 2021 Fosscord -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +Section 1 – Definitions. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. +Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. +BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License. +Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. +Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. +Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. +License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike. +Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. +Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. +Licensor means the individual(s) or entity(ies) granting rights under this Public License. +NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. +Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. +Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. +You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. +Section 2 – Scope. + +License grant. +Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: +reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and +produce, reproduce, and Share Adapted Material for NonCommercial purposes only. +Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. +Term. The term of this Public License is specified in Section 6(a). +Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. +Downstream recipients. +Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. +Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply. +No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. +No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). +Other rights. + +Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. +Patent and trademark rights are not licensed under this Public License. +To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + +Attribution. + +If You Share the Licensed Material (including in modified form), You must: + +retain the following if it is supplied by the Licensor with the Licensed Material: +identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); +a copyright notice; +a notice that refers to this Public License; +a notice that refers to the disclaimer of warranties; +a URI or hyperlink to the Licensed Material to the extent reasonably practicable; +indicate if You modified the Licensed Material and retain an indication of any previous modifications; and +indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. +You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. +If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. +ShareAlike. +In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. + +The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License. +You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. +You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + +for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only; +if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and +You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. +Section 5 – Disclaimer of Warranties and Limitation of Liability. + +Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. +To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. +The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. +Section 6 – Term and Termination. + +This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. +Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + +automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or +upon express reinstatement by the Licensor. +For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. +For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. +Sections 1, 5, 6, 7, and 8 survive termination of this Public License. +Section 7 – Other Terms and Conditions. + +The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. +Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. +Section 8 – Interpretation. + +For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. +To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. +No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. +Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. 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 df0761b1..00000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -export * from "./util/checkToken"; -export * as Constants from "./util/Constants"; -export * from "./models/Ban"; -export * from "./models/Channel"; -export * from "./models/Emoji"; -export * from "./models/Guild"; -export * from "./models/Invite"; -export * from "./models/Member"; -export * from "./models/Role"; -export * from "./models/User"; -export * from "./models/Activity"; -export * from "./models/Application"; -export * from "./models/Interaction"; -export * from "./models/Message"; -export * from "./models/Status"; -export * from "./models/VoiceState"; -export * from "./util/String"; -export * from "./util/BitField"; -export * from "./util/Intents"; -export * from "./util/MessageFlags"; -export * from "./util/Permissions"; -export * from "./util/Snowflake"; -export * from "./util/UserFlags"; -export * from "./models/Event"; -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 99f66d3d..00000000 --- a/dist/index.js +++ /dev/null @@ -1,56 +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/Ban"), exports); -__exportStar(require("./models/Channel"), exports); -__exportStar(require("./models/Emoji"), exports); -__exportStar(require("./models/Guild"), exports); -__exportStar(require("./models/Invite"), exports); -__exportStar(require("./models/Member"), exports); -__exportStar(require("./models/Role"), exports); -__exportStar(require("./models/User"), exports); -__exportStar(require("./models/Activity"), exports); -__exportStar(require("./models/Application"), exports); -__exportStar(require("./models/Interaction"), exports); -__exportStar(require("./models/Message"), exports); -__exportStar(require("./models/Status"), exports); -__exportStar(require("./models/VoiceState"), exports); -__exportStar(require("./util/String"), exports); -__exportStar(require("./util/BitField"), exports); -__exportStar(require("./util/Intents"), exports); -__exportStar(require("./util/MessageFlags"), exports); -__exportStar(require("./util/Permissions"), exports); -__exportStar(require("./util/Snowflake"), exports); -__exportStar(require("./util/UserFlags"), exports); -__exportStar(require("./models/Event"), 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 7db4514c..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,+CAA6B;AAC7B,mDAAiC;AACjC,iDAA+B;AAC/B,iDAA+B;AAC/B,kDAAgC;AAChC,kDAAgC;AAChC,gDAA8B;AAC9B,gDAA8B;AAC9B,oDAAkC;AAClC,uDAAqC;AACrC,uDAAqC;AACrC,mDAAiC;AACjC,kDAAgC;AAChC,sDAAoC;AAEpC,gDAA8B;AAC9B,kDAAgC;AAChC,iDAA+B;AAC/B,sDAAoC;AACpC,qDAAmC;AACnC,mDAAiC;AACjC,mDAAiC;AACjC,iDAA+B;AAE/B,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 6a97a871..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?: bigint; - 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?: bigint; - details?: string; - state?: string; - emoji?: { - name: string; - id?: bigint; - 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: typeof Types.Long; - details: StringConstructor; - state: StringConstructor; - emoji: { - name: StringConstructor; - id: typeof Types.Long; - 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 fe85ac65..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: mongoose_1.Types.Long, - details: String, - state: String, - emoji: { - name: String, - id: mongoose_1.Types.Long, - 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 c27ae387..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,GAAG,EAAE,MAAM;IACX,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE;QACX;YACC,KAAK,EAAE,MAAM;YACb,GAAG,EAAE,MAAM;SACX;KACD;IACD,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,MAAM;IACb,KAAK,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,gBAAK,CAAC,IAAI;QACd,QAAQ,EAAE,OAAO;KACjB;IACD,KAAK,EAAE;QACN,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;KACtB;IACD,MAAM,EAAE;QACP,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,MAAM;KAClB;IACD,OAAO,EAAE;QACR,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,MAAM;KACb;IACD,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,gBAAK,CAAC,IAAI;CACjB,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 53483c49..00000000 --- a/dist/models/Application.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export interface ApplicationCommand { - id: bigint; - application_id: bigint; - 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: bigint; - 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 902513a3..00000000 --- a/dist/models/AuditLog.d.ts +++ /dev/null @@ -1,187 +0,0 @@ -/// -import { Schema, Document, Types } 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?: bigint; - user_id: bigint; - id: bigint; - action_type: AuditLogEvents; - options?: { - delete_member_days?: string; - members_removed?: string; - channel_id?: bigint; - messaged_id?: bigint; - count?: string; - id?: bigint; - 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?: bigint; - region?: string; - preferred_locale?: string; - afk_channel_id?: bigint; - afk_timeout?: number; - rules_channel_id?: bigint; - public_updates_channel_id?: bigint; - 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?: bigint; - system_channel_id?: bigint; - position?: number; - topic?: string; - bitrate?: number; - permission_overwrites?: ChannelPermissionOverwrite[]; - nsfw?: boolean; - application_id?: bigint; - rate_limit_per_user?: number; - permissions?: string; - color?: number; - hoist?: boolean; - mentionable?: boolean; - allow?: string; - deny?: string; - code?: string; - channel_id?: bigint; - inviter_id?: bigint; - max_uses?: number; - uses?: number; - max_age?: number; - temporary?: boolean; - deaf?: boolean; - mute?: boolean; - nick?: string; - avatar_hash?: string; - id?: bigint; - type?: number; - enable_emoticons?: boolean; - expire_behavior?: number; - expire_grace_period?: number; - user_limit?: number; -} -export interface AuditLogEntriesDocument extends Document, AuditLogEntries { - id: bigint; -} -export declare const AuditLogChanges: { - name: StringConstructor; - description: StringConstructor; - icon_hash: StringConstructor; - splash_hash: StringConstructor; - discovery_splash_hash: StringConstructor; - banner_hash: StringConstructor; - owner_id: typeof Types.Long; - region: StringConstructor; - preferred_locale: StringConstructor; - afk_channel_id: typeof Types.Long; - afk_timeout: NumberConstructor; - rules_channel_id: typeof Types.Long; - public_updates_channel_id: typeof Types.Long; - 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: typeof Types.Long; - system_channel_id: typeof Types.Long; - position: NumberConstructor; - topic: StringConstructor; - bitrate: NumberConstructor; - permission_overwrites: {}[]; - nsfw: BooleanConstructor; - application_id: typeof Types.Long; - rate_limit_per_user: NumberConstructor; - permissions: StringConstructor; - color: NumberConstructor; - hoist: BooleanConstructor; - mentionable: BooleanConstructor; - allow: StringConstructor; - deny: StringConstructor; - code: StringConstructor; - channel_id: typeof Types.Long; - inviter_id: typeof Types.Long; - max_uses: NumberConstructor; - uses: NumberConstructor; - max_age: NumberConstructor; - temporary: BooleanConstructor; - deaf: BooleanConstructor; - mute: BooleanConstructor; - nick: StringConstructor; - avatar_hash: StringConstructor; - id: typeof Types.Long; - type: NumberConstructor; - enable_emoticons: BooleanConstructor; - expire_behavior: NumberConstructor; - expire_grace_period: NumberConstructor; - user_limit: NumberConstructor; -}; -export declare const AuditLogSchema: Schema, import("mongoose").Model>, undefined>; -export declare const AuditLogModel: import("mongoose").Model; -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 53df5c30..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: mongoose_1.Types.Long, - region: String, - preferred_locale: String, - afk_channel_id: mongoose_1.Types.Long, - afk_timeout: Number, - rules_channel_id: mongoose_1.Types.Long, - public_updates_channel_id: mongoose_1.Types.Long, - 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: mongoose_1.Types.Long, - system_channel_id: mongoose_1.Types.Long, - position: Number, - topic: String, - bitrate: Number, - permission_overwrites: [{}], - nsfw: Boolean, - application_id: mongoose_1.Types.Long, - rate_limit_per_user: Number, - permissions: String, - color: Number, - hoist: Boolean, - mentionable: Boolean, - allow: String, - deny: String, - code: String, - channel_id: mongoose_1.Types.Long, - inviter_id: mongoose_1.Types.Long, - max_uses: Number, - uses: Number, - max_age: Number, - temporary: Boolean, - deaf: Boolean, - mute: Boolean, - nick: String, - avatar_hash: String, - id: mongoose_1.Types.Long, - type: Number, - enable_emoticons: Boolean, - expire_behavior: Number, - expire_grace_period: Number, - user_limit: Number, -}; -exports.AuditLogSchema = new mongoose_1.Schema({ - target_id: mongoose_1.Types.Long, - user_id: { type: mongoose_1.Types.Long, required: true }, - id: { type: mongoose_1.Types.Long, required: true }, - action_type: { type: Number, required: true }, - options: { - delete_member_days: String, - members_removed: String, - channel_id: mongoose_1.Types.Long, - messaged_id: mongoose_1.Types.Long, - count: String, - id: mongoose_1.Types.Long, - 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 b809fa3d..00000000 --- a/dist/models/AuditLog.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AuditLog.js","sourceRoot":"","sources":["../../src/models/AuditLog.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAiGrB,QAAA,eAAe,GAAG;IAC9B,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,MAAM;IACnB,qBAAqB,EAAE,MAAM;IAC7B,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,MAAM;IACxB,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,WAAW,EAAE,MAAM;IACnB,gBAAgB,EAAE,gBAAK,CAAC,IAAI;IAC5B,yBAAyB,EAAE,gBAAK,CAAC,IAAI;IACrC,SAAS,EAAE,MAAM;IACjB,kBAAkB,EAAE,MAAM;IAC1B,uBAAuB,EAAE,MAAM;IAC/B,6BAA6B,EAAE,MAAM;IACrC,eAAe,EAAE,MAAM;IACvB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,iBAAiB,EAAE,MAAM;IACzB,cAAc,EAAE,OAAO;IACvB,iBAAiB,EAAE,gBAAK,CAAC,IAAI;IAC7B,iBAAiB,EAAE,gBAAK,CAAC,IAAI;IAC7B,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,MAAM;IACf,qBAAqB,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAI,EAAE,OAAO;IACb,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,mBAAmB,EAAE,MAAM;IAC3B,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,OAAO;IACpB,KAA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;AAEH,aAAa;AACA,QAAA,aAAa,GAAG,kBAAE,CAAC,KAAK,CAAkB,UAAU,EAAE,sBAAc,EAAE,WAAW,CAAC,CAAC;AAEhG,IAAY,cAoCX;AApCD,WAAY,cAAc;IACzB,mEAAgB,CAAA;IAChB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,4FAA6B,CAAA;IAC7B,4FAA6B,CAAA;IAC7B,4FAA6B,CAAA;IAC7B,kEAAgB,CAAA;IAChB,oEAAiB,CAAA;IACjB,wEAAmB,CAAA;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 a4357d5c..00000000 --- a/dist/models/Ban.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface Ban extends Document { - user_id: bigint; - guild_id: bigint; - executor_id: bigint; - ip: string; - reason?: string; -} -export declare const BanSchema: Schema, import("mongoose").Model>, undefined>; -export declare const BanModel: import("mongoose").Model; diff --git a/dist/models/Ban.js b/dist/models/Ban.js deleted file mode 100644 index abb0a4e2..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: mongoose_1.Types.Long, required: true }, - guild_id: { type: mongoose_1.Types.Long, required: true }, - executor_id: { type: mongoose_1.Types.Long, 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 580002a0..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,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC7C,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC9C,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACjD,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 5cd7b342..00000000 --- a/dist/models/Channel.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel { -} -export interface ChannelDocument extends Document, AnyChannel { - id: bigint; -} -export declare const ChannelSchema: Schema, import("mongoose").Model>, undefined>; -export declare const ChannelModel: import("mongoose").Model; -export interface Channel { - id: bigint; - created_at: Date; - name: string; - type: number; -} -export interface TextBasedChannel { - last_message_id?: bigint; - last_pin_timestamp?: number; -} -export interface GuildChannel extends Channel { - guild_id: bigint; - position: number; - parent_id?: bigint; - permission_overwrites: ChannelPermissionOverwrite[]; -} -export interface ChannelPermissionOverwrite { - allow: bigint; - deny: bigint; - id: bigint; - 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: bigint; - recipients: bigint[]; -} -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 0c9a652a..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: mongoose_1.Types.Long, - created_at: { type: mongoose_1.Schema.Types.Date, required: true }, - name: { type: String, required: true }, - type: { type: Number, required: true }, - guild_id: mongoose_1.Types.Long, - owner_id: mongoose_1.Types.Long, - parent_id: mongoose_1.Types.Long, - recipients: [mongoose_1.Types.Long], - position: Number, - last_message_id: mongoose_1.Types.Long, - 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: mongoose_1.Types.Long, - 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 845169ac..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,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AAA;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 91c1abfe..00000000 --- a/dist/models/Emoji.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface Emoji extends Document { - id: bigint; - animated: boolean; - available: boolean; - guild_id: bigint; - managed: boolean; - name: string; - require_colons: boolean; - url: string; - roles: bigint[]; -} -export declare const EmojiSchema: Schema, import("mongoose").Model>, undefined>; -export declare const EmojiModel: import("mongoose").Model; diff --git a/dist/models/Emoji.js b/dist/models/Emoji.js deleted file mode 100644 index 79f2543f..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: mongoose_1.Types.Long, required: true }, - animated: Boolean, - available: Boolean, - guild_id: mongoose_1.Types.Long, - managed: Boolean, - name: String, - require_colons: Boolean, - url: String, - roles: [mongoose_1.Types.Long], -}); -// @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 76e2fd4d..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,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,OAAO;IACvB,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;CACnB,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 eabde08a..00000000 --- a/dist/models/Event.d.ts +++ /dev/null @@ -1,357 +0,0 @@ -/// -import { ConnectedAccount, User, UserSettings } from "./User"; -import { DMChannel, Channel } from "./Channel"; -import { Guild } from "./Guild"; -import { 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?: bigint; - user_id?: bigint; - channel_id?: bigint; - created_at?: Date; - event: EVENT; - data?: any; -} -export interface EventDocument extends Event, Document { -} -export declare const EventSchema: Schema, import("mongoose").Model>, undefined>; -export declare const EventModel: import("mongoose").Model; -export interface InvalidatedEvent extends Event { - event: "INVALIDATED"; -} -export interface ReadyEvent extends Event { - event: "READY"; - data: { - v: number; - user: Omit; - 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?: []; - user_guild_settings?: { - entries: UserGuildSettings[]; - version: number; - partial: boolean; - }; - application?: { - id: bigint; - flags: bigint; - }; - merged_members?: PublicMember[][]; - users?: { - avatar?: string; - discriminator: string; - id: bigint; - username: string; - bot: boolean; - public_flags: bigint; - }[]; - }; -} -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?: bigint; - channel_id: bigint; - 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: bigint; - unavailable?: boolean; - }; -} -export interface GuildBanAddEvent extends Event { - event: "GUILD_BAN_ADD"; - data: { - guild_id: bigint; - user: User; - }; -} -export interface GuildBanRemoveEvent extends Event { - event: "GUILD_BAN_REMOVE"; - data: { - guild_id: bigint; - user: User; - }; -} -export interface GuildEmojiUpdateEvent extends Event { - event: "GUILD_EMOJI_UPDATE"; - data: { - guild_id: bigint; - emojis: Emoji[]; - }; -} -export interface GuildIntegrationUpdateEvent extends Event { - event: "GUILD_INTEGRATIONS_UPDATE"; - data: { - guild_id: bigint; - }; -} -export interface GuildMemberAddEvent extends Event { - event: "GUILD_MEMBER_ADD"; - data: PublicMember & { - guild_id: bigint; - }; -} -export interface GuildMemberRemoveEvent extends Event { - event: "GUILD_MEMBER_REMOVE"; - data: { - guild_id: bigint; - user: User; - }; -} -export interface GuildMemberUpdateEvent extends Event { - event: "GUILD_MEMBER_UPDATE"; - data: { - guild_id: bigint; - roles: bigint[]; - user: User; - nick?: string; - joined_at: Date; - premium_since?: number; - pending?: boolean; - }; -} -export interface GuildMembersChunkEvent extends Event { - event: "GUILD_MEMBERS_CHUNK"; - data: { - guild_id: bigint; - members: PublicMember[]; - chunk_index: number; - chunk_count: number; - not_found: bigint[]; - presences: Presence[]; - nonce?: string; - }; -} -export interface GuildRoleCreateEvent extends Event { - event: "GUILD_ROLE_CREATE"; - data: { - guild_id: bigint; - role: Role; - }; -} -export interface GuildRoleUpdateEvent extends Event { - event: "GUILD_ROLE_UPDATE"; - data: { - guild_id: bigint; - role: Role; - }; -} -export interface GuildRoleDeleteEvent extends Event { - event: "GUILD_ROLE_DELETE"; - data: { - guild_id: bigint; - role_id: bigint; - }; -} -export interface InviteCreateEvent extends Event { - event: "INVITE_CREATE"; - data: Omit & { - channel_id: bigint; - guild_id?: bigint; - }; -} -export interface InviteDeleteEvent extends Event { - event: "INVITE_DELETE"; - data: { - channel_id: bigint; - guild_id?: bigint; - code: string; - }; -} -export declare type MessagePayload = Omit & { - channel_id: bigint; - guild_id?: bigint; - 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: bigint; - channel_id: bigint; - guild_id?: bigint; - }; -} -export interface MessageDeleteBulkEvent extends Event { - event: "MESSAGE_DELETE_BULK"; - data: { - ids: bigint[]; - channel_id: bigint; - guild_id?: bigint; - }; -} -export interface MessageReactionAddEvent extends Event { - event: "MESSAGE_REACTION_ADD"; - data: { - user_id: bigint; - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; - member?: PublicMember; - emoji: PartialEmoji; - }; -} -export interface MessageReactionRemoveEvent extends Event { - event: "MESSAGE_REACTION_REMOVE"; - data: { - user_id: bigint; - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; - emoji: PartialEmoji; - }; -} -export interface MessageReactionRemoveAllEvent extends Event { - event: "MESSAGE_REACTION_REMOVE_ALL"; - data: { - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; - }; -} -export interface MessageReactionRemoveEmojiEvent extends Event { - event: "MESSAGE_REACTION_REMOVE_EMOJI"; - data: { - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; - emoji: PartialEmoji; - }; -} -export interface PresenceUpdateEvent extends Event { - event: "PRESENCE_UPDATE"; - data: Presence; -} -export interface TypingStartEvent extends Event { - event: "TYPING_START"; - data: { - channel_id: bigint; - user_id: bigint; - timestamp: number; - guild_id?: bigint; - 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: bigint; - endpoint: string; - }; -} -export interface WebhooksUpdateEvent extends Event { - event: "WEBHOOKS_UPDATE"; - data: { - guild_id: bigint; - channel_id: bigint; - }; -} -export declare type ApplicationCommandPayload = ApplicationCommand & { - guild_id: bigint; -}; -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 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 76ba96ff..00000000 --- a/dist/models/Event.js +++ /dev/null @@ -1,19 +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.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: mongoose_1.Types.Long, - user_id: mongoose_1.Types.Long, - channel_id: mongoose_1.Types.Long, - 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"); -//# 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 7a096d42..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,gBAAK,CAAC,IAAI;IACpB,OAAO,EAAE,gBAAK,CAAC,IAAI;IACnB,UAAU,EAAE,gBAAK,CAAC,IAAI;IACtB,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"} \ 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 7ea96716..00000000 --- a/dist/models/Guild.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface GuildDocument extends Document, Guild { - id: bigint; -} -export interface Guild { - id: bigint; - afk_channel_id?: bigint; - afk_timeout?: number; - application_id?: bigint; - 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: bigint; - preferred_locale?: string; - premium_subscription_count?: number; - premium_tier?: number; - public_updates_channel_id?: bigint; - region?: string; - rules_channel_id?: bigint; - splash?: string; - system_channel_flags?: number; - system_channel_id?: bigint; - unavailable?: boolean; - vanity_url_code?: string; - verification_level?: number; - welcome_screen: []; - widget_channel_id?: bigint; - widget_enabled?: boolean; -} -export declare const GuildSchema: Schema, import("mongoose").Model>, undefined>; -export declare const GuildModel: import("mongoose").Model; diff --git a/dist/models/Guild.js b/dist/models/Guild.js deleted file mode 100644 index a2d0d114..00000000 --- a/dist/models/Guild.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.GuildModel = exports.GuildSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.GuildSchema = new mongoose_1.Schema({ - id: { type: mongoose_1.Types.Long, required: true }, - afk_channel_id: mongoose_1.Types.Long, - afk_timeout: Number, - application_id: mongoose_1.Types.Long, - 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: mongoose_1.Types.Long, required: true }, - preferred_locale: String, - premium_subscription_count: Number, - premium_tier: Number, - public_updates_channel_id: mongoose_1.Types.Long, - region: String, - rules_channel_id: mongoose_1.Types.Long, - splash: String, - system_channel_flags: Number, - system_channel_id: mongoose_1.Types.Long, - unavailable: Boolean, - vanity_url_code: String, - verification_level: Number, - voice_states: { type: [Object], default: [] }, - welcome_screen: { type: [Object], default: [] }, - widget_channel_id: mongoose_1.Types.Long, - widget_enabled: Boolean, -}); -// GuildSchema.virtual -// @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 580db503..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;AAiDrB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,WAAW,EAAE,MAAM;IACnB,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,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,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;IACtD,YAAY,EAAE,MAAM;IACpB,cAAc,EAAE,MAAM;IACtB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC9C,gBAAgB,EAAE,MAAM;IACxB,0BAA0B,EAAE,MAAM;IAClC,YAAY,EAAE,MAAM;IACpB,yBAAyB,EAAE,gBAAK,CAAC,IAAI;IACrC,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,gBAAK,CAAC,IAAI;IAC5B,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,MAAM;IAC5B,iBAAiB,EAAE,gBAAK,CAAC,IAAI;IAC7B,WAAW,EAAE,OAAO;IACpB,eAAe,EAAE,MAAM;IACvB,kBAAkB,EAAE,MAAM;IAC1B,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAC7C,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAC/C,iBAAiB,EAAE,gBAAK,CAAC,IAAI;IAC7B,cAAc,EAAE,OAAO;CACvB,CAAC,CAAC;AAEH,sBAAsB;AAEtB,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 df03b8a9..00000000 --- a/dist/models/Interaction.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { AllowedMentions, Embed } from "./Message"; -export interface Interaction { - id: bigint; - type: InteractionType; - data?: {}; - guild_id: bigint; - channel_id: bigint; - member_id: bigint; - 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 a151322b..00000000 --- a/dist/models/Invite.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// -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: bigint; - channel_id: bigint; - inviter_id: bigint; - target_user_id?: bigint; - target_user_type?: number; -} -export declare const InviteSchema: Schema, import("mongoose").Model>, undefined>; -export declare const InviteModel: import("mongoose").Model; diff --git a/dist/models/Invite.js b/dist/models/Invite.js deleted file mode 100644 index 31d21278..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: mongoose_1.Types.Long, - channel_id: mongoose_1.Types.Long, - inviter_id: mongoose_1.Types.Long, - //! What the fucking shit is this - target_user_id: mongoose_1.Types.Long, - 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 3b25219f..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;AAmBrB,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,gBAAK,CAAC,IAAI;IACpB,UAAU,EAAE,gBAAK,CAAC,IAAI;IACtB,UAAU,EAAE,gBAAK,CAAC,IAAI;IAEtB,iCAAiC;IACjC,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,gBAAgB,EAAE,MAAM;CAExB,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 bf930613..00000000 --- a/dist/models/Member.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// -import { PublicUser, User } from "./User"; -import { Schema, Document } from "mongoose"; -export interface Member { - id: bigint; - guild_id: bigint; - nick?: string; - roles: bigint[]; - joined_at: Date; - premium_since?: number; - deaf: boolean; - mute: boolean; - pending: boolean; - settings: UserGuildSettings; - user?: User; -} -export interface MemberDocument extends Member, Document { - id: bigint; -} -export interface UserGuildSettings { - channel_overrides: { - channel_id: bigint; - 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, import("mongoose").Model>, undefined>; -export declare const MemberModel: import("mongoose").Model; -export interface PublicMember extends Omit { - user: PublicUser; -} diff --git a/dist/models/Member.js b/dist/models/Member.js deleted file mode 100644 index 26a728f0..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: mongoose_1.Types.Long, required: true }, - guild_id: mongoose_1.Types.Long, - nick: String, - roles: [mongoose_1.Types.Long], - joined_at: Date, - premium_since: Number, - deaf: Boolean, - mute: Boolean, - pending: Boolean, - settings: { - channel_overrides: [ - { - channel_id: mongoose_1.Types.Long, - 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 aa0bae9b..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,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;IACnB,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,gBAAK,CAAC,IAAI;gBACtB,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 403e84c3..00000000 --- a/dist/models/Message.d.ts +++ /dev/null @@ -1,181 +0,0 @@ -/// -import { Schema, Types, Document } from "mongoose"; -export interface Message { - id: bigint; - channel_id: bigint; - guild_id?: bigint; - author_id?: bigint; - webhook_id?: bigint; - application_id: bigint; - content: string; - timestamp: number; - edited_timestamp: number; - tts: boolean; - mention_everyone: boolean; - mention_user_ids: bigint[]; - mention_role_ids: bigint[]; - mention_channels_ids: bigint[]; - 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: bigint; - channel_id?: bigint; - guild_id?: bigint; - }; -} -export interface MessageDocument extends Document, Message { - id: bigint; -} -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: bigint; - 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?: number; - 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?: bigint; - name: string; - animated?: boolean; -} -export interface AllowedMentions { - parse?: ("users" | "roles" | "everyone")[]; - roles?: bigint[]; - users?: bigint[]; - replied_user?: boolean; -} -export declare const Attachment: { - id: typeof Types.Long; - 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: NumberConstructor; - 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, import("mongoose").Model>, undefined>; -export declare const MessageModel: import("mongoose").Model; diff --git a/dist/models/Message.js b/dist/models/Message.js deleted file mode 100644 index 3ae1d6db..00000000 --- a/dist/models/Message.js +++ /dev/null @@ -1,160 +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: mongoose_1.Types.Long, - 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: mongoose_1.Types.Long, - name: String, - animated: Boolean, - }, -}; -exports.Embed = { - title: String, - type: String, - description: String, - url: String, - timestamp: Number, - 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: mongoose_1.Types.Long, - channel_id: mongoose_1.Types.Long, - author_id: mongoose_1.Types.Long, - webhook_id: mongoose_1.Types.Long, - guild_id: mongoose_1.Types.Long, - application_id: mongoose_1.Types.Long, - content: String, - timestamp: Number, - edited_timestamp: Number, - tts: Boolean, - mention_everyone: Boolean, - mention_user_ids: [mongoose_1.Types.Long], - mention_role_ids: [mongoose_1.Types.Long], - mention_channel_ids: [mongoose_1.Types.Long], - 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: mongoose_1.Types.Long, - channel_id: mongoose_1.Types.Long, - guild_id: mongoose_1.Types.Long, - }, -}); -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: true, -}); -exports.MessageSchema.virtual("mention_roles", { - ref: Role_1.RoleModel, - localField: "mention_role_ids", - foreignField: "id", - justOne: true, -}); -exports.MessageSchema.virtual("mention_channels", { - ref: Role_1.RoleModel, - localField: "mention_role_ids", - foreignField: "id", - justOne: true, -}); -// 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 82bbecc1..00000000 --- a/dist/models/Message.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Message.js","sourceRoot":"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QAAA,YAAY,GAAG,kBAAE,CAAC,KAAK,CAAkB,SAAS,EAAE,qBAAa,EAAE,UAAU,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Role.d.ts b/dist/models/Role.d.ts deleted file mode 100644 index 6a3f1669..00000000 --- a/dist/models/Role.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface Role { - id: bigint; - guild_id: bigint; - color: number; - hoist: boolean; - managed: boolean; - mentionable: boolean; - name: string; - permissions: bigint; - position: number; - tags?: { - bot_id?: bigint; - }; -} -export interface RoleDocument extends Document, Role { - id: bigint; -} -export declare const RoleSchema: Schema, import("mongoose").Model>, undefined>; -export declare const RoleModel: import("mongoose").Model; diff --git a/dist/models/Role.js b/dist/models/Role.js deleted file mode 100644 index ed681849..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: mongoose_1.Types.Long, - guild_id: mongoose_1.Types.Long, - color: Number, - hoist: Boolean, - managed: Boolean, - mentionable: Boolean, - name: String, - permissions: mongoose_1.Types.Long, - position: Number, - tags: { - bot_id: mongoose_1.Types.Long, - }, -}); -// @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 b3ed1758..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,gBAAK,CAAC,IAAI;IACd,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,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,gBAAK,CAAC,IAAI;KAClB;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 adf6613f..00000000 --- a/dist/models/User.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -/// -import { Activity } from "./Activity"; -import { ClientStatus, Status } from "./Status"; -import { Schema, Document } from "mongoose"; -export interface User { - id: bigint; - username: string; - discriminator: string; - avatar: string | null; - fingerprints: string[]; - phone?: string; - desktop: boolean; - mobile: boolean; - premium: boolean; - premium_type: number; - bot: boolean; - system: boolean; - level: string; - nsfw_allowed: boolean; - mfa_enabled: boolean; - created_at: Date; - verified: boolean; - email?: string; - flags: bigint; - public_flags: bigint; - hash: string; - guilds: bigint[]; - valid_tokens_since: Date; - user_settings: UserSettings; - relationships: Relationship[]; - connected_accounts: ConnectedAccount[]; - presence: { - status: Status; - activities: Activity[]; - client_status: ClientStatus; - }; -} -export interface UserDocument extends User, Document { - id: bigint; -} -export interface PublicUser { - id: bigint; - 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: bigint; - nickname?: string; - type: number; - user_id: bigint; -} -export interface UserSettings { - afk_timeout: number; - allow_accessibility_detection: boolean; - animate_emoji: boolean; - animate_stickers: number; - contact_sync_enabled: boolean; - convert_emoticons: boolean; - custom_status: { - emoji_id: bigint | null; - emoji_name: string | null; - expires_at: number | null; - text: string | null; - }; - default_guilds_restricted: boolean; - detect_platform_accounts: boolean; - developer_mode: boolean; - disable_games_tab: boolean; - enable_tts_command: boolean; - explicit_content_filter: number; - friend_source_flags: { - all: boolean; - }; - gateway_connected: boolean; - gif_auto_play: boolean; - guild_folders: { - color: number; - guild_ids: bigint[]; - id: number; - name: string; - }[]; - guild_positions: bigint[]; - inline_attachment_media: boolean; - inline_embed_media: boolean; - locale: string; - message_display_compact: boolean; - native_phone_integration_enabled: boolean; - render_embeds: boolean; - render_reactions: boolean; - restricted_guilds: bigint[]; - show_current_game: boolean; - status: "online" | "offline" | "dnd" | "idle"; - stream_notifications_enabled: boolean; - theme: "dark" | "white"; - timezone_offset: number; -} -export declare const UserSchema: Schema, import("mongoose").Model>, undefined>; -export declare const UserModel: import("mongoose").Model; diff --git a/dist/models/User.js b/dist/models/User.js deleted file mode 100644 index e40df925..00000000 --- a/dist/models/User.js +++ /dev/null @@ -1,109 +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: mongoose_1.Types.Long, - username: String, - discriminator: String, - avatar: String, - fingerprints: [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, - hash: String, - guilds: [mongoose_1.Types.Long], - valid_tokens_since: Date, - 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: mongoose_1.Types.Long, - 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: [mongoose_1.Types.Long], - id: Number, - name: String, - }, - ], - guild_positions: [mongoose_1.Types.Long], - 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: [mongoose_1.Types.Long], - show_current_game: Boolean, - status: String, - stream_notifications_enabled: Boolean, - theme: String, - timezone_offset: Number, - }, - relationships: [ - { - id: mongoose_1.Types.Long, - nickname: String, - type: Number, - user_id: mongoose_1.Types.Long, - }, - ], - connected_accounts: [ - { - access_token: String, - friend_sync: Boolean, - id: String, - name: String, - revoked: Boolean, - show_activity: Boolean, - type: String, - verifie: Boolean, - visibility: 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 5d5e5b10..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;AAgHrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,gBAAK,CAAC,IAAI;IACd,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,CAAC,MAAM,CAAC;IACtB,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;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B,EAAE,OAAO;QAC1B,MAAM,EAAE,MAAM;QACd,4BAA4B,EAAE,OAAO;QACrC,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;KACvB;IACD,aAAa,EAAE;QACd;YACC,EAAE,EAAE,gBAAK,CAAC,IAAI;YACd,QAAQ,EAAE,MAAM;YAChB,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,gBAAK,CAAC,IAAI;SACnB;KACD;IACD,kBAAkB,EAAE;QACnB;YACC,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,OAAO;YACpB,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO;YAChB,aAAa,EAAE,OAAO;YACtB,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO;YAChB,UAAU,EAAE,MAAM;SAClB;KACD;IACD,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 50faa253..00000000 --- a/dist/models/VoiceState.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface VoiceState extends Document { - guild_id?: bigint; - channel_id: bigint; - user_id: bigint; - 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, import("mongoose").Model>, undefined>; -export declare const VoiceStateModel: import("mongoose").Model; diff --git a/dist/models/VoiceState.js b/dist/models/VoiceState.js deleted file mode 100644 index c646879c..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: mongoose_1.Types.Long, - channel_id: mongoose_1.Types.Long, - user_id: mongoose_1.Types.Long, - 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 1e21605d..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,gBAAK,CAAC,IAAI;IACpB,UAAU,EAAE,gBAAK,CAAC,IAAI;IACtB,OAAO,EAAE,gBAAK,CAAC,IAAI;IACnB,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; - 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; - /** - * 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; - /** - * Gets an {@link Array} of bitfield names based on the bits available. - */ - toArray(): string[]; - toJSON(): bigint; - valueOf(): bigint; - [Symbol.iterator](): Generator; - /** - * 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,CA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,CAAC;QACjB,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IAEH;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,MAA0B,EAAE;QAC1C,aAAa;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC;QACpD,IAAI,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,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 @@ -/// -import { Schema, Document } from "mongoose"; -import "missing-native-js-functions"; -declare const _default: { - init: (defaultOpts?: any) => Promise; - getAll: () => DefaultOptions; - setAll: (val: any) => Promise; -}; -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, import("mongoose").Model>, undefined>; -export declare const ConfigModel: import("mongoose").Model; 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 dcb9bc90..00000000 --- a/dist/util/Database.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// -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>; - opts: { - onlyEvents: boolean; - }; - stream: ChangeStream; - data: any; - constructor(collection: Collection, pipeline: Array>, opts: { - onlyEvents: boolean; - }); - init(): Promise; - convertResult(obj: any): any; - change: (doc: ChangeEvent) => boolean | Promise | undefined; - destroy(): Promise | undefined; -} diff --git a/dist/util/Database.js b/dist/util/Database.js deleted file mode 100644 index 01b1b57c..00000000 --- a/dist/util/Database.js +++ /dev/null @@ -1,75 +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"; -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.change = (doc) => { - // @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; - } - }; - } - async init() { - 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; - } - } - 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; - } - 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 7dacb4cd..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,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;QA6BF,WAAM,GAAG,CAAC,GAAgB,EAAE,EAAE;YAC7B,aAAa;YACb,IAAI,GAAG,CAAC,YAAY,EAAE;gBACrB,aAAa;gBACb,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU;oBAAE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC;aACxD;YAED,QAAQ,GAAG,CAAC,aAAa,EAAE;gBAC1B,KAAK,cAAc;oBAClB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;gBACvB,KAAK,MAAM;oBACV,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;gBACvB,KAAK,QAAQ;oBACZ,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,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;QACvD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAChC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;SACH;QAED,OAAO,GAAG,CAAC;IACZ,CAAC;IA4BD,OAAO;QACN,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEnB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YAAE,OAAO;QAEnC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACD;AAxED,sCAwEC"} \ 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;AAEhC,MAAM,UAAW,SAAQ,kBAAQ,CAAC,UAAU;IAA5C;;QACQ,yBAAoB,GAAG;YAC7B,GAAG,EAAE,IAAI,CAAC,YAAY;YACtB,IAAI,EAAE,IAAI,CAAC,YAAY;YACvB,GAAG,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AAC,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 1cedf036..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: bigint; - roles: bigint[]; - }; - guild: { - roles: Role[]; - }; - channel?: { - overwrites?: ChannelPermissionOverwrite[]; - }; - }): bigint; -} -export declare function getPermission(user_id: bigint, guild_id: bigint, channel_id?: bigint, cache?: { - channel?: ChannelDocument | null; - member?: MemberDocument | null; -}): Promise; -export {}; diff --git a/dist/util/Permissions.js b/dist/util/Permissions.js deleted file mode 100644 index dfa2ea74..00000000 --- a/dist/util/Permissions.js +++ /dev/null @@ -1,118 +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 } }).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 39a64586..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,8DAA8D;AAC9D,6CAA+D;AAC/D,+CAAkE;AAElE,yCAAiD;AACjD,yCAAsC;AACtC,2CAA4D;AAqC5D,MAAM,wBAAwB,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,qEAAqE;AAEjH,MAAa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AAE,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,CAAC,IAAI,EAAE,CAAC;IACjF,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;AAlCD,sCAkCC"} \ 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 bd8c05bb..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(): bigint; - /** - * A deconstructed snowflake. - * @typedef {Object} DeconstructedSnowflake - * @property {number} timestamp Timestamp the snowflake was created - * @property {Date} date Date the snowflake was created - * @property {number} workerID Worker ID in the snowflake - * @property {number} processID Process ID in the snowflake - * @property {number} increment Increment in the snowflake - * @property {string} binary Binary representation of the snowflake - */ - /** - * Deconstructs a Discord snowflake. - * @param {Snowflake} snowflake Snowflake to deconstruct - * @returns {DeconstructedSnowflake} Deconstructed snowflake - */ - static deconstruct(snowflake: any): { - timestamp: any; - workerID: number; - processID: number; - increment: number; - binary: string; - }; -} diff --git a/dist/util/Snowflake.js b/dist/util/Snowflake.js deleted file mode 100644 index 78373e95..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; - } - /** - * 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 9d4b3195..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;gBAC/B,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;aAC5B;SACD;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG;QACpB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line 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; 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..17d70c4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,10 +12,14 @@ "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", + "mongoose-autopopulate": "^0.12.3" }, "devDependencies": { "@types/jsonwebtoken": "^8.5.0", + "@types/mongoose-autopopulate": "^0.10.1", + "@types/mongoose-lean-virtuals": "^0.5.1", "@types/node": "^14.14.25", "typescript": "^4.1.3" } @@ -46,6 +50,34 @@ "@types/node": "*" } }, + "node_modules/@types/mongoose": { + "version": "5.10.4", + "resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.10.4.tgz", + "integrity": "sha512-U7fNDcTcdaSGzQ3+mlSBeebiYr6eaacJi330LTLOEh8Sm6mXfuec70ag/UXkL+alFm7pfAjFqfc7jEaJEJvAHQ==", + "dev": true, + "dependencies": { + "@types/mongodb": "*", + "@types/node": "*" + } + }, + "node_modules/@types/mongoose-autopopulate": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@types/mongoose-autopopulate/-/mongoose-autopopulate-0.10.1.tgz", + "integrity": "sha512-L67MAIE3WEoTtt7a7/spRYk+76lgp67FAP6I38Y9NcC1kQuzwqnukTaJzodfb8180wxHZM4qt68u6x6ptuDRaQ==", + "dev": true, + "dependencies": { + "@types/mongoose": "*" + } + }, + "node_modules/@types/mongoose-lean-virtuals": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@types/mongoose-lean-virtuals/-/mongoose-lean-virtuals-0.5.1.tgz", + "integrity": "sha512-bNk+QLjP5VZU4EsJag4xQsjLAa8CEm/SKZDyiC2kM208wIrGum6daD7j45Oqs50bWNGfqZYRuEhh8xZ17D7aEw==", + "dev": true, + "dependencies": { + "@types/mongoose": "*" + } + }, "node_modules/@types/node": { "version": "14.14.25", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz", @@ -562,14 +594,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 +706,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", @@ -699,6 +731,14 @@ "url": "https://opencollective.com/mongoose" } }, + "node_modules/mongoose-autopopulate": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/mongoose-autopopulate/-/mongoose-autopopulate-0.12.3.tgz", + "integrity": "sha512-yNmYsfi6OpS/GQ+48mkB0KQ199ExHmmPrt3wt3fyxPHPMtEBGts7yq3wBQR6VgKCPOQaKvCI1URbJCPOtrPeLw==", + "peerDependencies": { + "mongoose": "4.x || 5.x" + } + }, "node_modules/mongoose-legacy-pluralize": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", @@ -708,9 +748,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 +795,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 +840,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", @@ -1155,6 +1203,34 @@ "@types/node": "*" } }, + "@types/mongoose": { + "version": "5.10.4", + "resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.10.4.tgz", + "integrity": "sha512-U7fNDcTcdaSGzQ3+mlSBeebiYr6eaacJi330LTLOEh8Sm6mXfuec70ag/UXkL+alFm7pfAjFqfc7jEaJEJvAHQ==", + "dev": true, + "requires": { + "@types/mongodb": "*", + "@types/node": "*" + } + }, + "@types/mongoose-autopopulate": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@types/mongoose-autopopulate/-/mongoose-autopopulate-0.10.1.tgz", + "integrity": "sha512-L67MAIE3WEoTtt7a7/spRYk+76lgp67FAP6I38Y9NcC1kQuzwqnukTaJzodfb8180wxHZM4qt68u6x6ptuDRaQ==", + "dev": true, + "requires": { + "@types/mongoose": "*" + } + }, + "@types/mongoose-lean-virtuals": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@types/mongoose-lean-virtuals/-/mongoose-lean-virtuals-0.5.1.tgz", + "integrity": "sha512-bNk+QLjP5VZU4EsJag4xQsjLAa8CEm/SKZDyiC2kM208wIrGum6daD7j45Oqs50bWNGfqZYRuEhh8xZ17D7aEw==", + "dev": true, + "requires": { + "@types/mongoose": "*" + } + }, "@types/node": { "version": "14.14.25", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz", @@ -1544,14 +1620,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 +1689,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 +1708,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", @@ -1646,6 +1722,12 @@ } } }, + "mongoose-autopopulate": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/mongoose-autopopulate/-/mongoose-autopopulate-0.12.3.tgz", + "integrity": "sha512-yNmYsfi6OpS/GQ+48mkB0KQ199ExHmmPrt3wt3fyxPHPMtEBGts7yq3wBQR6VgKCPOQaKvCI1URbJCPOtrPeLw==", + "requires": {} + }, "mongoose-legacy-pluralize": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", @@ -1658,9 +1740,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 +1784,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..1d3620f0 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,12 @@ "jsonwebtoken": "^8.5.1", "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2", - "mongodb": "^3.6.4" - }, - "devDependencies": { + "mongodb": "^3.6.6", + "mongoose": "^5.12.3", + "mongoose-autopopulate": "^0.12.3", "@types/jsonwebtoken": "^8.5.0", + "@types/mongoose-autopopulate": "^0.10.1", + "@types/mongoose-lean-virtuals": "^0.5.1", "@types/node": "^14.14.25", "typescript": "^4.1.3" } diff --git a/src/index.ts b/src/index.ts index 8484565a..343a7496 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,31 +1,10 @@ export * from "./util/checkToken"; export * as Constants from "./util/Constants"; -export * from "./models/Ban"; -export * from "./models/Channel"; -export * from "./models/Emoji"; -export * from "./models/Guild"; -export * from "./models/Invite"; -export * from "./models/Member"; -export * from "./models/Role"; -export * from "./models/User"; -export * from "./models/Activity"; -export * from "./models/Application"; -export * from "./models/Interaction"; -export * from "./models/Message"; -export * from "./models/Status"; -export * from "./models/VoiceState"; - -export * from "./util/String"; -export * from "./util/BitField"; -export * from "./util/Intents"; -export * from "./util/MessageFlags"; -export * from "./util/Permissions"; -export * from "./util/Snowflake"; -export * from "./util/UserFlags"; -export * from "./models/Event"; +export * from "./models/index"; +export * from "./util/index"; import Config, { DefaultOptions } from "./util/Config"; -import db, { MongooseCache } from "./util/Database"; +import db, { MongooseCache, toObject } from "./util/Database"; -export { Config, db, DefaultOptions, MongooseCache }; +export { Config, db, DefaultOptions, MongooseCache, toObject }; diff --git a/src/models/Activity.ts b/src/models/Activity.ts index beaa43e8..2d70379c 100644 --- a/src/models/Activity.ts +++ b/src/models/Activity.ts @@ -1,10 +1,11 @@ import { User } from ".."; import { ClientStatus, Status } from "./Status"; import { Schema, model, Types, Document } from "mongoose"; +import toBigInt from "../util/toBigInt"; export interface Presence { user: User; - guild_id?: bigint; + guild_id?: string; status: Status; activities: Activity[]; client_status: ClientStatus; @@ -14,17 +15,17 @@ export interface Activity { name: string; type: ActivityType; url?: string; - created_at: Date; + created_at?: Date; timestamps?: { - start: number; - end: number; + start?: number; + end?: number; }[]; - application_id?: bigint; + application_id?: string; details?: string; state?: string; emoji?: { name: string; - id?: bigint; + id?: string; amimated?: boolean; }; party?: { @@ -32,10 +33,10 @@ export interface Activity { size?: [number, number]; }; assets?: { - large_image: string; - large_text: string; - small_image: string; - small_text: string; + large_image?: string; + large_text?: string; + small_image?: string; + small_text?: string; }; secrets?: { join?: string; @@ -46,9 +47,9 @@ export interface Activity { flags?: bigint; } -export const Activity = { - name: String, - type: Number, +export const ActivitySchema = { + name: { type: String, required: true }, + type: { type: Number, required: true }, url: String, created_at: Date, timestamps: [ @@ -57,12 +58,12 @@ export const Activity = { end: Number, }, ], - application_id: Types.Long, + application_id: String, details: String, state: String, emoji: { name: String, - id: Types.Long, + id: String, amimated: Boolean, }, party: { @@ -81,7 +82,45 @@ export const Activity = { match: String, }, instance: Boolean, - flags: Types.Long, + flags: { type: String, get: toBigInt }, +}; + +export const ActivityBodySchema = { + 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: Types.Long, }; export enum ActivityType { diff --git a/src/models/Application.ts b/src/models/Application.ts index ea443dc9..4c519ff2 100644 --- a/src/models/Application.ts +++ b/src/models/Application.ts @@ -1,6 +1,6 @@ export interface ApplicationCommand { - id: bigint; - application_id: bigint; + id: string; + application_id: string; name: string; description: string; options?: ApplicationCommandOption[]; @@ -32,7 +32,7 @@ export enum ApplicationCommandOptionType { } export interface ApplicationCommandInteractionData { - id: bigint; + id: string; name: string; options?: ApplicationCommandInteractionDataOption[]; } diff --git a/src/models/AuditLog.ts b/src/models/AuditLog.ts index a0f91a82..c1f83c13 100644 --- a/src/models/AuditLog.ts +++ b/src/models/AuditLog.ts @@ -11,17 +11,17 @@ export interface AuditLogResponse { } export interface AuditLogEntries { - target_id?: bigint; - user_id: bigint; - id: bigint; + target_id?: string; + user_id: string; + id: string; action_type: AuditLogEvents; options?: { delete_member_days?: string; members_removed?: string; - channel_id?: bigint; - messaged_id?: bigint; + channel_id?: string; + messaged_id?: string; count?: string; - id?: bigint; + id?: string; type?: string; role_name?: string; }; @@ -42,13 +42,13 @@ export interface AuditLogChangeValue { splash_hash?: string; discovery_splash_hash?: string; banner_hash?: string; - owner_id?: bigint; + owner_id?: string; region?: string; preferred_locale?: string; - afk_channel_id?: bigint; + afk_channel_id?: string; afk_timeout?: number; - rules_channel_id?: bigint; - public_updates_channel_id?: bigint; + rules_channel_id?: string; + public_updates_channel_id?: string; mfa_level?: number; verification_level?: number; explicit_content_filter?: number; @@ -58,14 +58,14 @@ export interface AuditLogChangeValue { $remove?: {}[]; prune_delete_days?: number; widget_enabled?: boolean; - widget_channel_id?: bigint; - system_channel_id?: bigint; + widget_channel_id?: string; + system_channel_id?: string; position?: number; topic?: string; bitrate?: number; permission_overwrites?: ChannelPermissionOverwrite[]; nsfw?: boolean; - application_id?: bigint; + application_id?: string; rate_limit_per_user?: number; permissions?: string; color?: number; @@ -74,8 +74,8 @@ export interface AuditLogChangeValue { allow?: string; deny?: string; code?: string; - channel_id?: bigint; - inviter_id?: bigint; + channel_id?: string; + inviter_id?: string; max_uses?: number; uses?: number; max_age?: number; @@ -84,7 +84,7 @@ export interface AuditLogChangeValue { mute?: boolean; nick?: string; avatar_hash?: string; - id?: bigint; + id?: string; type?: number; enable_emoticons?: boolean; expire_behavior?: number; @@ -93,7 +93,7 @@ export interface AuditLogChangeValue { } export interface AuditLogEntriesDocument extends Document, AuditLogEntries { - id: bigint; + id: string; } export const AuditLogChanges = { @@ -103,13 +103,13 @@ export const AuditLogChanges = { splash_hash: String, discovery_splash_hash: String, banner_hash: String, - owner_id: Types.Long, + owner_id: String, region: String, preferred_locale: String, - afk_channel_id: Types.Long, + afk_channel_id: String, afk_timeout: Number, - rules_channel_id: Types.Long, - public_updates_channel_id: Types.Long, + rules_channel_id: String, + public_updates_channel_id: String, mfa_level: Number, verification_level: Number, explicit_content_filter: Number, @@ -119,14 +119,14 @@ export const AuditLogChanges = { $remove: [{}], prune_delete_days: Number, widget_enabled: Boolean, - widget_channel_id: Types.Long, - system_channel_id: Types.Long, + widget_channel_id: String, + system_channel_id: String, position: Number, topic: String, bitrate: Number, permission_overwrites: [{}], nsfw: Boolean, - application_id: Types.Long, + application_id: String, rate_limit_per_user: Number, permissions: String, color: Number, @@ -135,8 +135,8 @@ export const AuditLogChanges = { allow: String, deny: String, code: String, - channel_id: Types.Long, - inviter_id: Types.Long, + channel_id: String, + inviter_id: String, max_uses: Number, uses: Number, max_age: Number, @@ -145,7 +145,7 @@ export const AuditLogChanges = { mute: Boolean, nick: String, avatar_hash: String, - id: Types.Long, + id: String, type: Number, enable_emoticons: Boolean, expire_behavior: Number, @@ -154,17 +154,17 @@ export const AuditLogChanges = { }; export const AuditLogSchema = new Schema({ - target_id: Types.Long, - user_id: { type: Types.Long, required: true }, - id: { type: Types.Long, required: true }, + 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: Types.Long, - messaged_id: Types.Long, + channel_id: String, + messaged_id: String, count: String, - id: Types.Long, + id: String, type: String, role_name: String, }, diff --git a/src/models/Ban.ts b/src/models/Ban.ts index 8fc3b124..27893029 100644 --- a/src/models/Ban.ts +++ b/src/models/Ban.ts @@ -2,17 +2,17 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; export interface Ban extends Document { - user_id: bigint; - guild_id: bigint; - executor_id: bigint; + user_id: string; + guild_id: string; + executor_id: string; ip: string; reason?: string; } export const BanSchema = new Schema({ - user_id: { type: Types.Long, required: true }, - guild_id: { type: Types.Long, required: true }, - executor_id: { type: Types.Long, required: true }, + user_id: { type: String, required: true }, + guild_id: { type: String, required: true }, + executor_id: { type: String, required: true }, reason: String, ip: String, // ? Should we store this in here, or in the UserModel? }); diff --git a/src/models/Channel.ts b/src/models/Channel.ts index bf03c939..1b9a167c 100644 --- a/src/models/Channel.ts +++ b/src/models/Channel.ts @@ -1,32 +1,33 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; +import toBigInt from "../util/toBigInt"; export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel {} export interface ChannelDocument extends Document, AnyChannel { - id: bigint; + id: string; } export const ChannelSchema = new Schema({ - id: Types.Long, + id: String, created_at: { type: Schema.Types.Date, required: true }, name: { type: String, required: true }, type: { type: Number, required: true }, - guild_id: Types.Long, - owner_id: Types.Long, - parent_id: Types.Long, - recipients: [Types.Long], + guild_id: String, + owner_id: String, + parent_id: String, + recipients: [String], position: Number, - last_message_id: Types.Long, + last_message_id: String, last_pin_timestamp: Date, nsfw: Boolean, rate_limit_per_user: Number, topic: String, permission_overwrites: [ { - allow: Types.Long, - deny: Types.Long, - id: Types.Long, + allow: { type: String, get: toBigInt }, + deny: { type: String, get: toBigInt }, + id: String, type: Number, }, ], @@ -36,28 +37,28 @@ export const ChannelSchema = new Schema({ export const ChannelModel = db.model("Channel", ChannelSchema, "channels"); export interface Channel { - id: bigint; + id: string; created_at: Date; name: string; type: number; } export interface TextBasedChannel { - last_message_id?: bigint; + last_message_id?: string; last_pin_timestamp?: number; } export interface GuildChannel extends Channel { - guild_id: bigint; + guild_id: string; position: number; - parent_id?: bigint; + parent_id?: string; permission_overwrites: ChannelPermissionOverwrite[]; } export interface ChannelPermissionOverwrite { - allow: bigint; - deny: bigint; - id: bigint; + allow: bigint; // for bitfields we use bigints + deny: bigint; // for bitfields we use bigints + id: string; type: ChannelPermissionOverwriteType; } @@ -75,8 +76,8 @@ export interface TextChannel extends GuildChannel, TextBasedChannel { } export interface DMChannel extends Channel, TextBasedChannel { - owner_id: bigint; - recipients: bigint[]; + owner_id: string; + recipients: string[]; } export enum ChannelType { diff --git a/src/models/Emoji.ts b/src/models/Emoji.ts index 530c2cc7..3e5cad53 100644 --- a/src/models/Emoji.ts +++ b/src/models/Emoji.ts @@ -2,27 +2,27 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; export interface Emoji extends Document { - id: bigint; + id: string; animated: boolean; available: boolean; - guild_id: bigint; + guild_id: string; managed: boolean; name: string; require_colons: boolean; url: string; - roles: bigint[]; // roles this emoji is whitelisted to + roles: string[]; // roles this emoji is whitelisted to (new discord feature?) } export const EmojiSchema = new Schema({ - id: { type: Types.Long, required: true }, + id: { type: String, required: true }, animated: Boolean, available: Boolean, - guild_id: Types.Long, + guild_id: String, managed: Boolean, name: String, require_colons: Boolean, url: String, - roles: [Types.Long], + roles: [String], }); // @ts-ignore diff --git a/src/models/Event.ts b/src/models/Event.ts index 40cbcb20..9a5b5283 100644 --- a/src/models/Event.ts +++ b/src/models/Event.ts @@ -1,7 +1,7 @@ -import { ConnectedAccount, User, UserSettings } from "./User"; +import { ConnectedAccount, PublicUser, User, UserSettings } from "./User"; import { DMChannel, Channel } from "./Channel"; import { Guild } from "./Guild"; -import { PublicMember, UserGuildSettings } from "./Member"; +import { Member, PublicMember, UserGuildSettings } from "./Member"; import { Emoji } from "./Emoji"; import { Presence } from "./Activity"; import { Role } from "./Role"; @@ -14,9 +14,9 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; export interface Event { - guild_id?: bigint; - user_id?: bigint; - channel_id?: bigint; + guild_id?: string; + user_id?: string; + channel_id?: string; created_at?: Date; event: EVENT; data?: any; @@ -25,9 +25,9 @@ export interface Event { export interface EventDocument extends Event, Document {} export const EventSchema = new Schema({ - guild_id: Types.Long, - user_id: Types.Long, - channel_id: Types.Long, + guild_id: String, + user_id: String, + channel_id: String, created_at: { type: Date, required: true }, event: { type: String, required: true }, data: Object, @@ -44,60 +44,78 @@ export interface InvalidatedEvent extends Event { // ! END Custom Events that shouldn't get sent to the client but processed by the server +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[]; // this will be empty for bots + session_id: string; // resuming + guilds: Guild[]; + analytics_token?: string; + connected_accounts?: ConnectedAccount[]; + consents?: { + personalization?: { + consented?: boolean; + }; + }; + country_code?: string; // e.g. DE + friend_suggestion_count?: number; + geo_ordered_rtc_regions?: string[]; // ["europe","russie","india","us-east","us-central"] + experiments?: [number, number, number, number, number][]; + guild_experiments?: [ + // ? what are guild_experiments? + // this is the structure of it: + number, + null, + number, + [[number, { e: number; s: number }[]]], + [number, [[number, [number, number]]]], + { b: number; k: bigint[] }[] + ][]; + guild_join_requests?: []; // ? what is this? this is new + shard?: [number, number]; + user_settings?: UserSettings; + relationships?: []; // TODO + read_state: { + entries: []; // TODO + partial: boolean; + version: number; + }; + user_guild_settings?: { + entries: UserGuildSettings[]; + version: number; + partial: boolean; + }; + application?: { + id: string; + flags: bigint; + }; + merged_members?: Omit[][]; + // probably all users who the user is in contact with + users?: { + avatar?: string; + discriminator: string; + id: string; + username: string; + bot: boolean; + public_flags: bigint; + }[]; +} + export interface ReadyEvent extends Event { event: "READY"; - data: { - v: number; - user: Omit; - private_channels: DMChannel[]; // this will be empty for bots - session_id: string; // resuming - guilds: Guild[]; - analytics_token?: string; - connected_accounts?: ConnectedAccount[]; - consents?: { - personalization?: { - consented?: boolean; - }; - }; - country_code?: string; // e.g. DE - friend_suggestion_count?: number; - geo_ordered_rtc_regions?: string[]; // ["europe","russie","india","us-east","us-central"] - experiments?: [number, number, number, number, number][]; - guild_experiments?: [ - // ? what are guild_experiments? - // this is the structure of it: - number, - null, - number, - [[number, { e: number; s: number }[]]], - [number, [[number, [number, number]]]], - { b: number; k: bigint[] }[] - ][]; - guild_join_requests?: []; // ? what is this? this is new - shard?: [number, number]; - user_settings?: UserSettings; - relationships?: []; - user_guild_settings?: { - entries: UserGuildSettings[]; - version: number; - partial: boolean; - }; - application?: { - id: bigint; - flags: bigint; - }; - - merged_members?: PublicMember[][]; // every guild member object for the current user - // probably all users who the user is in contact with - users?: { - avatar?: string; - discriminator: string; - id: bigint; - username: string; - bot: boolean; - public_flags: bigint; - }[]; - }; + data: ReadyEventData; } export interface ChannelCreateEvent extends Event { @@ -118,8 +136,8 @@ export interface ChannelDeleteEvent extends Event { export interface ChannelPinsUpdateEvent extends Event { event: "CHANNEL_PINS_UPDATE"; data: { - guild_id?: bigint; - channel_id: bigint; + guild_id?: string; + channel_id: string; last_pin_timestamp: number; }; } @@ -137,7 +155,7 @@ export interface GuildUpdateEvent extends Event { export interface GuildDeleteEvent extends Event { event: "GUILD_DELETE"; data: { - id: bigint; + id: string; unavailable?: boolean; }; } @@ -145,7 +163,7 @@ export interface GuildDeleteEvent extends Event { export interface GuildBanAddEvent extends Event { event: "GUILD_BAN_ADD"; data: { - guild_id: bigint; + guild_id: string; user: User; }; } @@ -153,7 +171,7 @@ export interface GuildBanAddEvent extends Event { export interface GuildBanRemoveEvent extends Event { event: "GUILD_BAN_REMOVE"; data: { - guild_id: bigint; + guild_id: string; user: User; }; } @@ -161,7 +179,7 @@ export interface GuildBanRemoveEvent extends Event { export interface GuildEmojiUpdateEvent extends Event { event: "GUILD_EMOJI_UPDATE"; data: { - guild_id: bigint; + guild_id: string; emojis: Emoji[]; }; } @@ -169,21 +187,21 @@ export interface GuildEmojiUpdateEvent extends Event { export interface GuildIntegrationUpdateEvent extends Event { event: "GUILD_INTEGRATIONS_UPDATE"; data: { - guild_id: bigint; + guild_id: string; }; } export interface GuildMemberAddEvent extends Event { event: "GUILD_MEMBER_ADD"; data: PublicMember & { - guild_id: bigint; + guild_id: string; }; } export interface GuildMemberRemoveEvent extends Event { event: "GUILD_MEMBER_REMOVE"; data: { - guild_id: bigint; + guild_id: string; user: User; }; } @@ -191,8 +209,8 @@ export interface GuildMemberRemoveEvent extends Event { export interface GuildMemberUpdateEvent extends Event { event: "GUILD_MEMBER_UPDATE"; data: { - guild_id: bigint; - roles: bigint[]; + guild_id: string; + roles: string[]; user: User; nick?: string; joined_at: Date; @@ -204,11 +222,11 @@ export interface GuildMemberUpdateEvent extends Event { export interface GuildMembersChunkEvent extends Event { event: "GUILD_MEMBERS_CHUNK"; data: { - guild_id: bigint; + guild_id: string; members: PublicMember[]; chunk_index: number; chunk_count: number; - not_found: bigint[]; + not_found: string[]; presences: Presence[]; nonce?: string; }; @@ -217,7 +235,7 @@ export interface GuildMembersChunkEvent extends Event { export interface GuildRoleCreateEvent extends Event { event: "GUILD_ROLE_CREATE"; data: { - guild_id: bigint; + guild_id: string; role: Role; }; } @@ -225,7 +243,7 @@ export interface GuildRoleCreateEvent extends Event { export interface GuildRoleUpdateEvent extends Event { event: "GUILD_ROLE_UPDATE"; data: { - guild_id: bigint; + guild_id: string; role: Role; }; } @@ -233,31 +251,31 @@ export interface GuildRoleUpdateEvent extends Event { export interface GuildRoleDeleteEvent extends Event { event: "GUILD_ROLE_DELETE"; data: { - guild_id: bigint; - role_id: bigint; + guild_id: string; + role_id: string; }; } export interface InviteCreateEvent extends Event { event: "INVITE_CREATE"; data: Omit & { - channel_id: bigint; - guild_id?: bigint; + channel_id: string; + guild_id?: string; }; } export interface InviteDeleteEvent extends Event { event: "INVITE_DELETE"; data: { - channel_id: bigint; - guild_id?: bigint; + channel_id: string; + guild_id?: string; code: string; }; } export type MessagePayload = Omit & { - channel_id: bigint; - guild_id?: bigint; + channel_id: string; + guild_id?: string; author: User; member: PublicMember; mentions: (User & { member: PublicMember })[]; @@ -276,28 +294,28 @@ export interface MessageUpdateEvent extends Event { export interface MessageDeleteEvent extends Event { event: "MESSAGE_DELETE"; data: { - id: bigint; - channel_id: bigint; - guild_id?: bigint; + id: string; + channel_id: string; + guild_id?: string; }; } export interface MessageDeleteBulkEvent extends Event { event: "MESSAGE_DELETE_BULK"; data: { - ids: bigint[]; - channel_id: bigint; - guild_id?: bigint; + ids: string[]; + channel_id: string; + guild_id?: string; }; } export interface MessageReactionAddEvent extends Event { event: "MESSAGE_REACTION_ADD"; data: { - user_id: bigint; - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + user_id: string; + channel_id: string; + message_id: string; + guild_id?: string; member?: PublicMember; emoji: PartialEmoji; }; @@ -306,10 +324,10 @@ export interface MessageReactionAddEvent extends Event { export interface MessageReactionRemoveEvent extends Event { event: "MESSAGE_REACTION_REMOVE"; data: { - user_id: bigint; - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + user_id: string; + channel_id: string; + message_id: string; + guild_id?: string; emoji: PartialEmoji; }; } @@ -317,18 +335,18 @@ export interface MessageReactionRemoveEvent extends Event { export interface MessageReactionRemoveAllEvent extends Event { event: "MESSAGE_REACTION_REMOVE_ALL"; data: { - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + channel_id: string; + message_id: string; + guild_id?: string; }; } export interface MessageReactionRemoveEmojiEvent extends Event { event: "MESSAGE_REACTION_REMOVE_EMOJI"; data: { - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + channel_id: string; + message_id: string; + guild_id?: string; emoji: PartialEmoji; }; } @@ -341,10 +359,10 @@ export interface PresenceUpdateEvent extends Event { export interface TypingStartEvent extends Event { event: "TYPING_START"; data: { - channel_id: bigint; - user_id: bigint; + channel_id: string; + user_id: string; timestamp: number; - guild_id?: bigint; + guild_id?: string; member?: PublicMember; }; } @@ -365,7 +383,7 @@ export interface VoiceServerUpdateEvent extends Event { event: "VOICE_SERVER_UPDATE"; data: { token: string; - guild_id: bigint; + guild_id: string; endpoint: string; }; } @@ -373,13 +391,13 @@ export interface VoiceServerUpdateEvent extends Event { export interface WebhooksUpdateEvent extends Event { event: "WEBHOOKS_UPDATE"; data: { - guild_id: bigint; - channel_id: bigint; + guild_id: string; + channel_id: string; }; } export type ApplicationCommandPayload = ApplicationCommand & { - guild_id: bigint; + guild_id: string; }; export interface ApplicationCommandCreateEvent extends Event { @@ -404,6 +422,49 @@ export interface InteractionCreateEvent extends Event { // located in collection events +export 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 type EVENT = | "READY" | "CHANNEL_CREATE" diff --git a/src/models/Guild.ts b/src/models/Guild.ts index b25be7aa..ef343010 100644 --- a/src/models/Guild.ts +++ b/src/models/Guild.ts @@ -1,15 +1,19 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; +import { ChannelModel } from "./Channel"; +import { EmojiModel } from "./Emoji"; +import { MemberModel } from "./Member"; +import { RoleModel } from "./Role"; export interface GuildDocument extends Document, Guild { - id: bigint; + id: string; } export interface Guild { - id: bigint; - afk_channel_id?: bigint; + id: string; + afk_channel_id?: string; afk_timeout?: number; - application_id?: bigint; + application_id?: string; banner?: string; default_message_notifications?: number; description?: string; @@ -28,31 +32,33 @@ export interface Guild { // channels: GuildChannel[]; // * Channels are stored in a seperate collection // emojis: Emoji[]; // * Emojis are stored in a seperate collection // voice_states: []; // * voice_states are stored in a seperate collection + //TODO: + presences?: object[]; mfa_level?: number; name: string; - owner_id: bigint; + owner_id: string; preferred_locale?: string; // only community guilds can choose this premium_subscription_count?: number; premium_tier?: number; // nitro boost level - public_updates_channel_id?: bigint; + public_updates_channel_id?: string; region?: string; - rules_channel_id?: bigint; + rules_channel_id?: string; splash?: string; system_channel_flags?: number; - system_channel_id?: bigint; + system_channel_id?: string; unavailable?: boolean; vanity_url_code?: string; verification_level?: number; welcome_screen: []; // welcome splash screen if a user joins guild - widget_channel_id?: bigint; + widget_channel_id?: string; widget_enabled?: boolean; } export const GuildSchema = new Schema({ - id: { type: Types.Long, required: true }, - afk_channel_id: Types.Long, + id: { type: String, required: true }, + afk_channel_id: String, afk_timeout: Number, - application_id: Types.Long, + application_id: String, banner: String, default_message_notifications: Number, description: String, @@ -65,29 +71,69 @@ export const GuildSchema = new Schema({ max_presences: Number, max_video_channel_users: { type: Number, default: 25 }, member_count: Number, + presences: { type: [Object], default: [] }, presence_count: Number, mfa_level: Number, name: { type: String, required: true }, - owner_id: { type: Types.Long, required: true }, + owner_id: { type: String, required: true }, preferred_locale: String, premium_subscription_count: Number, premium_tier: Number, - public_updates_channel_id: Types.Long, + public_updates_channel_id: String, region: String, - rules_channel_id: Types.Long, + rules_channel_id: String, splash: String, system_channel_flags: Number, - system_channel_id: Types.Long, + 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: Types.Long, + widget_channel_id: String, widget_enabled: Boolean, }); -// GuildSchema.virtual +GuildSchema.virtual("channels", { + ref: ChannelModel, + localField: "id", + foreignField: "guild_id", + justOne: false, + autopopulate: true, +}); + +GuildSchema.virtual("roles", { + ref: RoleModel, + localField: "id", + foreignField: "guild_id", + justOne: false, + autopopulate: true, +}); + +// nested populate is needed for member users: https://gist.github.com/yangsu/5312204 +GuildSchema.virtual("members", { + ref: MemberModel, + localField: "id", + foreignField: "guild_id", + justOne: false, +}); + +GuildSchema.virtual("emojis", { + ref: EmojiModel, + localField: "id", + foreignField: "guild_id", + justOne: false, + autopopulate: true, +}); + +GuildSchema.virtual("joined_at", { + ref: MemberModel, + localField: "id", + foreignField: "guild_id", + justOne: true, +}).get((member: any, virtual: any, doc: any) => { + return member?.joined_at; +}); // @ts-ignore export const GuildModel = db.model("Guild", GuildSchema, "guilds"); diff --git a/src/models/Interaction.ts b/src/models/Interaction.ts index 6f36c14a..764247a5 100644 --- a/src/models/Interaction.ts +++ b/src/models/Interaction.ts @@ -1,12 +1,12 @@ import { AllowedMentions, Embed } from "./Message"; export interface Interaction { - id: bigint; + id: string; type: InteractionType; data?: {}; - guild_id: bigint; - channel_id: bigint; - member_id: bigint; + guild_id: string; + channel_id: string; + member_id: string; token: string; version: number; } diff --git a/src/models/Invite.ts b/src/models/Invite.ts index fc60b93c..41f33a02 100644 --- a/src/models/Invite.ts +++ b/src/models/Invite.ts @@ -1,5 +1,8 @@ import { Schema, Document, Types } from "mongoose"; import db from "../util/Database"; +import { ChannelModel } from "./Channel"; +import { UserModel } from "./User"; +import { GuildModel } from "./Guild"; export interface Invite extends Document { code: string; @@ -8,14 +11,13 @@ export interface Invite extends Document { max_uses: number; max_age: number; created_at: Date; - guild_id: bigint; - channel_id: bigint; - inviter_id: bigint; + guild_id: string; + channel_id: string; + inviter_id: string; - //! What the fucking shit is this - target_user_id?: bigint; + // ? What the fucking shit is this + target_user_id?: string; target_user_type?: number; - // ! } export const InviteSchema = new Schema({ @@ -25,14 +27,70 @@ export const InviteSchema = new Schema({ max_uses: Number, max_age: Number, created_at: Date, - guild_id: Types.Long, - channel_id: Types.Long, - inviter_id: Types.Long, + guild_id: String, + channel_id: String, + inviter_id: String, - //! What the fucking shit is this - target_user_id: Types.Long, + // ? What the fucking shit is this + target_user_id: String, target_user_type: Number, - // ! +}); + +InviteSchema.virtual("channel", { + ref: ChannelModel, + localField: "channel_id", + foreignField: "id", + justOne: true, + autopopulate: { + select: { + id: true, + name: true, + type: true, + }, + }, +}); + +InviteSchema.virtual("inviter", { + ref: UserModel, + localField: "inviter_id", + foreignField: "id", + justOne: true, + autopopulate: { + select: { + id: true, + username: true, + avatar: true, + discriminater: true, + public_flags: true, + }, + }, +}); + +InviteSchema.virtual("guild", { + ref: GuildModel, + localField: "guild_id", + foreignField: "id", + justOne: true, + autopopulate: { + select: { + id: true, + name: true, + splash: true, + banner: true, + description: true, + icon: true, + features: true, + verification_level: true, + vanity_url_code: true, + welcome_screen: true, + nsfw: true, + + // TODO: hide the following entries: + // channels: false, + // roles: false, + // emojis: false, + }, + }, }); // @ts-ignore diff --git a/src/models/Member.ts b/src/models/Member.ts index 145b5df4..52151235 100644 --- a/src/models/Member.ts +++ b/src/models/Member.ts @@ -1,12 +1,24 @@ -import { PublicUser, User, UserModel } from "./User"; +import { PublicUser, PublicUserProjection, User, UserModel } from "./User"; import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; +export const PublicMemberProjection = { + id: true, + guild_id: true, + nick: true, + roles: true, + joined_at: true, + pending: true, + deaf: true, + mute: true, + premium_since: true, +}; + export interface Member { - id: bigint; - guild_id: bigint; + id: string; + guild_id: string; nick?: string; - roles: bigint[]; + roles: string[]; joined_at: Date; premium_since?: number; deaf: boolean; @@ -17,12 +29,12 @@ export interface Member { } export interface MemberDocument extends Member, Document { - id: bigint; + id: string; } export interface UserGuildSettings { channel_overrides: { - channel_id: bigint; + channel_id: string; message_notifications: number; mute_config: MuteConfig; muted: boolean; @@ -47,10 +59,10 @@ const MuteConfig = { }; export const MemberSchema = new Schema({ - id: { type: Types.Long, required: true }, - guild_id: Types.Long, + id: { type: String, required: true }, + guild_id: String, nick: String, - roles: [Types.Long], + roles: [String], joined_at: Date, premium_since: Number, deaf: Boolean, @@ -59,7 +71,7 @@ export const MemberSchema = new Schema({ settings: { channel_overrides: [ { - channel_id: Types.Long, + channel_id: String, message_notifications: Number, mute_config: MuteConfig, muted: Boolean, @@ -80,6 +92,9 @@ MemberSchema.virtual("user", { localField: "id", foreignField: "id", justOne: true, + autopopulate: { + select: PublicUserProjection, + }, }); // @ts-ignore diff --git a/src/models/Message.ts b/src/models/Message.ts index 7d9ff184..15ff57d3 100644 --- a/src/models/Message.ts +++ b/src/models/Message.ts @@ -1,29 +1,30 @@ import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; -import { UserModel } from "./User"; -import { MemberModel } from "./Member"; -import { RoleModel } from "./Role"; +import { PublicUser, PublicUserProjection, UserModel } from "./User"; +import { MemberModel, PublicMember, PublicMemberProjection } from "./Member"; +import { Role, RoleModel } from "./Role"; +import { Channel } from "./Channel"; export interface Message { - id: bigint; - channel_id: bigint; - guild_id?: bigint; - author_id?: bigint; - webhook_id?: bigint; - application_id?: bigint; + 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: bigint[]; - mention_role_ids: bigint[]; - mention_channels_ids: bigint[]; + mention_everyone?: boolean; + mention_user_ids: string[]; + mention_role_ids: string[]; + mention_channels_ids: string[]; attachments: Attachment[]; embeds: Embed[]; - reactions?: Reaction[]; + reactions: Reaction[]; nonce?: string | number; - pinned: boolean; + pinned?: boolean; type: MessageType; activity?: { type: number; @@ -32,14 +33,20 @@ export interface Message { flags?: bigint; stickers?: []; message_reference?: { - message_id: bigint; - channel_id?: bigint; - guild_id?: bigint; + message_id: string; + channel_id?: string; + guild_id?: string; }; + // mongoose virtuals: + author?: PublicUser; + member?: PublicMember; + mentions?: PublicUser[]; + mention_roles?: Role[]; + mention_channels?: Channel[]; } export interface MessageDocument extends Document, Message { - id: bigint; + id: string; } export enum MessageType { @@ -63,7 +70,7 @@ export enum MessageType { } export interface Attachment { - id: bigint; // attachment id + id: string; // attachment id filename: string; // name of file attached size: number; // size of file in bytes url: string; // source url of file @@ -118,20 +125,20 @@ export interface Reaction { } export interface PartialEmoji { - id?: bigint; + id?: string; name: string; animated?: boolean; } export interface AllowedMentions { parse?: ("users" | "roles" | "everyone")[]; - roles?: bigint[]; - users?: bigint[]; + roles?: string[]; + users?: string[]; replied_user?: boolean; } export const Attachment = { - id: Types.Long, // attachment id + id: String, // attachment id filename: String, // name of file attached size: Number, // size of file in bytes url: String, // source url of file @@ -150,7 +157,7 @@ export const EmbedImage = { const Reaction = { count: Number, emoji: { - id: Types.Long, + id: String, name: String, animated: Boolean, }, @@ -191,20 +198,20 @@ export const Embed = { }; export const MessageSchema = new Schema({ - id: Types.Long, - channel_id: Types.Long, - author_id: Types.Long, - webhook_id: Types.Long, - guild_id: Types.Long, - application_id: Types.Long, + 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: [Types.Long], - mention_role_ids: [Types.Long], - mention_channel_ids: [Types.Long], + mention_user_ids: [String], + mention_role_ids: [String], + mention_channel_ids: [String], attachments: [Attachment], embeds: [Embed], reactions: [Reaction], @@ -218,10 +225,18 @@ export const MessageSchema = new Schema({ flags: Types.Long, stickers: [], message_reference: { - message_id: Types.Long, - channel_id: Types.Long, - guild_id: Types.Long, + message_id: String, + channel_id: String, + guild_id: String, }, + // virtual: + // author: { + // ref: UserModel, + // localField: "author_id", + // foreignField: "id", + // justOne: true, + // autopopulate: { select: { id: true, user_data: false } }, + // }, }); MessageSchema.virtual("author", { @@ -229,6 +244,7 @@ MessageSchema.virtual("author", { localField: "author_id", foreignField: "id", justOne: true, + autopopulate: { select: PublicUserProjection }, }); MessageSchema.virtual("member", { @@ -242,23 +258,28 @@ MessageSchema.virtual("mentions", { ref: UserModel, localField: "mention_user_ids", foreignField: "id", - justOne: true, + justOne: false, + autopopulate: { select: PublicUserProjection }, }); MessageSchema.virtual("mention_roles", { ref: RoleModel, localField: "mention_role_ids", foreignField: "id", - justOne: true, + justOne: false, + autopopulate: true, }); MessageSchema.virtual("mention_channels", { ref: RoleModel, - localField: "mention_role_ids", + localField: "mention_channel_ids", foreignField: "id", - justOne: true, + justOne: false, + autopopulate: { select: { id: true, guild_id: true, type: true, name: true } }, }); +MessageSchema.set("removeResponse", ["mention_channel_ids", "mention_role_ids", "mention_user_ids", "author_id"]); + // TODO: missing Application Model // MessageSchema.virtual("application", { // ref: Application, diff --git a/src/models/Role.ts b/src/models/Role.ts index fe716593..c1111c84 100644 --- a/src/models/Role.ts +++ b/src/models/Role.ts @@ -1,9 +1,10 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; +import toBigInt from "../util/toBigInt"; export interface Role { - id: bigint; - guild_id: bigint; + id: string; + guild_id: string; color: number; hoist: boolean; managed: boolean; @@ -12,28 +13,30 @@ export interface Role { permissions: bigint; position: number; tags?: { - bot_id?: bigint; + bot_id?: string; }; } export interface RoleDocument extends Document, Role { - id: bigint; + id: string; } export const RoleSchema = new Schema({ - id: Types.Long, - guild_id: Types.Long, + id: String, + guild_id: String, color: Number, hoist: Boolean, managed: Boolean, mentionable: Boolean, name: String, - permissions: Types.Long, + permissions: { type: String, get: toBigInt }, position: Number, tags: { - bot_id: Types.Long, + bot_id: String, }, }); +RoleSchema.set("removeResponse", ["guild_id"]); + // @ts-ignore export const RoleModel = db.model("Role", RoleSchema, "roles"); diff --git a/src/models/User.ts b/src/models/User.ts index 971e8d20..8cec334b 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -1,14 +1,21 @@ -import { Activity } from "./Activity"; +import { Activity, ActivitySchema } from "./Activity"; import { ClientStatus, Status } from "./Status"; import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; +import toBigInt from "../util/toBigInt"; +export const PublicUserProjection = { + username: true, + discriminator: true, + id: true, + public_flags: true, + avatar: true, +}; export interface User { - id: bigint; + id: string; username: string; // username max length 32, min 2 discriminator: string; // #0001 4 digit long string from #0001 - #9999 avatar: string | null; // hash of the user avatar - fingerprints: string[]; // array of fingerprints -> used to prevent multiple accounts phone?: string; // phone number of the user desktop: boolean; // if the user has desktop app installed mobile: boolean; // if the user has mobile app installed @@ -16,7 +23,6 @@ export interface User { premium_type: number; // nitro level bot: boolean; // if user is bot system: boolean; // shouldn't be used, the api sents this field type true, if the genetaed message comes from a system generated author - level: string; // organization permission level (owner, moderator, user) nsfw_allowed: boolean; // if the user is older than 18 (resp. Config) mfa_enabled: boolean; // if multi factor authentication is enabled created_at: Date; // registration date @@ -24,12 +30,9 @@ export interface User { email?: string; // email of the user flags: bigint; // UserFlags public_flags: bigint; - hash: string; // hash of the password, salt is saved in password (bcrypt) - guilds: bigint[]; // array of guild ids the user is part of - valid_tokens_since: Date; // all tokens with a previous issue date are invalid user_settings: UserSettings; - relationships: Relationship[]; - connected_accounts: ConnectedAccount[]; + guilds: string[]; // array of guild ids the user is part of + user_data: UserData; presence: { status: Status; activities: Activity[]; @@ -37,12 +40,21 @@ export interface User { }; } +// Privat user data: +export interface UserData { + valid_tokens_since: Date; // all tokens with a previous issue date are invalid + relationships: Relationship[]; + connected_accounts: ConnectedAccount[]; + hash: string; // hash of the password, salt is saved in password (bcrypt) + fingerprints: string[]; // array of fingerprints -> used to prevent multiple accounts +} + export interface UserDocument extends User, Document { - id: bigint; + id: string; } export interface PublicUser { - id: bigint; + id: string; discriminator: string; username: string; avatar?: string; @@ -62,10 +74,10 @@ export interface ConnectedAccount { } export interface Relationship { - id: bigint; + id: string; nickname?: string; type: number; - user_id: bigint; + user_id: string; } export interface UserSettings { @@ -76,7 +88,7 @@ export interface UserSettings { contact_sync_enabled: boolean; convert_emoticons: boolean; custom_status: { - emoji_id: bigint | null; + emoji_id: string | null; emoji_name: string | null; expires_at: number | null; text: string | null; @@ -93,11 +105,11 @@ export interface UserSettings { guild_folders: // every top guild is displayed as a "folder" { color: number; - guild_ids: bigint[]; + guild_ids: string[]; id: number; name: string; }[]; - guild_positions: bigint[]; // guild ids ordered by position + guild_positions: string[]; // guild ids ordered by position inline_attachment_media: boolean; inline_embed_media: boolean; locale: string; // en_US @@ -105,7 +117,7 @@ export interface UserSettings { native_phone_integration_enabled: boolean; render_embeds: boolean; render_reactions: boolean; - restricted_guilds: bigint[]; + restricted_guilds: string[]; show_current_game: boolean; status: "online" | "offline" | "dnd" | "idle"; stream_notifications_enabled: boolean; @@ -114,11 +126,10 @@ export interface UserSettings { } export const UserSchema = new Schema({ - id: Types.Long, + id: String, username: String, discriminator: String, avatar: String, - fingerprints: [String], phone: String, desktop: Boolean, mobile: Boolean, @@ -131,11 +142,35 @@ export const UserSchema = new Schema({ created_at: Date, verified: Boolean, email: String, - flags: Types.Long, // TODO: automatically convert Types.Long to BitField of UserFlags - public_flags: Types.Long, - hash: String, // hash of the password, salt is saved in password (bcrypt) - guilds: [Types.Long], // array of guild ids the user is part of - valid_tokens_since: Date, // all tokens with a previous issue date are invalid + flags: { type: String, get: toBigInt }, // TODO: automatically convert Types.Long to BitField of UserFlags + public_flags: { type: String, get: toBigInt }, + guilds: [String], // array of guild ids the user is part of + user_data: { + fingerprints: [String], + hash: String, // hash of the password, salt is saved in password (bcrypt) + valid_tokens_since: Date, // all tokens with a previous issue date are invalid + 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, @@ -144,7 +179,7 @@ export const UserSchema = new Schema({ contact_sync_enabled: Boolean, convert_emoticons: Boolean, custom_status: { - emoji_id: Types.Long, + emoji_id: String, emoji_name: String, expires_at: Number, text: String, @@ -162,12 +197,12 @@ export const UserSchema = new Schema({ guild_folders: [ { color: Number, - guild_ids: [Types.Long], + guild_ids: [String], id: Number, name: String, }, ], - guild_positions: [Types.Long], // guild ids ordered by position + guild_positions: [String], // guild ids ordered by position inline_attachment_media: Boolean, inline_embed_media: Boolean, locale: String, // en_US @@ -175,37 +210,17 @@ export const UserSchema = new Schema({ native_phone_integration_enabled: Boolean, render_embeds: Boolean, render_reactions: Boolean, - restricted_guilds: [Types.Long], + restricted_guilds: [String], show_current_game: Boolean, status: String, stream_notifications_enabled: Boolean, theme: String, // dark timezone_offset: Number, // e.g -60, }, - relationships: [ - { - id: Types.Long, - nickname: String, - type: Number, - user_id: Types.Long, - }, - ], - connected_accounts: [ - { - access_token: String, - friend_sync: Boolean, - id: String, - name: String, - revoked: Boolean, - show_activity: Boolean, - type: String, - verifie: Boolean, - visibility: Number, - }, - ], + presence: { status: String, - activities: [Activity], + activities: [ActivitySchema], client_status: ClientStatus, }, }); diff --git a/src/models/VoiceState.ts b/src/models/VoiceState.ts index 30439feb..c1f90edd 100644 --- a/src/models/VoiceState.ts +++ b/src/models/VoiceState.ts @@ -3,9 +3,9 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; export interface VoiceState extends Document { - guild_id?: bigint; - channel_id: bigint; - user_id: bigint; + guild_id?: string; + channel_id: string; + user_id: string; session_id: string; deaf: boolean; mute: boolean; @@ -17,9 +17,9 @@ export interface VoiceState extends Document { } export const VoiceSateSchema = new Schema({ - guild_id: Types.Long, - channel_id: Types.Long, - user_id: Types.Long, + guild_id: String, + channel_id: String, + user_id: String, session_id: String, deaf: Boolean, mute: Boolean, diff --git a/src/models/index.ts b/src/models/index.ts new file mode 100644 index 00000000..5752e60d --- /dev/null +++ b/src/models/index.ts @@ -0,0 +1,36 @@ +import mongoose from "mongoose"; +import { Schema } from "mongoose"; +import mongooseAutoPopulate from "mongoose-autopopulate"; + +mongoose.plugin(mongooseAutoPopulate); + +mongoose.plugin((schema: Schema, opts: any) => { + schema.set("toObject", { + virtuals: true, + versionKey: false, + transform(doc: any, ret: any) { + delete ret._id; + delete ret.__v; + const props = schema.get("removeResponse") || []; + props.forEach((prop: string) => { + delete ret[prop]; + }); + }, + }); +}); + +export * from "./Activity"; +export * from "./Application"; +export * from "./Ban"; +export * from "./Channel"; +export * from "./Emoji"; +export * from "./Event"; +export * from "./Guild"; +export * from "./Invite"; +export * from "./Interaction"; +export * from "./Member"; +export * from "./Message"; +export * from "./Status"; +export * from "./Role"; +export * from "./User"; +export * from "./VoiceState"; diff --git a/src/util/Database.ts b/src/util/Database.ts index 2304378c..339ac65b 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -1,13 +1,31 @@ import "./MongoBigInt"; -import mongoose, { Collection, Connection } from "mongoose"; +import mongoose, { Collection, Connection, LeanDocument } from "mongoose"; import { ChangeStream, ChangeEvent, Long } from "mongodb"; import EventEmitter from "events"; +import { Document } from "mongoose"; const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPreference=secondaryPreferred"; -const connection = mongoose.createConnection(uri, { autoIndex: true }); +console.log(`[DB] connect: ${uri}`); + +const connection = mongoose.createConnection(uri, { + autoIndex: true, + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, +}); export default connection; +function transform(document: T) { + // @ts-ignore + return document.toObject({ virtuals: true }); +} + +export function toObject(document: T): LeanDocument { + // @ts-ignore + return Array.isArray(document) ? document.map((x) => transform(x)) : transform(document); +} + export interface MongooseCache { on(event: "delete", listener: (id: string) => void): this; on(event: "change", listener: (data: any) => void): this; @@ -29,7 +47,8 @@ export class MongooseCache extends EventEmitter { super(); } - async init() { + init = async () => { + // @ts-ignore this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" }); this.stream.on("change", this.change); @@ -40,9 +59,15 @@ export class MongooseCache extends EventEmitter { const arr = await this.collection.aggregate(this.pipeline).toArray(); this.data = arr.length ? arr[0] : arr; } - } + }; - convertResult(obj: any) { + changeStream = (pipeline: any) => { + this.pipeline = pipeline; + this.destroy(); + this.init(); + }; + + convertResult = (obj: any) => { if (obj instanceof Long) return BigInt(obj.toString()); if (typeof obj === "object") { Object.keys(obj).forEach((key) => { @@ -51,40 +76,44 @@ export class MongooseCache extends EventEmitter { } return obj; - } + }; change = (doc: ChangeEvent) => { - // @ts-ignore - if (doc.fullDocument) { + try { // @ts-ignore - if (!this.opts.onlyEvents) this.data = doc.fullDocument; - } + 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; + 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); } }; - destroy() { - this.stream.off("change", this.change); + destroy = () => { + this.stream?.off("change", this.change); this.emit("close"); if (this.stream.isClosed()) return; return this.stream.close(); - } + }; } diff --git a/src/util/MongoBigInt.ts b/src/util/MongoBigInt.ts index c4e5f623..fc451925 100644 --- a/src/util/MongoBigInt.ts +++ b/src/util/MongoBigInt.ts @@ -44,7 +44,7 @@ class LongSchema extends mongoose.SchemaType { if (val instanceof Number || "number" == typeof val) return BigInt(val); if (!Array.isArray(val) && val.toString) return BigInt(val.toString()); - // @ts-ignore + //@ts-ignore throw new SchemaType.CastError("Long", val); } diff --git a/src/util/Permissions.ts b/src/util/Permissions.ts index ae21e138..c7a41594 100644 --- a/src/util/Permissions.ts +++ b/src/util/Permissions.ts @@ -97,6 +97,16 @@ export class Permissions extends BitField { return (checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.has(permission); } + /** + * Checks whether the bitfield has a permission, or multiple permissions, but throws an Error if user fails to match auth criteria. + */ + hasThrow(permission: PermissionResolvable, checkAdmin = true) { + if ((checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.has(permission)) { + return true; + } + throw new Error(`User doesn't fulfill the following permission criteria: ${permission}`); + } + static channelPermission(overwrites: ChannelPermissionOverwrite[], init?: bigint) { // TODO: do not deny any permissions if admin return overwrites.reduce((permission, overwrite) => { @@ -121,7 +131,7 @@ export class Permissions extends BitField { guild, channel, }: { - user: { id: bigint; roles: bigint[] }; + user: { id: string; roles: string[] }; guild: { roles: Role[] }; channel?: { overwrites?: ChannelPermissionOverwrite[]; @@ -144,22 +154,24 @@ export class Permissions extends BitField { } export async function getPermission( - user_id: bigint, - guild_id: bigint, - channel_id?: bigint, - cache?: { channel?: ChannelDocument | null; member?: MemberDocument | null } + user_id: string, + guild_id: string, + channel_id?: string, + cache?: { channel?: ChannelDocument | null; member?: MemberDocument | null; guild?: GuildDocument | null } ) { - var { channel, member } = cache || {}; + var { channel, member, guild } = cache || {}; - const guild = await GuildModel.findOne({ id: guild_id }, { owner_id: true }).exec(); + if (!guild) guild = await 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 MemberModel.findOne({ guild_id, id: user_id }, "roles").exec(); + if (!member) member = await MemberModel.findOne({ guild_id, id: user_id }, "roles").exec(); if (!member) throw new Error("Member not found"); - var roles = await RoleModel.find({ guild_id, id: { $in: member.roles } }).exec(); - if (channel_id) { + var roles = await RoleModel.find({ guild_id, id: { $in: member.roles } }) + .lean() + .exec(); + if (channel_id && !channel) { channel = await ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec(); } diff --git a/src/util/Snowflake.ts b/src/util/Snowflake.ts index 9e94bbd9..1ccae43c 100644 --- a/src/util/Snowflake.ts +++ b/src/util/Snowflake.ts @@ -87,7 +87,7 @@ export class Snowflake { var worker = Snowflake.workerId << 17n; var process = Snowflake.processId << 12n; var increment = Snowflake.INCREMENT++; - return time | worker | process | increment; + return (time | worker | process | increment).toString(); } /** diff --git a/src/util/checkToken.ts b/src/util/checkToken.ts index b4635126..d5a128b4 100644 --- a/src/util/checkToken.ts +++ b/src/util/checkToken.ts @@ -4,7 +4,7 @@ import Config from "./Config"; export function checkToken(token: string): Promise { return new Promise((res, rej) => { - jwt.verify(token, Config.getAll().api.security.jwtSecret, JWTOptions, (err, decoded: any) => { + jwt.verify(token, Config.getAll()?.api?.security?.jwtSecret, JWTOptions, (err, decoded: any) => { if (err || !decoded) return rej("Invalid Token"); return res(decoded); diff --git a/src/util/index.ts b/src/util/index.ts new file mode 100644 index 00000000..7e8bca20 --- /dev/null +++ b/src/util/index.ts @@ -0,0 +1,8 @@ +export * from "./String"; +export * from "./BitField"; +export * from "./Intents"; +export * from "./MessageFlags"; +export * from "./Permissions"; +export * from "./Snowflake"; +export * from "./UserFlags"; +export * from "./toBigInt" \ No newline at end of file diff --git a/src/util/toBigInt.ts b/src/util/toBigInt.ts new file mode 100644 index 00000000..d57c4568 --- /dev/null +++ b/src/util/toBigInt.ts @@ -0,0 +1,3 @@ +export default function toBigInt(string: String): BigInt { + return BigInt(string); +} 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 */