1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 13:14:06 +01:00
This commit is contained in:
xnacly 2021-04-08 15:56:11 +02:00
commit f01fe1ba3a
114 changed files with 841 additions and 3576 deletions

3
.gitignore vendored
View File

@ -102,3 +102,6 @@ typings/
# TernJS port file # TernJS port file
.tern-port .tern-port
.DS_Store .DS_Store
# Compiled TypeScript code
dist/

111
LICENSE
View File

@ -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 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.
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:
The above copyright notice and this permission notice shall be included in all Section 1 Definitions.
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 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.
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 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.
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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.
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 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.
SOFTWARE. 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 Adapters 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 Adapters 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.

View File

@ -1 +1,9 @@
# server-util # 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/"
```

27
dist/index.d.ts vendored
View File

@ -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 };

56
dist/index.js vendored
View File

@ -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

1
dist/index.js.map vendored
View File

@ -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"}

View File

@ -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
}

View File

@ -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

View File

@ -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"}

View File

@ -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[];
}

View File

@ -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

View File

@ -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"}

View File

@ -1,187 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
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<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const AuditLogModel: import("mongoose").Model<AuditLogEntries>;
export declare enum AuditLogEvents {
GUILD_UPDATE = 1,
CHANNEL_CREATE = 10,
CHANNEL_UPDATE = 11,
CHANNEL_DELETE = 12,
CHANNEL_OVERWRITE_CREATE = 13,
CHANNEL_OVERWRITE_UPDATE = 14,
CHANNEL_OVERWRITE_DELETE = 15,
MEMBER_KICK = 20,
MEMBER_PRUNE = 21,
MEMBER_BAN_ADD = 22,
MEMBER_BAN_REMOVE = 23,
MEMBER_UPDATE = 24,
MEMBER_ROLE_UPDATE = 25,
MEMBER_MOVE = 26,
MEMBER_DISCONNECT = 27,
BOT_ADD = 28,
ROLE_CREATE = 30,
ROLE_UPDATE = 31,
ROLE_DELETE = 32,
INVITE_CREATE = 40,
INVITE_UPDATE = 41,
INVITE_DELETE = 42,
WEBHOOK_CREATE = 50,
WEBHOOK_UPDATE = 51,
WEBHOOK_DELETE = 52,
EMOJI_CREATE = 60,
EMOJI_UPDATE = 61,
EMOJI_DELETE = 62,
MESSAGE_DELETE = 72,
MESSAGE_BULK_DELETE = 73,
MESSAGE_PIN = 74,
MESSAGE_UNPIN = 75,
INTEGRATION_CREATE = 80,
INTEGRATION_UPDATE = 81,
INTEGRATION_DELETE = 82
}

View File

@ -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=A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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"}

11
dist/models/Ban.d.ts vendored
View File

@ -1,11 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
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<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const BanModel: import("mongoose").Model<Ban>;

18
dist/models/Ban.js vendored
View File

@ -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

View File

@ -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"}

View File

@ -1,55 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
import { Schema, Document } from "mongoose";
export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel {
}
export interface ChannelDocument extends Document, AnyChannel {
id: bigint;
}
export declare const ChannelSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const ChannelModel: import("mongoose").Model<ChannelDocument>;
export interface Channel {
id: 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
}

View File

@ -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

View File

@ -1 +0,0 @@
{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../../src/models/Channel.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAQrB,QAAA,aAAa,GAAG,IAAI,iBAAM,CAAC;IACvC,EAAE,EAAE,gBAAK,CAAC,IAAI;IACd,UAAU,EAAE,EAAE,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,SAAS,EAAE,gBAAK,CAAC,IAAI;IACrB,UAAU,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM;IAChB,eAAe,EAAE,gBAAK,CAAC,IAAI;IAC3B,kBAAkB,EAAE,IAAI;IACxB,IAAI,EAAE,OAAO;IACb,mBAAmB,EAAE,MAAM;IAC3B,KAAK,EAAE,MAAM;IACb,qBAAqB,EAAE;QACtB;YACC,KAAK,EAAE,gBAAK,CAAC,IAAI;YACjB,IAAI,EAAE,gBAAK,CAAC,IAAI;YAChB,EAAE,EAAE,gBAAK,CAAC,IAAI;YACd,IAAI,EAAE,MAAM;SACZ;KACD;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,YAAY,GAAG,kBAAE,CAAC,KAAK,CAAkB,SAAS,EAAE,qBAAa,EAAE,UAAU,CAAC,CAAC;AA4B5F,IAAY,8BAGX;AAHD,WAAY,8BAA8B;IACzC,mFAAQ,CAAA;IACR,uFAAU,CAAA;AACX,CAAC,EAHW,8BAA8B,GAA9B,sCAA8B,KAA9B,sCAA8B,QAGzC;AAeD,IAAY,WAQX;AARD,WAAY,WAAW;IACtB,yDAAc,CAAA;IACd,yCAAM,CAAA;IACN,2DAAe,CAAA;IACf,qDAAY,CAAA;IACZ,iEAAkB,CAAA;IAClB,yDAAc,CAAA;IACd,2DAAe,CAAA;AAChB,CAAC,EARW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAQtB"}

View File

@ -1,15 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
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<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const EmojiModel: import("mongoose").Model<Emoji>;

22
dist/models/Emoji.js vendored
View File

@ -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

View File

@ -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"}

357
dist/models/Event.d.ts vendored
View File

@ -1,357 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
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<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const EventModel: import("mongoose").Model<EventDocument>;
export interface InvalidatedEvent extends Event {
event: "INVALIDATED";
}
export interface ReadyEvent extends Event {
event: "READY";
data: {
v: number;
user: Omit<User, "guilds" | "user_settings" | "valid_tokens_since" | "connected_accounts" | "relationships">;
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<Invite, "guild" | "channel"> & {
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<Message, "author_id"> & {
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";

19
dist/models/Event.js vendored
View File

@ -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

View File

@ -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"}

View File

@ -1,44 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
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<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const GuildModel: import("mongoose").Model<GuildDocument>;

50
dist/models/Guild.js vendored
View File

@ -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

View File

@ -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"}

View File

@ -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;
}

View File

@ -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

View File

@ -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"}

View File

@ -1,17 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
import { Schema, Document } from "mongoose";
export interface Invite extends Document {
code: string;
temporary: boolean;
uses: number;
max_uses: number;
max_age: number;
created_at: Date;
guild_id: bigint;
channel_id: bigint;
inviter_id: bigint;
target_user_id?: bigint;
target_user_type?: number;
}
export declare const InviteSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const InviteModel: import("mongoose").Model<Invite>;

25
dist/models/Invite.js vendored
View File

@ -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

View File

@ -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"}

View File

@ -1,43 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
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<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const MemberModel: import("mongoose").Model<MemberDocument>;
export interface PublicMember extends Omit<Member, "settings" | "id"> {
user: PublicUser;
}

50
dist/models/Member.js vendored
View File

@ -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

View File

@ -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"}

View File

@ -1,181 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
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: Date;
edited_timestamp?: Date;
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?: Date;
color?: number;
footer?: {
text: string;
icon_url?: string;
proxy_icon_url?: string;
};
image?: EmbedImage;
thumbnail?: EmbedImage;
video?: EmbedImage;
provider?: {
name?: string;
url?: string;
};
author?: {
name?: string;
url?: string;
icon_url?: string;
proxy_icon_url?: string;
};
fields?: {
name: string;
value: string;
inline?: boolean;
}[];
}
export interface EmbedImage {
url?: string;
proxy_url?: string;
height?: number;
width?: number;
}
export interface Reaction {
count: number;
emoji: PartialEmoji;
}
export interface PartialEmoji {
id?: 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: DateConstructor;
color: NumberConstructor;
footer: {
text: StringConstructor;
icon_url: StringConstructor;
proxy_icon_url: StringConstructor;
};
image: {
url: StringConstructor;
proxy_url: StringConstructor;
height: NumberConstructor;
width: NumberConstructor;
};
thumbnail: {
url: StringConstructor;
proxy_url: StringConstructor;
height: NumberConstructor;
width: NumberConstructor;
};
video: {
url: StringConstructor;
proxy_url: StringConstructor;
height: NumberConstructor;
width: NumberConstructor;
};
provider: {
name: StringConstructor;
url: StringConstructor;
};
author: {
name: StringConstructor;
url: StringConstructor;
icon_url: StringConstructor;
proxy_icon_url: StringConstructor;
};
fields: {
name: StringConstructor;
value: StringConstructor;
inline: BooleanConstructor;
}[];
};
export declare const MessageSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const MessageModel: import("mongoose").Model<MessageDocument>;

160
dist/models/Message.js vendored
View File

@ -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: Date,
color: Number,
footer: {
text: String,
icon_url: String,
proxy_icon_url: String,
},
image: exports.EmbedImage,
thumbnail: exports.EmbedImage,
video: exports.EmbedImage,
provider: {
name: String,
url: String,
},
author: {
name: String,
url: String,
icon_url: String,
proxy_icon_url: String,
},
fields: [
{
name: String,
value: String,
inline: Boolean,
},
],
};
exports.MessageSchema = new mongoose_1.Schema({
id: 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: Date,
edited_timestamp: Date,
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

View File

@ -1 +0,0 @@
{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../src/models/Message.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAClC,iCAAmC;AACnC,qCAAuC;AACvC,iCAAmC;AAwCnC,IAAY,WAkBX;AAlBD,WAAY,WAAW;IACtB,mDAAW,CAAA;IACX,+DAAiB,CAAA;IACjB,qEAAoB,CAAA;IACpB,6CAAQ,CAAA;IACR,2EAAuB,CAAA;IACvB,2EAAuB,CAAA;IACvB,iFAA0B,CAAA;IAC1B,uEAAqB,CAAA;IACrB,mGAAmC,CAAA;IACnC,iHAA0C,CAAA;IAC1C,kHAA2C,CAAA;IAC3C,kHAA2C,CAAA;IAC3C,0EAAuB,CAAA;IACvB,8FAAiC,CAAA;IACjC,4FAAgC,CAAA;IAChC,gDAAU,CAAA;IACV,4EAAwB,CAAA;AACzB,CAAC,EAlBW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAkBtB;AAsEY,QAAA,UAAU,GAAG;IACzB,EAAE,EAAE,gBAAK,CAAC,IAAI;IACd,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;CACb,CAAC;AAEW,QAAA,UAAU,GAAG;IACzB,GAAG,EAAE,MAAM;IACX,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,QAAQ,GAAG;IAChB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE;QACN,EAAE,EAAE,gBAAK,CAAC,IAAI;QACd,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,OAAO;KACjB;CACD,CAAC;AAEW,QAAA,KAAK,GAAG;IACpB,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MA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yC;AACzC,qBAAqB;AACrB,mCAAmC;AACnC,uBAAuB;AACvB,kBAAkB;AAClB,MAAM;AAEN,aAAa;AACA,QAAA,YAAY,GAAG,kBAAE,CAAC,KAAK,CAAkB,SAAS,EAAE,qBAAa,EAAE,UAAU,CAAC,CAAC"}

21
dist/models/Role.d.ts vendored
View File

@ -1,21 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
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<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const RoleModel: import("mongoose").Model<RoleDocument>;

25
dist/models/Role.js vendored
View File

@ -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

View File

@ -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"}

View File

@ -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;
};

View File

@ -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

View File

@ -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"}

111
dist/models/User.d.ts vendored
View File

@ -1,111 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
import { Activity } from "./Activity";
import { ClientStatus, Status } from "./Status";
import { Schema, Document } from "mongoose";
export interface User {
id: 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<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const UserModel: import("mongoose").Model<UserDocument>;

109
dist/models/User.js vendored
View File

@ -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

View File

@ -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;IACjB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,gBAAK,CAAC,IAAI;IACjB,YAAY,EAAE,gBAAK,CAAC,IAAI;IACxB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;IACpB,kBAAkB,EAAE,IAAI;IACxB,aAAa,EAAE;QACd,WAAW,EAAE,MAAM;QACnB,6BAA6B,EAAE,OAAO;QACtC,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,MAAM;QACxB,oBAAoB,EAAE,OAAO;QAC7B,iBAAiB,EAAE,OAAO;QAC1B,aAAa,EAAE;YACd,QAAQ,EAAE,gBAAK,CAAC,IAAI;YACpB,UAAU,EAAE,MAAM;YAClB,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,MAAM;SACZ;QACD,yBAAyB,EAAE,OAAO;QAClC,wBAAwB,EAAE,OAAO;QACjC,cAAc,EAAE,OAAO;QACvB,iBAAiB,EAAE,OAAO;QAC1B,kBAAkB,EAAE,OAAO;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ACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"}

View File

@ -1,17 +0,0 @@
/// <reference path="../util/MongoBigInt.d.ts" />
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<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const VoiceStateModel: import("mongoose").Model<VoiceState>;

View File

@ -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

View File

@ -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"}

View File

@ -1,66 +0,0 @@
export declare type BitFieldResolvable = number | BigInt | BitField | string | BitFieldResolvable[];
/**
* Data structure that makes it easy to interact with a bitfield.
*/
export declare class BitField {
bitfield: bigint;
static FLAGS: Record<string, bigint>;
constructor(bits?: BitFieldResolvable);
/**
* Checks whether the bitfield has a bit, or any of multiple bits.
*/
any(bit: BitFieldResolvable): boolean;
/**
* Checks if this bitfield equals another
*/
equals(bit: BitFieldResolvable): boolean;
/**
* Checks whether the bitfield has a bit, or multiple bits.
*/
has(bit: BitFieldResolvable): boolean;
/**
* Gets all given bits that are missing from the bitfield.
*/
missing(bits: BitFieldResolvable): BitFieldResolvable[];
/**
* Freezes these bits, making them immutable.
*/
freeze(): Readonly<BitField>;
/**
* Adds bits to these ones.
* @param {...BitFieldResolvable} [bits] Bits to add
* @returns {BitField} These bits or new BitField if the instance is frozen.
*/
add(...bits: BitFieldResolvable[]): BitField;
/**
* Removes bits from these.
* @param {...BitFieldResolvable} [bits] Bits to remove
*/
remove(...bits: BitFieldResolvable[]): BitField;
/**
* Gets an object mapping field names to a {@link boolean} indicating whether the
* bit is available.
* @param {...*} hasParams Additional parameters for the has method, if any
*/
serialize(): Record<string, boolean>;
/**
* Gets an {@link Array} of bitfield names based on the bits available.
*/
toArray(): string[];
toJSON(): bigint;
valueOf(): bigint;
[Symbol.iterator](): Generator<string, void, undefined>;
/**
* Data that can be resolved to give a bitfield. This can be:
* * A bit number (this can be a number literal or a value taken from {@link BitField.FLAGS})
* * An instance of BitField
* * An Array of BitFieldResolvable
* @typedef {number|BitField|BitFieldResolvable[]} BitFieldResolvable
*/
/**
* Resolves bitfields to their numeric form.
* @param {BitFieldResolvable} [bit=0] - bit(s) to resolve
* @returns {number}
*/
static resolve(bit?: BitFieldResolvable): bigint;
}

133
dist/util/BitField.js vendored
View File

@ -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

View File

@ -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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/>
import { Schema, Document } from "mongoose";
import "missing-native-js-functions";
declare const _default: {
init: (defaultOpts?: any) => Promise<import("mongodb").UpdateWriteOpResult>;
getAll: () => DefaultOptions;
setAll: (val: any) => Promise<import("mongodb").UpdateWriteOpResult>;
};
export default _default;
export declare const DefaultOptions: {
api: {};
gateway: {};
voice: {};
};
export interface DefaultOptions extends Document {
api?: any;
gateway?: any;
voice?: any;
}
export declare const ConfigSchema: Schema<Document<any>, import("mongoose").Model<Document<any>>, undefined>;
export declare const ConfigModel: import("mongoose").Model<DefaultOptions>;

50
dist/util/Config.js vendored
View File

@ -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

View File

@ -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"}

View File

@ -1,2 +0,0 @@
import { VerifyOptions } from "jsonwebtoken";
export declare const JWTOptions: VerifyOptions;

View File

@ -1,5 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JWTOptions = void 0;
exports.JWTOptions = { algorithms: ["HS256"] };
//# sourceMappingURL=Constants.js.map

View File

@ -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"}

View File

@ -1,29 +0,0 @@
/// <reference types="node" />
import "./MongoBigInt";
import mongoose, { Collection } from "mongoose";
import { ChangeStream, ChangeEvent } from "mongodb";
import EventEmitter from "events";
declare const _default: mongoose.Connection;
export default _default;
export interface MongooseCache {
on(event: "delete", listener: (id: string) => void): this;
on(event: "change", listener: (data: any) => void): this;
on(event: "insert", listener: (data: any) => void): this;
on(event: "close", listener: () => void): this;
}
export declare class MongooseCache extends EventEmitter {
collection: Collection;
pipeline: Array<Record<string, unknown>>;
opts: {
onlyEvents: boolean;
};
stream: ChangeStream;
data: any;
constructor(collection: Collection, pipeline: Array<Record<string, unknown>>, opts: {
onlyEvents: boolean;
});
init(): Promise<void>;
convertResult(obj: any): any;
change: (doc: ChangeEvent) => boolean | Promise<any> | undefined;
destroy(): Promise<any> | undefined;
}

75
dist/util/Database.js vendored
View File

@ -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

View File

@ -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,EAA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EMBERS: bigint;
GUILD_BANS: bigint;
GUILD_EMOJIS: bigint;
GUILD_INTEGRATIONS: bigint;
GUILD_WEBHOOKS: bigint;
GUILD_INVITES: bigint;
GUILD_VOICE_STATES: bigint;
GUILD_PRESENCES: bigint;
GUILD_MESSAGES: bigint;
GUILD_MESSAGE_REACTIONS: bigint;
GUILD_MESSAGE_TYPING: bigint;
DIRECT_MESSAGES: bigint;
DIRECT_MESSAGE_REACTIONS: bigint;
DIRECT_MESSAGE_TYPING: bigint;
};
}

25
dist/util/Intents.js vendored
View File

@ -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

View File

@ -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"}

View File

@ -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;
};
}

View File

@ -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

View File

@ -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"}

View File

@ -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 {};

View File

@ -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

View File

@ -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,EAAE,IAAI,CAAC,YAAY;YACtB,IAAI,EAAE,IAAI,CAAC,YAAY;YACvB,GAAG,EAAE,IAAI,CAAC,YAAY;YACtB,GAAG,EAAE,IAAI,CAAC,WAAW;YACrB,IAAI,EAAE,IAAI,CAAC,WAAW;YACtB,IAAI,EAAE,IAAI,CAAC,WAAW;YACtB,IAAI,EAAE,IAAI,CAAC,WAAW;YACtB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC;IAgDH,CAAC;IA9CA,YAAY,CAAC,GAAQ;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAA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AC;IAED,YAAY,CAAC,YAAoB,EAAE,KAAU;QAC5C,IAAI,OAAO,CAAC;QACZ,IAAI,CAAC,KAAK,SAAS,CAAC,MAAM,EAAE;YAC3B,aAAa;YACb,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAClD,IAAI,CAAC,OAAO,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,YAAY,GAAG,YAAY,GAAG,aAAa,CAAC,CAAC;aAC7D;YACD,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SACjC;aAAM;YACN,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;SACpD;IACF,CAAC;CACD;AAED,UAAU,CAAC,IAAI,GAAG,kBAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;AAC3C,UAAU,CAAC,GAAG,GAAG,kBAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;AACzC,UAAU,CAAC,GAAG,GAAG,kBAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;AAazC,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AACxC,kBAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,kBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC"}

View File

@ -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<Permissions>;
export {};

View File

@ -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

View File

@ -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,WAAY,SAAQ,mBAAQ;IA0CxC,GAAG,CAAC,UAAgC,EAAE,UAAU,GAAG,IAAI;QACtD,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,UAAgC,EAAE,UAAU,GAAG,IAAI;QACtD,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5F,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,UAAwC,EAAE,IAAa;QAC/E,6CAA6C;QAC7C,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE;YAClD,8BAA8B;YAC9B,yDAAyD;YACzD,oDAAoD;YACpD,gEAAgE;YAChE,OAAO,CAAC,UAAU,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC;YACxD,4CAA4C;YAC5C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/**
* A container for useful snowflake-related methods.
*/
export declare class Snowflake {
static readonly EPOCH = 1420070400000;
static INCREMENT: bigint;
static processId: bigint;
static workerId: bigint;
constructor();
/**
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
* ```
* If we have a snowflake '266241948824764416' we can represent it as binary:
*
* 64 22 17 12 0
* 000000111011000111100001101001000101000000 00001 00000 000000000000
* number of ms since Discord epoch worker pid increment
* ```
* @typedef {string} Snowflake
*/
/**
* Transforms a snowflake from a decimal string to a bit string.
* @param {Snowflake} num Snowflake to be transformed
* @returns {string}
* @private
*/
static idToBinary(num: any): string;
/**
* Transforms a snowflake from a bit string to a decimal string.
* @param {string} num Bit string to be transformed
* @returns {Snowflake}
* @private
*/
static binaryToID(num: any): string;
static generate(): bigint;
/**
* A deconstructed snowflake.
* @typedef {Object} DeconstructedSnowflake
* @property {number} timestamp Timestamp the snowflake was created
* @property {Date} date Date the snowflake was created
* @property {number} workerID Worker ID in the snowflake
* @property {number} processID Process ID in the snowflake
* @property {number} increment Increment in the snowflake
* @property {string} binary Binary representation of the snowflake
*/
/**
* Deconstructs a Discord snowflake.
* @param {Snowflake} snowflake Snowflake to deconstruct
* @returns {DeconstructedSnowflake} Deconstructed snowflake
*/
static deconstruct(snowflake: any): {
timestamp: any;
workerID: number;
processID: number;
increment: number;
binary: string;
};
}

116
dist/util/Snowflake.js vendored
View File

@ -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

View File

@ -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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aAAa,CAAC;AAC/B,mBAAS,GAAG,EAAE,CAAC,CAAC,WAAW;AAC3B,mBAAS,GAAG,EAAE,CAAC,CAAC,SAAS;AACzB,kBAAQ,GAAG,EAAE,CAAC,CAAC,SAAS"}

View File

@ -1,3 +0,0 @@
export declare const DOUBLE_WHITE_SPACE: RegExp;
export declare const SPECIAL_CHAR: RegExp;
export declare function trimSpecial(str: string): string;

10
dist/util/String.js vendored
View File

@ -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

View File

@ -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"}

View File

@ -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;
};
}

View File

@ -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

View File

@ -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"}

View File

@ -1 +0,0 @@
export declare function checkToken(token: string): Promise<any>;

View File

@ -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

View File

@ -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"}

149
package-lock.json generated
View File

@ -12,10 +12,14 @@
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"lambert-db": "^1.1.7", "lambert-db": "^1.1.7",
"missing-native-js-functions": "^1.2.2", "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": { "devDependencies": {
"@types/jsonwebtoken": "^8.5.0", "@types/jsonwebtoken": "^8.5.0",
"@types/mongoose-autopopulate": "^0.10.1",
"@types/mongoose-lean-virtuals": "^0.5.1",
"@types/node": "^14.14.25", "@types/node": "^14.14.25",
"typescript": "^4.1.3" "typescript": "^4.1.3"
} }
@ -46,6 +50,34 @@
"@types/node": "*" "@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": { "node_modules/@types/node": {
"version": "14.14.25", "version": "14.14.25",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz",
@ -562,14 +594,14 @@
} }
}, },
"node_modules/mongodb": { "node_modules/mongodb": {
"version": "3.6.4", "version": "3.6.6",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz",
"integrity": "sha512-Y+Ki9iXE9jI+n9bVtbTOOdK0B95d6wVGSucwtBkvQ+HIvVdTCfpVRp01FDC24uhC/Q2WXQ8Lpq3/zwtB5Op9Qw==", "integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==",
"dependencies": { "dependencies": {
"bl": "^2.2.1", "bl": "^2.2.1",
"bson": "^1.1.4", "bson": "^1.1.4",
"denque": "^1.4.1", "denque": "^1.4.1",
"require_optional": "^1.0.1", "optional-require": "^1.0.2",
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"saslprep": "^1.0.0" "saslprep": "^1.0.0"
}, },
@ -674,17 +706,17 @@
} }
}, },
"node_modules/mongoose": { "node_modules/mongoose": {
"version": "5.11.15", "version": "5.12.3",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.11.15.tgz", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.3.tgz",
"integrity": "sha512-8T4bT6eCGB7MqCm40oVhnhT/1AyAdwe+y1rYUhdl3ljsks3BpYz8whZgcMkIoh6VoCCjipOXRqZqdk1UByvlYA==", "integrity": "sha512-frsSR9yeldaRpSUeTegXCSB0Tu5UGq8sHuHBuEV31Jk3COyxlKFQPL7UsdMhxPUCmk74FpOYSmNwxhWBEqgzQg==",
"dependencies": { "dependencies": {
"@types/mongodb": "^3.5.27", "@types/mongodb": "^3.5.27",
"bson": "^1.1.4", "bson": "^1.1.4",
"kareem": "2.3.2", "kareem": "2.3.2",
"mongodb": "3.6.3", "mongodb": "3.6.5",
"mongoose-legacy-pluralize": "1.0.2", "mongoose-legacy-pluralize": "1.0.2",
"mpath": "0.8.3", "mpath": "0.8.3",
"mquery": "3.2.3", "mquery": "3.2.5",
"ms": "2.1.2", "ms": "2.1.2",
"regexp-clone": "1.0.0", "regexp-clone": "1.0.0",
"safe-buffer": "5.2.1", "safe-buffer": "5.2.1",
@ -699,6 +731,14 @@
"url": "https://opencollective.com/mongoose" "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": { "node_modules/mongoose-legacy-pluralize": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", "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": { "node_modules/mongoose/node_modules/mongodb": {
"version": "3.6.3", "version": "3.6.5",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.3.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz",
"integrity": "sha512-rOZuR0QkodZiM+UbQE5kDsJykBqWi0CL4Ec2i1nrGrUI3KO11r6Fbxskqmq3JK2NH7aW4dcccBuUujAP0ERl5w==", "integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==",
"dependencies": { "dependencies": {
"bl": "^2.2.1", "bl": "^2.2.1",
"bson": "^1.1.4", "bson": "^1.1.4",
@ -755,9 +795,9 @@
} }
}, },
"node_modules/mquery": { "node_modules/mquery": {
"version": "3.2.3", "version": "3.2.5",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.3.tgz", "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.5.tgz",
"integrity": "sha512-cIfbP4TyMYX+SkaQ2MntD+F2XbqaBHUYWk3j+kqdDztPWok3tgyssOZxMHMtzbV1w9DaSlvEea0Iocuro41A4g==", "integrity": "sha512-VjOKHHgU84wij7IUoZzFRU07IAxd5kWJaDmyUzQlbjHjyoeK5TNeeo8ZsFDtTYnSgpW6n/nMNIHvE3u8Lbrf4A==",
"dependencies": { "dependencies": {
"bluebird": "3.5.1", "bluebird": "3.5.1",
"debug": "3.1.0", "debug": "3.1.0",
@ -800,6 +840,14 @@
"wrappy": "1" "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": { "node_modules/p-limit": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
@ -1155,6 +1203,34 @@
"@types/node": "*" "@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": { "@types/node": {
"version": "14.14.25", "version": "14.14.25",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz",
@ -1544,14 +1620,14 @@
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
}, },
"mongodb": { "mongodb": {
"version": "3.6.4", "version": "3.6.6",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz",
"integrity": "sha512-Y+Ki9iXE9jI+n9bVtbTOOdK0B95d6wVGSucwtBkvQ+HIvVdTCfpVRp01FDC24uhC/Q2WXQ8Lpq3/zwtB5Op9Qw==", "integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==",
"requires": { "requires": {
"bl": "^2.2.1", "bl": "^2.2.1",
"bson": "^1.1.4", "bson": "^1.1.4",
"denque": "^1.4.1", "denque": "^1.4.1",
"require_optional": "^1.0.1", "optional-require": "^1.0.2",
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"saslprep": "^1.0.0" "saslprep": "^1.0.0"
} }
@ -1613,17 +1689,17 @@
} }
}, },
"mongoose": { "mongoose": {
"version": "5.11.15", "version": "5.12.3",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.11.15.tgz", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.3.tgz",
"integrity": "sha512-8T4bT6eCGB7MqCm40oVhnhT/1AyAdwe+y1rYUhdl3ljsks3BpYz8whZgcMkIoh6VoCCjipOXRqZqdk1UByvlYA==", "integrity": "sha512-frsSR9yeldaRpSUeTegXCSB0Tu5UGq8sHuHBuEV31Jk3COyxlKFQPL7UsdMhxPUCmk74FpOYSmNwxhWBEqgzQg==",
"requires": { "requires": {
"@types/mongodb": "^3.5.27", "@types/mongodb": "^3.5.27",
"bson": "^1.1.4", "bson": "^1.1.4",
"kareem": "2.3.2", "kareem": "2.3.2",
"mongodb": "3.6.3", "mongodb": "3.6.5",
"mongoose-legacy-pluralize": "1.0.2", "mongoose-legacy-pluralize": "1.0.2",
"mpath": "0.8.3", "mpath": "0.8.3",
"mquery": "3.2.3", "mquery": "3.2.5",
"ms": "2.1.2", "ms": "2.1.2",
"regexp-clone": "1.0.0", "regexp-clone": "1.0.0",
"safe-buffer": "5.2.1", "safe-buffer": "5.2.1",
@ -1632,9 +1708,9 @@
}, },
"dependencies": { "dependencies": {
"mongodb": { "mongodb": {
"version": "3.6.3", "version": "3.6.5",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.3.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz",
"integrity": "sha512-rOZuR0QkodZiM+UbQE5kDsJykBqWi0CL4Ec2i1nrGrUI3KO11r6Fbxskqmq3JK2NH7aW4dcccBuUujAP0ERl5w==", "integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==",
"requires": { "requires": {
"bl": "^2.2.1", "bl": "^2.2.1",
"bson": "^1.1.4", "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": { "mongoose-legacy-pluralize": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz",
@ -1658,9 +1740,9 @@
"integrity": "sha512-eb9rRvhDltXVNL6Fxd2zM9D4vKBxjVVQNLNijlj7uoXUy19zNDsIif5zR+pWmPCWNKwAtqyo4JveQm4nfD5+eA==" "integrity": "sha512-eb9rRvhDltXVNL6Fxd2zM9D4vKBxjVVQNLNijlj7uoXUy19zNDsIif5zR+pWmPCWNKwAtqyo4JveQm4nfD5+eA=="
}, },
"mquery": { "mquery": {
"version": "3.2.3", "version": "3.2.5",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.3.tgz", "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.5.tgz",
"integrity": "sha512-cIfbP4TyMYX+SkaQ2MntD+F2XbqaBHUYWk3j+kqdDztPWok3tgyssOZxMHMtzbV1w9DaSlvEea0Iocuro41A4g==", "integrity": "sha512-VjOKHHgU84wij7IUoZzFRU07IAxd5kWJaDmyUzQlbjHjyoeK5TNeeo8ZsFDtTYnSgpW6n/nMNIHvE3u8Lbrf4A==",
"requires": { "requires": {
"bluebird": "3.5.1", "bluebird": "3.5.1",
"debug": "3.1.0", "debug": "3.1.0",
@ -1702,6 +1784,11 @@
"wrappy": "1" "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": { "p-limit": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",

View File

@ -23,10 +23,12 @@
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"lambert-db": "^1.1.7", "lambert-db": "^1.1.7",
"missing-native-js-functions": "^1.2.2", "missing-native-js-functions": "^1.2.2",
"mongodb": "^3.6.4" "mongodb": "^3.6.6",
}, "mongoose": "^5.12.3",
"devDependencies": { "mongoose-autopopulate": "^0.12.3",
"@types/jsonwebtoken": "^8.5.0", "@types/jsonwebtoken": "^8.5.0",
"@types/mongoose-autopopulate": "^0.10.1",
"@types/mongoose-lean-virtuals": "^0.5.1",
"@types/node": "^14.14.25", "@types/node": "^14.14.25",
"typescript": "^4.1.3" "typescript": "^4.1.3"
} }

View File

@ -1,31 +1,10 @@
export * from "./util/checkToken"; export * from "./util/checkToken";
export * as Constants from "./util/Constants"; export * as Constants from "./util/Constants";
export * from "./models/Ban"; export * from "./models/index";
export * from "./models/Channel"; export * from "./util/index";
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 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 };

View File

@ -4,7 +4,7 @@ import { Schema, model, Types, Document } from "mongoose";
export interface Presence { export interface Presence {
user: User; user: User;
guild_id?: bigint; guild_id?: string;
status: Status; status: Status;
activities: Activity[]; activities: Activity[];
client_status: ClientStatus; client_status: ClientStatus;
@ -14,17 +14,17 @@ export interface Activity {
name: string; name: string;
type: ActivityType; type: ActivityType;
url?: string; url?: string;
created_at: Date; created_at?: Date;
timestamps?: { timestamps?: {
start: number; start?: number;
end: number; end?: number;
}[]; }[];
application_id?: bigint; application_id?: string;
details?: string; details?: string;
state?: string; state?: string;
emoji?: { emoji?: {
name: string; name: string;
id?: bigint; id?: string;
amimated?: boolean; amimated?: boolean;
}; };
party?: { party?: {
@ -32,10 +32,10 @@ export interface Activity {
size?: [number, number]; size?: [number, number];
}; };
assets?: { assets?: {
large_image: string; large_image?: string;
large_text: string; large_text?: string;
small_image: string; small_image?: string;
small_text: string; small_text?: string;
}; };
secrets?: { secrets?: {
join?: string; join?: string;
@ -49,39 +49,39 @@ export interface Activity {
export const Activity = { export const Activity = {
name: String, name: String,
type: Number, type: Number,
url: String, $url: String,
created_at: Date, $created_at: Date,
timestamps: [ $timestamps: [
{ {
start: Number, $start: Number,
end: Number, $end: Number,
}, },
], ],
application_id: Types.Long, $application_id: String,
details: String, $details: String,
state: String, $state: String,
emoji: { $emoji: {
name: String, $name: String,
id: Types.Long, $id: String,
amimated: Boolean, $amimated: Boolean,
}, },
party: { $party: {
id: String, $id: String,
size: [Number, Number], $size: [Number, Number],
}, },
assets: { $assets: {
large_image: String, $large_image: String,
large_text: String, $large_text: String,
small_image: String, $small_image: String,
small_text: String, $small_text: String,
}, },
secrets: { $secrets: {
join: String, $join: String,
spectate: String, $spectate: String,
match: String, $match: String,
}, },
instance: Boolean, $instance: Boolean,
flags: Types.Long, $flags: Types.Long,
}; };
export enum ActivityType { export enum ActivityType {

View File

@ -1,6 +1,6 @@
export interface ApplicationCommand { export interface ApplicationCommand {
id: bigint; id: string;
application_id: bigint; application_id: string;
name: string; name: string;
description: string; description: string;
options?: ApplicationCommandOption[]; options?: ApplicationCommandOption[];
@ -32,7 +32,7 @@ export enum ApplicationCommandOptionType {
} }
export interface ApplicationCommandInteractionData { export interface ApplicationCommandInteractionData {
id: bigint; id: string;
name: string; name: string;
options?: ApplicationCommandInteractionDataOption[]; options?: ApplicationCommandInteractionDataOption[];
} }

View File

@ -11,17 +11,17 @@ export interface AuditLogResponse {
} }
export interface AuditLogEntries { export interface AuditLogEntries {
target_id?: bigint; target_id?: string;
user_id: bigint; user_id: string;
id: bigint; id: string;
action_type: AuditLogEvents; action_type: AuditLogEvents;
options?: { options?: {
delete_member_days?: string; delete_member_days?: string;
members_removed?: string; members_removed?: string;
channel_id?: bigint; channel_id?: string;
messaged_id?: bigint; messaged_id?: string;
count?: string; count?: string;
id?: bigint; id?: string;
type?: string; type?: string;
role_name?: string; role_name?: string;
}; };
@ -42,13 +42,13 @@ export interface AuditLogChangeValue {
splash_hash?: string; splash_hash?: string;
discovery_splash_hash?: string; discovery_splash_hash?: string;
banner_hash?: string; banner_hash?: string;
owner_id?: bigint; owner_id?: string;
region?: string; region?: string;
preferred_locale?: string; preferred_locale?: string;
afk_channel_id?: bigint; afk_channel_id?: string;
afk_timeout?: number; afk_timeout?: number;
rules_channel_id?: bigint; rules_channel_id?: string;
public_updates_channel_id?: bigint; public_updates_channel_id?: string;
mfa_level?: number; mfa_level?: number;
verification_level?: number; verification_level?: number;
explicit_content_filter?: number; explicit_content_filter?: number;
@ -58,14 +58,14 @@ export interface AuditLogChangeValue {
$remove?: {}[]; $remove?: {}[];
prune_delete_days?: number; prune_delete_days?: number;
widget_enabled?: boolean; widget_enabled?: boolean;
widget_channel_id?: bigint; widget_channel_id?: string;
system_channel_id?: bigint; system_channel_id?: string;
position?: number; position?: number;
topic?: string; topic?: string;
bitrate?: number; bitrate?: number;
permission_overwrites?: ChannelPermissionOverwrite[]; permission_overwrites?: ChannelPermissionOverwrite[];
nsfw?: boolean; nsfw?: boolean;
application_id?: bigint; application_id?: string;
rate_limit_per_user?: number; rate_limit_per_user?: number;
permissions?: string; permissions?: string;
color?: number; color?: number;
@ -74,8 +74,8 @@ export interface AuditLogChangeValue {
allow?: string; allow?: string;
deny?: string; deny?: string;
code?: string; code?: string;
channel_id?: bigint; channel_id?: string;
inviter_id?: bigint; inviter_id?: string;
max_uses?: number; max_uses?: number;
uses?: number; uses?: number;
max_age?: number; max_age?: number;
@ -84,7 +84,7 @@ export interface AuditLogChangeValue {
mute?: boolean; mute?: boolean;
nick?: string; nick?: string;
avatar_hash?: string; avatar_hash?: string;
id?: bigint; id?: string;
type?: number; type?: number;
enable_emoticons?: boolean; enable_emoticons?: boolean;
expire_behavior?: number; expire_behavior?: number;
@ -93,7 +93,7 @@ export interface AuditLogChangeValue {
} }
export interface AuditLogEntriesDocument extends Document, AuditLogEntries { export interface AuditLogEntriesDocument extends Document, AuditLogEntries {
id: bigint; id: string;
} }
export const AuditLogChanges = { export const AuditLogChanges = {
@ -103,13 +103,13 @@ export const AuditLogChanges = {
splash_hash: String, splash_hash: String,
discovery_splash_hash: String, discovery_splash_hash: String,
banner_hash: String, banner_hash: String,
owner_id: Types.Long, owner_id: String,
region: String, region: String,
preferred_locale: String, preferred_locale: String,
afk_channel_id: Types.Long, afk_channel_id: String,
afk_timeout: Number, afk_timeout: Number,
rules_channel_id: Types.Long, rules_channel_id: String,
public_updates_channel_id: Types.Long, public_updates_channel_id: String,
mfa_level: Number, mfa_level: Number,
verification_level: Number, verification_level: Number,
explicit_content_filter: Number, explicit_content_filter: Number,
@ -119,14 +119,14 @@ export const AuditLogChanges = {
$remove: [{}], $remove: [{}],
prune_delete_days: Number, prune_delete_days: Number,
widget_enabled: Boolean, widget_enabled: Boolean,
widget_channel_id: Types.Long, widget_channel_id: String,
system_channel_id: Types.Long, system_channel_id: String,
position: Number, position: Number,
topic: String, topic: String,
bitrate: Number, bitrate: Number,
permission_overwrites: [{}], permission_overwrites: [{}],
nsfw: Boolean, nsfw: Boolean,
application_id: Types.Long, application_id: String,
rate_limit_per_user: Number, rate_limit_per_user: Number,
permissions: String, permissions: String,
color: Number, color: Number,
@ -135,8 +135,8 @@ export const AuditLogChanges = {
allow: String, allow: String,
deny: String, deny: String,
code: String, code: String,
channel_id: Types.Long, channel_id: String,
inviter_id: Types.Long, inviter_id: String,
max_uses: Number, max_uses: Number,
uses: Number, uses: Number,
max_age: Number, max_age: Number,
@ -145,7 +145,7 @@ export const AuditLogChanges = {
mute: Boolean, mute: Boolean,
nick: String, nick: String,
avatar_hash: String, avatar_hash: String,
id: Types.Long, id: String,
type: Number, type: Number,
enable_emoticons: Boolean, enable_emoticons: Boolean,
expire_behavior: Number, expire_behavior: Number,
@ -154,17 +154,17 @@ export const AuditLogChanges = {
}; };
export const AuditLogSchema = new Schema({ export const AuditLogSchema = new Schema({
target_id: Types.Long, target_id: String,
user_id: { type: Types.Long, required: true }, user_id: { type: String, required: true },
id: { type: Types.Long, required: true }, id: { type: String, required: true },
action_type: { type: Number, required: true }, action_type: { type: Number, required: true },
options: { options: {
delete_member_days: String, delete_member_days: String,
members_removed: String, members_removed: String,
channel_id: Types.Long, channel_id: String,
messaged_id: Types.Long, messaged_id: String,
count: String, count: String,
id: Types.Long, id: String,
type: String, type: String,
role_name: String, role_name: String,
}, },

View File

@ -2,17 +2,17 @@ import { Schema, model, Types, Document } from "mongoose";
import db from "../util/Database"; import db from "../util/Database";
export interface Ban extends Document { export interface Ban extends Document {
user_id: bigint; user_id: string;
guild_id: bigint; guild_id: string;
executor_id: bigint; executor_id: string;
ip: string; ip: string;
reason?: string; reason?: string;
} }
export const BanSchema = new Schema({ export const BanSchema = new Schema({
user_id: { type: Types.Long, required: true }, user_id: { type: String, required: true },
guild_id: { type: Types.Long, required: true }, guild_id: { type: String, required: true },
executor_id: { type: Types.Long, required: true }, executor_id: { type: String, required: true },
reason: String, reason: String,
ip: String, // ? Should we store this in here, or in the UserModel? ip: String, // ? Should we store this in here, or in the UserModel?
}); });

View File

@ -4,20 +4,20 @@ import db from "../util/Database";
export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel {} export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel {}
export interface ChannelDocument extends Document, AnyChannel { export interface ChannelDocument extends Document, AnyChannel {
id: bigint; id: string;
} }
export const ChannelSchema = new Schema({ export const ChannelSchema = new Schema({
id: Types.Long, id: String,
created_at: { type: Schema.Types.Date, required: true }, created_at: { type: Schema.Types.Date, required: true },
name: { type: String, required: true }, name: { type: String, required: true },
type: { type: Number, required: true }, type: { type: Number, required: true },
guild_id: Types.Long, guild_id: String,
owner_id: Types.Long, owner_id: String,
parent_id: Types.Long, parent_id: String,
recipients: [Types.Long], recipients: [String],
position: Number, position: Number,
last_message_id: Types.Long, last_message_id: String,
last_pin_timestamp: Date, last_pin_timestamp: Date,
nsfw: Boolean, nsfw: Boolean,
rate_limit_per_user: Number, rate_limit_per_user: Number,
@ -26,7 +26,7 @@ export const ChannelSchema = new Schema({
{ {
allow: Types.Long, allow: Types.Long,
deny: Types.Long, deny: Types.Long,
id: Types.Long, id: String,
type: Number, type: Number,
}, },
], ],
@ -36,28 +36,28 @@ export const ChannelSchema = new Schema({
export const ChannelModel = db.model<ChannelDocument>("Channel", ChannelSchema, "channels"); export const ChannelModel = db.model<ChannelDocument>("Channel", ChannelSchema, "channels");
export interface Channel { export interface Channel {
id: bigint; id: string;
created_at: Date; created_at: Date;
name: string; name: string;
type: number; type: number;
} }
export interface TextBasedChannel { export interface TextBasedChannel {
last_message_id?: bigint; last_message_id?: string;
last_pin_timestamp?: number; last_pin_timestamp?: number;
} }
export interface GuildChannel extends Channel { export interface GuildChannel extends Channel {
guild_id: bigint; guild_id: string;
position: number; position: number;
parent_id?: bigint; parent_id?: string;
permission_overwrites: ChannelPermissionOverwrite[]; permission_overwrites: ChannelPermissionOverwrite[];
} }
export interface ChannelPermissionOverwrite { export interface ChannelPermissionOverwrite {
allow: bigint; allow: bigint; // for bitfields we use bigints
deny: bigint; deny: bigint; // for bitfields we use bigints
id: bigint; id: string;
type: ChannelPermissionOverwriteType; type: ChannelPermissionOverwriteType;
} }
@ -75,8 +75,8 @@ export interface TextChannel extends GuildChannel, TextBasedChannel {
} }
export interface DMChannel extends Channel, TextBasedChannel { export interface DMChannel extends Channel, TextBasedChannel {
owner_id: bigint; owner_id: string;
recipients: bigint[]; recipients: string[];
} }
export enum ChannelType { export enum ChannelType {

View File

@ -2,27 +2,27 @@ import { Schema, model, Types, Document } from "mongoose";
import db from "../util/Database"; import db from "../util/Database";
export interface Emoji extends Document { export interface Emoji extends Document {
id: bigint; id: string;
animated: boolean; animated: boolean;
available: boolean; available: boolean;
guild_id: bigint; guild_id: string;
managed: boolean; managed: boolean;
name: string; name: string;
require_colons: boolean; require_colons: boolean;
url: string; 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({ export const EmojiSchema = new Schema({
id: { type: Types.Long, required: true }, id: { type: String, required: true },
animated: Boolean, animated: Boolean,
available: Boolean, available: Boolean,
guild_id: Types.Long, guild_id: String,
managed: Boolean, managed: Boolean,
name: String, name: String,
require_colons: Boolean, require_colons: Boolean,
url: String, url: String,
roles: [Types.Long], roles: [String],
}); });
// @ts-ignore // @ts-ignore

View File

@ -1,7 +1,7 @@
import { ConnectedAccount, User, UserSettings } from "./User"; import { ConnectedAccount, PublicUser, User, UserSettings } from "./User";
import { DMChannel, Channel } from "./Channel"; import { DMChannel, Channel } from "./Channel";
import { Guild } from "./Guild"; import { Guild } from "./Guild";
import { PublicMember, UserGuildSettings } from "./Member"; import { Member, PublicMember, UserGuildSettings } from "./Member";
import { Emoji } from "./Emoji"; import { Emoji } from "./Emoji";
import { Presence } from "./Activity"; import { Presence } from "./Activity";
import { Role } from "./Role"; import { Role } from "./Role";
@ -14,9 +14,9 @@ import { Schema, model, Types, Document } from "mongoose";
import db from "../util/Database"; import db from "../util/Database";
export interface Event { export interface Event {
guild_id?: bigint; guild_id?: string;
user_id?: bigint; user_id?: string;
channel_id?: bigint; channel_id?: string;
created_at?: Date; created_at?: Date;
event: EVENT; event: EVENT;
data?: any; data?: any;
@ -25,9 +25,9 @@ export interface Event {
export interface EventDocument extends Event, Document {} export interface EventDocument extends Event, Document {}
export const EventSchema = new Schema({ export const EventSchema = new Schema({
guild_id: Types.Long, guild_id: String,
user_id: Types.Long, user_id: String,
channel_id: Types.Long, channel_id: String,
created_at: { type: Date, required: true }, created_at: { type: Date, required: true },
event: { type: String, required: true }, event: { type: String, required: true },
data: Object, data: Object,
@ -44,11 +44,21 @@ export interface InvalidatedEvent extends Event {
// ! END Custom Events that shouldn't get sent to the client but processed by the server // ! END Custom Events that shouldn't get sent to the client but processed by the server
export interface ReadyEvent extends Event { export interface ReadyEventData {
event: "READY";
data: {
v: number; v: number;
user: Omit<User, "guilds" | "user_settings" | "valid_tokens_since" | "connected_accounts" | "relationships">; 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 private_channels: DMChannel[]; // this will be empty for bots
session_id: string; // resuming session_id: string; // resuming
guilds: Guild[]; guilds: Guild[];
@ -76,28 +86,36 @@ export interface ReadyEvent extends Event {
guild_join_requests?: []; // ? what is this? this is new guild_join_requests?: []; // ? what is this? this is new
shard?: [number, number]; shard?: [number, number];
user_settings?: UserSettings; user_settings?: UserSettings;
relationships?: []; relationships?: []; // TODO
read_state: {
entries: []; // TODO
partial: boolean;
version: number;
};
user_guild_settings?: { user_guild_settings?: {
entries: UserGuildSettings[]; entries: UserGuildSettings[];
version: number; version: number;
partial: boolean; partial: boolean;
}; };
application?: { application?: {
id: bigint; id: string;
flags: bigint; flags: bigint;
}; };
merged_members?: Omit<Member, "settings" | "user">[][];
merged_members?: PublicMember[][]; // every guild member object for the current user
// probably all users who the user is in contact with // probably all users who the user is in contact with
users?: { users?: {
avatar?: string; avatar?: string;
discriminator: string; discriminator: string;
id: bigint; id: string;
username: string; username: string;
bot: boolean; bot: boolean;
public_flags: bigint; public_flags: bigint;
}[]; }[];
}; }
export interface ReadyEvent extends Event {
event: "READY";
data: ReadyEventData;
} }
export interface ChannelCreateEvent extends Event { export interface ChannelCreateEvent extends Event {
@ -118,8 +136,8 @@ export interface ChannelDeleteEvent extends Event {
export interface ChannelPinsUpdateEvent extends Event { export interface ChannelPinsUpdateEvent extends Event {
event: "CHANNEL_PINS_UPDATE"; event: "CHANNEL_PINS_UPDATE";
data: { data: {
guild_id?: bigint; guild_id?: string;
channel_id: bigint; channel_id: string;
last_pin_timestamp: number; last_pin_timestamp: number;
}; };
} }
@ -137,7 +155,7 @@ export interface GuildUpdateEvent extends Event {
export interface GuildDeleteEvent extends Event { export interface GuildDeleteEvent extends Event {
event: "GUILD_DELETE"; event: "GUILD_DELETE";
data: { data: {
id: bigint; id: string;
unavailable?: boolean; unavailable?: boolean;
}; };
} }
@ -145,7 +163,7 @@ export interface GuildDeleteEvent extends Event {
export interface GuildBanAddEvent extends Event { export interface GuildBanAddEvent extends Event {
event: "GUILD_BAN_ADD"; event: "GUILD_BAN_ADD";
data: { data: {
guild_id: bigint; guild_id: string;
user: User; user: User;
}; };
} }
@ -153,7 +171,7 @@ export interface GuildBanAddEvent extends Event {
export interface GuildBanRemoveEvent extends Event { export interface GuildBanRemoveEvent extends Event {
event: "GUILD_BAN_REMOVE"; event: "GUILD_BAN_REMOVE";
data: { data: {
guild_id: bigint; guild_id: string;
user: User; user: User;
}; };
} }
@ -161,7 +179,7 @@ export interface GuildBanRemoveEvent extends Event {
export interface GuildEmojiUpdateEvent extends Event { export interface GuildEmojiUpdateEvent extends Event {
event: "GUILD_EMOJI_UPDATE"; event: "GUILD_EMOJI_UPDATE";
data: { data: {
guild_id: bigint; guild_id: string;
emojis: Emoji[]; emojis: Emoji[];
}; };
} }
@ -169,21 +187,21 @@ export interface GuildEmojiUpdateEvent extends Event {
export interface GuildIntegrationUpdateEvent extends Event { export interface GuildIntegrationUpdateEvent extends Event {
event: "GUILD_INTEGRATIONS_UPDATE"; event: "GUILD_INTEGRATIONS_UPDATE";
data: { data: {
guild_id: bigint; guild_id: string;
}; };
} }
export interface GuildMemberAddEvent extends Event { export interface GuildMemberAddEvent extends Event {
event: "GUILD_MEMBER_ADD"; event: "GUILD_MEMBER_ADD";
data: PublicMember & { data: PublicMember & {
guild_id: bigint; guild_id: string;
}; };
} }
export interface GuildMemberRemoveEvent extends Event { export interface GuildMemberRemoveEvent extends Event {
event: "GUILD_MEMBER_REMOVE"; event: "GUILD_MEMBER_REMOVE";
data: { data: {
guild_id: bigint; guild_id: string;
user: User; user: User;
}; };
} }
@ -191,8 +209,8 @@ export interface GuildMemberRemoveEvent extends Event {
export interface GuildMemberUpdateEvent extends Event { export interface GuildMemberUpdateEvent extends Event {
event: "GUILD_MEMBER_UPDATE"; event: "GUILD_MEMBER_UPDATE";
data: { data: {
guild_id: bigint; guild_id: string;
roles: bigint[]; roles: string[];
user: User; user: User;
nick?: string; nick?: string;
joined_at: Date; joined_at: Date;
@ -204,11 +222,11 @@ export interface GuildMemberUpdateEvent extends Event {
export interface GuildMembersChunkEvent extends Event { export interface GuildMembersChunkEvent extends Event {
event: "GUILD_MEMBERS_CHUNK"; event: "GUILD_MEMBERS_CHUNK";
data: { data: {
guild_id: bigint; guild_id: string;
members: PublicMember[]; members: PublicMember[];
chunk_index: number; chunk_index: number;
chunk_count: number; chunk_count: number;
not_found: bigint[]; not_found: string[];
presences: Presence[]; presences: Presence[];
nonce?: string; nonce?: string;
}; };
@ -217,7 +235,7 @@ export interface GuildMembersChunkEvent extends Event {
export interface GuildRoleCreateEvent extends Event { export interface GuildRoleCreateEvent extends Event {
event: "GUILD_ROLE_CREATE"; event: "GUILD_ROLE_CREATE";
data: { data: {
guild_id: bigint; guild_id: string;
role: Role; role: Role;
}; };
} }
@ -225,7 +243,7 @@ export interface GuildRoleCreateEvent extends Event {
export interface GuildRoleUpdateEvent extends Event { export interface GuildRoleUpdateEvent extends Event {
event: "GUILD_ROLE_UPDATE"; event: "GUILD_ROLE_UPDATE";
data: { data: {
guild_id: bigint; guild_id: string;
role: Role; role: Role;
}; };
} }
@ -233,31 +251,31 @@ export interface GuildRoleUpdateEvent extends Event {
export interface GuildRoleDeleteEvent extends Event { export interface GuildRoleDeleteEvent extends Event {
event: "GUILD_ROLE_DELETE"; event: "GUILD_ROLE_DELETE";
data: { data: {
guild_id: bigint; guild_id: string;
role_id: bigint; role_id: string;
}; };
} }
export interface InviteCreateEvent extends Event { export interface InviteCreateEvent extends Event {
event: "INVITE_CREATE"; event: "INVITE_CREATE";
data: Omit<Invite, "guild" | "channel"> & { data: Omit<Invite, "guild" | "channel"> & {
channel_id: bigint; channel_id: string;
guild_id?: bigint; guild_id?: string;
}; };
} }
export interface InviteDeleteEvent extends Event { export interface InviteDeleteEvent extends Event {
event: "INVITE_DELETE"; event: "INVITE_DELETE";
data: { data: {
channel_id: bigint; channel_id: string;
guild_id?: bigint; guild_id?: string;
code: string; code: string;
}; };
} }
export type MessagePayload = Omit<Message, "author_id"> & { export type MessagePayload = Omit<Message, "author_id"> & {
channel_id: bigint; channel_id: string;
guild_id?: bigint; guild_id?: string;
author: User; author: User;
member: PublicMember; member: PublicMember;
mentions: (User & { member: PublicMember })[]; mentions: (User & { member: PublicMember })[];
@ -276,28 +294,28 @@ export interface MessageUpdateEvent extends Event {
export interface MessageDeleteEvent extends Event { export interface MessageDeleteEvent extends Event {
event: "MESSAGE_DELETE"; event: "MESSAGE_DELETE";
data: { data: {
id: bigint; id: string;
channel_id: bigint; channel_id: string;
guild_id?: bigint; guild_id?: string;
}; };
} }
export interface MessageDeleteBulkEvent extends Event { export interface MessageDeleteBulkEvent extends Event {
event: "MESSAGE_DELETE_BULK"; event: "MESSAGE_DELETE_BULK";
data: { data: {
ids: bigint[]; ids: string[];
channel_id: bigint; channel_id: string;
guild_id?: bigint; guild_id?: string;
}; };
} }
export interface MessageReactionAddEvent extends Event { export interface MessageReactionAddEvent extends Event {
event: "MESSAGE_REACTION_ADD"; event: "MESSAGE_REACTION_ADD";
data: { data: {
user_id: bigint; user_id: string;
channel_id: bigint; channel_id: string;
message_id: bigint; message_id: string;
guild_id?: bigint; guild_id?: string;
member?: PublicMember; member?: PublicMember;
emoji: PartialEmoji; emoji: PartialEmoji;
}; };
@ -306,10 +324,10 @@ export interface MessageReactionAddEvent extends Event {
export interface MessageReactionRemoveEvent extends Event { export interface MessageReactionRemoveEvent extends Event {
event: "MESSAGE_REACTION_REMOVE"; event: "MESSAGE_REACTION_REMOVE";
data: { data: {
user_id: bigint; user_id: string;
channel_id: bigint; channel_id: string;
message_id: bigint; message_id: string;
guild_id?: bigint; guild_id?: string;
emoji: PartialEmoji; emoji: PartialEmoji;
}; };
} }
@ -317,18 +335,18 @@ export interface MessageReactionRemoveEvent extends Event {
export interface MessageReactionRemoveAllEvent extends Event { export interface MessageReactionRemoveAllEvent extends Event {
event: "MESSAGE_REACTION_REMOVE_ALL"; event: "MESSAGE_REACTION_REMOVE_ALL";
data: { data: {
channel_id: bigint; channel_id: string;
message_id: bigint; message_id: string;
guild_id?: bigint; guild_id?: string;
}; };
} }
export interface MessageReactionRemoveEmojiEvent extends Event { export interface MessageReactionRemoveEmojiEvent extends Event {
event: "MESSAGE_REACTION_REMOVE_EMOJI"; event: "MESSAGE_REACTION_REMOVE_EMOJI";
data: { data: {
channel_id: bigint; channel_id: string;
message_id: bigint; message_id: string;
guild_id?: bigint; guild_id?: string;
emoji: PartialEmoji; emoji: PartialEmoji;
}; };
} }
@ -341,10 +359,10 @@ export interface PresenceUpdateEvent extends Event {
export interface TypingStartEvent extends Event { export interface TypingStartEvent extends Event {
event: "TYPING_START"; event: "TYPING_START";
data: { data: {
channel_id: bigint; channel_id: string;
user_id: bigint; user_id: string;
timestamp: number; timestamp: number;
guild_id?: bigint; guild_id?: string;
member?: PublicMember; member?: PublicMember;
}; };
} }
@ -365,7 +383,7 @@ export interface VoiceServerUpdateEvent extends Event {
event: "VOICE_SERVER_UPDATE"; event: "VOICE_SERVER_UPDATE";
data: { data: {
token: string; token: string;
guild_id: bigint; guild_id: string;
endpoint: string; endpoint: string;
}; };
} }
@ -373,13 +391,13 @@ export interface VoiceServerUpdateEvent extends Event {
export interface WebhooksUpdateEvent extends Event { export interface WebhooksUpdateEvent extends Event {
event: "WEBHOOKS_UPDATE"; event: "WEBHOOKS_UPDATE";
data: { data: {
guild_id: bigint; guild_id: string;
channel_id: bigint; channel_id: string;
}; };
} }
export type ApplicationCommandPayload = ApplicationCommand & { export type ApplicationCommandPayload = ApplicationCommand & {
guild_id: bigint; guild_id: string;
}; };
export interface ApplicationCommandCreateEvent extends Event { export interface ApplicationCommandCreateEvent extends Event {
@ -404,6 +422,49 @@ export interface InteractionCreateEvent extends Event {
// located in collection events // 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 = export type EVENT =
| "READY" | "READY"
| "CHANNEL_CREATE" | "CHANNEL_CREATE"

Some files were not shown because too many files have changed in this diff Show More