From e5f408be0889562f6fa36ac1bb1730e50bf1951f Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 03:56:19 +0200 Subject: :bug: fix Database --- src/util/Database.ts | 58 ++++++++++++++++++++++++++----------------------- src/util/Permissions.ts | 4 +++- 2 files changed, 34 insertions(+), 28 deletions(-) (limited to 'src/util') diff --git a/src/util/Database.ts b/src/util/Database.ts index 2304378c..f5269675 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -29,7 +29,7 @@ export class MongooseCache extends EventEmitter { super(); } - async init() { + init = async () => { this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" }); this.stream.on("change", this.change); @@ -40,9 +40,9 @@ export class MongooseCache extends EventEmitter { const arr = await this.collection.aggregate(this.pipeline).toArray(); this.data = arr.length ? arr[0] : arr; } - } + }; - convertResult(obj: any) { + convertResult = (obj: any) => { if (obj instanceof Long) return BigInt(obj.toString()); if (typeof obj === "object") { Object.keys(obj).forEach((key) => { @@ -51,40 +51,44 @@ export class MongooseCache extends EventEmitter { } return obj; - } + }; change = (doc: ChangeEvent) => { - // @ts-ignore - if (doc.fullDocument) { + try { // @ts-ignore - if (!this.opts.onlyEvents) this.data = doc.fullDocument; - } + if (doc.fullDocument) { + // @ts-ignore + if (!this.opts.onlyEvents) this.data = doc.fullDocument; + } - switch (doc.operationType) { - case "dropDatabase": - return this.destroy(); - case "drop": - return this.destroy(); - case "delete": - return this.emit("delete", doc.documentKey._id.toHexString()); - case "insert": - return this.emit("insert", doc.fullDocument); - case "update": - case "replace": - return this.emit("change", doc.fullDocument); - case "invalidate": - return this.destroy(); - default: - return; + switch (doc.operationType) { + case "dropDatabase": + return this.destroy(); + case "drop": + return this.destroy(); + case "delete": + return this.emit("delete", doc.documentKey._id.toHexString()); + case "insert": + return this.emit("insert", doc.fullDocument); + case "update": + case "replace": + return this.emit("change", doc.fullDocument); + case "invalidate": + return this.destroy(); + default: + return; + } + } catch (error) { + this.emit("error", error); } }; - destroy() { - this.stream.off("change", this.change); + destroy = () => { + this.stream?.off("change", this.change); this.emit("close"); if (this.stream.isClosed()) return; return this.stream.close(); - } + }; } diff --git a/src/util/Permissions.ts b/src/util/Permissions.ts index ae21e138..809111bf 100644 --- a/src/util/Permissions.ts +++ b/src/util/Permissions.ts @@ -158,7 +158,9 @@ export async function getPermission( member = await MemberModel.findOne({ guild_id, id: user_id }, "roles").exec(); if (!member) throw new Error("Member not found"); - var roles = await RoleModel.find({ guild_id, id: { $in: member.roles } }).exec(); + var roles = await RoleModel.find({ guild_id, id: { $in: member.roles } }) + .lean() + .exec(); if (channel_id) { channel = await ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec(); } -- cgit 1.5.1 From 79c4fd55fc210929ba550f55c1babdc88c0859c2 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 17:06:00 +0200 Subject: :bug: fix User Model guilds --- dist/models/User.js | 2 +- dist/models/User.js.map | 2 +- dist/util/Database.js | 1 + dist/util/Database.js.map | 2 +- src/models/User.ts | 2 +- src/util/Database.ts | 2 ++ 6 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/util') diff --git a/dist/models/User.js b/dist/models/User.js index 9384d10b..7c98f27e 100644 --- a/dist/models/User.js +++ b/dist/models/User.js @@ -28,10 +28,10 @@ exports.UserSchema = new mongoose_1.Schema({ email: String, flags: mongoose_1.Types.Long, public_flags: mongoose_1.Types.Long, + guilds: [mongoose_1.Types.Long], user_data: { fingerprints: [String], hash: String, - guilds: [mongoose_1.Types.Long], valid_tokens_since: Date, relationships: [ { diff --git a/dist/models/User.js.map b/dist/models/User.js.map index 76e43b41..03a92cb6 100644 --- a/dist/models/User.js.map +++ b/dist/models/User.js.map @@ -1 +1 @@ -{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AACtC,qCAAg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AAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AACtC,qCAAgD;AAChD,uCAAmD;AACnD,gEAAkC;AAqHrB,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,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,OAAO;IAChB,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,MAAM;IACpB,GAAG,EAAE,OAAO;IACZ,MAAM,EAAE,OAAO;IACf,YAAY,EAAE,OAAO;IACrB,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,gBAAK,CAAC,IAAI;IACjB,YAAY,EAAE,gBAAK,CAAC,IAAI;IACxB,MAAM,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;IACpB,SAAS,EAAE;QACV,YAAY,EAAE,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM;QACZ,kBAAkB,EAAE,IAAI;QACxB,aAAa,EAAE;YACd;gBACC,EAAE,EAAE,gBAAK,CAAC,IAAI;gBACd,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,gBAAK,CAAC,IAAI;aACnB;SACD;QACD,kBAAkB,EAAE;YACnB;gBACC,YAAY,EAAE,MAAM;gBACpB,WAAW,EAAE,OAAO;gBACpB,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,OAAO;gBAChB,aAAa,EAAE,OAAO;gBAC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;KACvB;IAED,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,CAAC,mBAAQ,CAAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/util/Database.js b/dist/util/Database.js index 6f8d284d..b80fd835 100644 --- a/dist/util/Database.js +++ b/dist/util/Database.js @@ -9,6 +9,7 @@ const mongoose_1 = __importDefault(require("mongoose")); const mongodb_1 = require("mongodb"); const events_1 = __importDefault(require("events")); const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPreference=secondaryPreferred"; +console.log(`[DB] connect: ${uri}`); const connection = mongoose_1.default.createConnection(uri, { autoIndex: true }); exports.default = connection; class MongooseCache extends events_1.default { diff --git a/dist/util/Database.js.map b/dist/util/Database.js.map index f31cb665..348182a0 100644 --- a/dist/util/Database.js.map +++ b/dist/util/Database.js.map @@ -1 +1 @@ -{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../src/util/Database.ts"],"names":[],"mappings":";;;;;;AAAA,yBAAuB;AACvB,wDAA4D;AAC5D,qCAA0D;AAC1D,oDAAkC;AAClC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,sEAAsE,CAAC;AAE5G,MAAM,UAAU,GAAG,kBAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvE,kBAA2B,UAAU,CAAC;AAStC,MAAa,aAAc,SAAQ,gBAAY;IAI9C,YACQ,UAAsB,EACtB,QAAwC,EACxC,IAEN;QAED,KAAK,EAAE,CAAC;QAND,eAAU,GAAV,UAAU,CAAY;QACtB,aAAQ,GAAR,QAAQ,CAAgC;QACxC,SAAI,GAAJ,IAAI,CAEV;QAKF,SAAI,GAAG,K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,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC9C,KAAK,YAAY;wBAChB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;oBACvB;wBACC,OAAO;iBACR;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;aAC1B;QACF,CAAC,CAAC;QAEF,YAAO,GAAG,GAAG,EAAE;YACd,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEnB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAAE,OAAO;YAEnC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC,CAAC;IA/DF,CAAC;CAgED;AA5ED,sCA4EC"} \ No newline at end of file diff --git a/src/models/User.ts b/src/models/User.ts index fb914fa0..9f447d91 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -138,10 +138,10 @@ export const UserSchema = new Schema({ email: String, flags: Types.Long, // TODO: automatically convert Types.Long to BitField of UserFlags public_flags: Types.Long, + guilds: [Types.Long], // array of guild ids the user is part of user_data: { fingerprints: [String], hash: String, // hash of the password, salt is saved in password (bcrypt) - guilds: [Types.Long], // array of guild ids the user is part of valid_tokens_since: Date, // all tokens with a previous issue date are invalid relationships: [ { diff --git a/src/util/Database.ts b/src/util/Database.ts index f5269675..fee3cc31 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -4,6 +4,8 @@ import { ChangeStream, ChangeEvent, Long } from "mongodb"; import EventEmitter from "events"; const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPreference=secondaryPreferred"; +console.log(`[DB] connect: ${uri}`); + const connection = mongoose.createConnection(uri, { autoIndex: true }); export default connection; -- cgit 1.5.1 From 7685e19835afdf0b403a676c16ada663ddcbc29d Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 18:01:49 +0200 Subject: :art: Convert id bigint to string --- dist/models/Activity.d.ts | 10 ++-- dist/models/Activity.js | 4 +- dist/models/Activity.js.map | 2 +- dist/models/Application.d.ts | 6 +-- dist/models/AuditLog.d.ts | 56 ++++++++++---------- dist/models/AuditLog.js | 32 ++++++------ dist/models/AuditLog.js.map | 2 +- dist/models/Ban.d.ts | 6 +-- dist/models/Ban.js | 6 +-- dist/models/Ban.js.map | 2 +- dist/models/Channel.d.ts | 16 +++--- dist/models/Channel.js | 14 ++--- dist/models/Channel.js.map | 2 +- dist/models/Emoji.d.ts | 6 +-- dist/models/Emoji.js | 6 +-- dist/models/Emoji.js.map | 2 +- dist/models/Event.d.ts | 110 +++++++++++++++++++-------------------- dist/models/Event.js | 6 +-- dist/models/Event.js.map | 2 +- dist/models/Guild.d.ts | 18 +++---- dist/models/Guild.js | 16 +++--- dist/models/Guild.js.map | 2 +- dist/models/Interaction.d.ts | 8 +-- dist/models/Invite.d.ts | 8 +-- dist/models/Invite.js | 10 ++-- dist/models/Invite.js.map | 2 +- dist/models/Member.d.ts | 10 ++-- dist/models/Member.js | 8 +-- dist/models/Member.js.map | 2 +- dist/models/Message.d.ts | 38 +++++++------- dist/models/Message.js | 28 +++++----- dist/models/Message.js.map | 2 +- dist/models/Role.d.ts | 8 +-- dist/models/Role.js | 6 +-- dist/models/Role.js.map | 2 +- dist/models/User.d.ts | 20 ++++---- dist/models/User.js | 16 +++--- dist/models/User.js.map | 2 +- dist/models/VoiceState.d.ts | 6 +-- dist/models/VoiceState.js | 6 +-- dist/models/VoiceState.js.map | 2 +- dist/util/Permissions.d.ts | 6 +-- src/models/Activity.ts | 10 ++-- src/models/Application.ts | 6 +-- src/models/AuditLog.ts | 66 ++++++++++++------------ src/models/Ban.ts | 12 ++--- src/models/Channel.ts | 34 ++++++------- src/models/Emoji.ts | 12 ++--- src/models/Event.ts | 116 +++++++++++++++++++++--------------------- src/models/Guild.ts | 34 ++++++------- src/models/Interaction.ts | 8 +-- src/models/Invite.ts | 22 ++++---- src/models/Member.ts | 18 +++---- src/models/Message.ts | 62 +++++++++++----------- src/models/Role.ts | 14 ++--- src/models/User.ts | 36 ++++++------- src/models/VoiceState.ts | 12 ++--- src/util/Permissions.ts | 8 +-- src/util/Snowflake.ts | 2 +- 59 files changed, 493 insertions(+), 495 deletions(-) (limited to 'src/util') diff --git a/dist/models/Activity.d.ts b/dist/models/Activity.d.ts index dfa0815e..57462d60 100644 --- a/dist/models/Activity.d.ts +++ b/dist/models/Activity.d.ts @@ -3,7 +3,7 @@ import { ClientStatus, Status } from "./Status"; import { Types } from "mongoose"; export interface Presence { user: User; - guild_id?: bigint; + guild_id?: string; status: Status; activities: Activity[]; client_status: ClientStatus; @@ -17,12 +17,12 @@ export interface Activity { start?: number; end?: number; }[]; - application_id?: bigint; + application_id?: string; details?: string; state?: string; emoji?: { name: string; - id?: bigint; + id?: string; amimated?: boolean; }; party?: { @@ -52,12 +52,12 @@ export declare const Activity: { $start: NumberConstructor; $end: NumberConstructor; }[]; - $application_id: typeof Types.Long; + $application_id: StringConstructor; $details: StringConstructor; $state: StringConstructor; $emoji: { $name: StringConstructor; - $id: typeof Types.Long; + $id: StringConstructor; $amimated: BooleanConstructor; }; $party: { diff --git a/dist/models/Activity.js b/dist/models/Activity.js index 020856db..d9a19ead 100644 --- a/dist/models/Activity.js +++ b/dist/models/Activity.js @@ -13,12 +13,12 @@ exports.Activity = { $end: Number, }, ], - $application_id: mongoose_1.Types.Long, + $application_id: String, $details: String, $state: String, $emoji: { $name: String, - $id: mongoose_1.Types.Long, + $id: String, $amimated: Boolean, }, $party: { diff --git a/dist/models/Activity.js.map b/dist/models/Activity.js.map index 786f0184..8ce7d191 100644 --- a/dist/models/Activity.js.map +++ b/dist/models/Activity.js.map @@ -1 +1 @@ -{"version":3,"file":"Activity.js","sourceRoot":"","sources":["../../src/models/Activity.ts"],"names":[],"mappings":";;;AAEA,uCAA0D;AA8C7C,QAAA,QAAQ,GAAG;IACvB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE;QACZ;YACC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM;SACZ;KACD;IACD,eAAe,EAAE,gBAAK,CAAC,IAAI;IAC3B,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE;QACP,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,gBAAK,CAAC,IAAI;QACf,SAAS,EAAE,OAAO;KAClB;IACD,MAAM,EAAE;QACP,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;KACvB;IACD,OAAO,EAAE;QACR,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,MAAM;QACnB,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,MAAM;KACnB;IACD,QAAQ,EAAE;QACT,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,MAAM;QACjB,MAAM,EAAE,MAAM;KACd;IACD,SAAS,EAAE,OAAO;IAClB,MAAM,EAAE,gBAAK,CAAC,IAAI;CAClB,CAAC;AAEF,IAAY,YAMX;AAND,WAAY,YAAY;IACvB,+CAAQ,CAAA;IACR,yDAAa,CAAA;IACb,yDAAa,CAAA;IACb,mDAAU,CAAA;IACV,yDAAa,CAAA;AACd,CAAC,EANW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAMvB"} \ No newline at end of file +{"version":3,"file":"Activity.js","sourceRoot":"","sources":["../../src/models/Activity.ts"],"names":[],"mappings":";;;AAEA,uCAA0D;AA8C7C,QAAA,QAAQ,GAAG;IACvB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE;QACZ;YACC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM;SACZ;KACD;IACD,eAAe,EAAE,MAAM;IACvB,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE;QACP,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,MAAM;QACX,SAAS,EAAE,OAAO;KAClB;IACD,MAAM,EAAE;QACP,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;KACvB;IACD,OAAO,EAAE;QACR,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,MAAM;QACnB,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,MAAM;KACnB;IACD,QAAQ,EAAE;QACT,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,MAAM;QACjB,MAAM,EAAE,MAAM;KACd;IACD,SAAS,EAAE,OAAO;IAClB,MAAM,EAAE,gBAAK,CAAC,IAAI;CAClB,CAAC;AAEF,IAAY,YAMX;AAND,WAAY,YAAY;IACvB,+CAAQ,CAAA;IACR,yDAAa,CAAA;IACb,yDAAa,CAAA;IACb,mDAAU,CAAA;IACV,yDAAa,CAAA;AACd,CAAC,EANW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAMvB"} \ No newline at end of file diff --git a/dist/models/Application.d.ts b/dist/models/Application.d.ts index 53483c49..68e026bb 100644 --- a/dist/models/Application.d.ts +++ b/dist/models/Application.d.ts @@ -1,6 +1,6 @@ export interface ApplicationCommand { - id: bigint; - application_id: bigint; + id: string; + application_id: string; name: string; description: string; options?: ApplicationCommandOption[]; @@ -28,7 +28,7 @@ export declare enum ApplicationCommandOptionType { ROLE = 8 } export interface ApplicationCommandInteractionData { - id: bigint; + id: string; name: string; options?: ApplicationCommandInteractionDataOption[]; } diff --git a/dist/models/AuditLog.d.ts b/dist/models/AuditLog.d.ts index 902513a3..76c21807 100644 --- a/dist/models/AuditLog.d.ts +++ b/dist/models/AuditLog.d.ts @@ -1,5 +1,5 @@ /// -import { Schema, Document, Types } from "mongoose"; +import { Schema, Document } from "mongoose"; import { ChannelPermissionOverwrite } from "./Channel"; import { PublicUser } from "./User"; export interface AuditLogResponse { @@ -9,17 +9,17 @@ export interface AuditLogResponse { integrations: []; } export interface AuditLogEntries { - target_id?: bigint; - user_id: bigint; - id: bigint; + target_id?: string; + user_id: string; + id: string; action_type: AuditLogEvents; options?: { delete_member_days?: string; members_removed?: string; - channel_id?: bigint; - messaged_id?: bigint; + channel_id?: string; + messaged_id?: string; count?: string; - id?: bigint; + id?: string; type?: string; role_name?: string; }; @@ -38,13 +38,13 @@ export interface AuditLogChangeValue { splash_hash?: string; discovery_splash_hash?: string; banner_hash?: string; - owner_id?: bigint; + owner_id?: string; region?: string; preferred_locale?: string; - afk_channel_id?: bigint; + afk_channel_id?: string; afk_timeout?: number; - rules_channel_id?: bigint; - public_updates_channel_id?: bigint; + rules_channel_id?: string; + public_updates_channel_id?: string; mfa_level?: number; verification_level?: number; explicit_content_filter?: number; @@ -54,14 +54,14 @@ export interface AuditLogChangeValue { $remove?: {}[]; prune_delete_days?: number; widget_enabled?: boolean; - widget_channel_id?: bigint; - system_channel_id?: bigint; + widget_channel_id?: string; + system_channel_id?: string; position?: number; topic?: string; bitrate?: number; permission_overwrites?: ChannelPermissionOverwrite[]; nsfw?: boolean; - application_id?: bigint; + application_id?: string; rate_limit_per_user?: number; permissions?: string; color?: number; @@ -70,8 +70,8 @@ export interface AuditLogChangeValue { allow?: string; deny?: string; code?: string; - channel_id?: bigint; - inviter_id?: bigint; + channel_id?: string; + inviter_id?: string; max_uses?: number; uses?: number; max_age?: number; @@ -80,7 +80,7 @@ export interface AuditLogChangeValue { mute?: boolean; nick?: string; avatar_hash?: string; - id?: bigint; + id?: string; type?: number; enable_emoticons?: boolean; expire_behavior?: number; @@ -88,7 +88,7 @@ export interface AuditLogChangeValue { user_limit?: number; } export interface AuditLogEntriesDocument extends Document, AuditLogEntries { - id: bigint; + id: string; } export declare const AuditLogChanges: { name: StringConstructor; @@ -97,13 +97,13 @@ export declare const AuditLogChanges: { splash_hash: StringConstructor; discovery_splash_hash: StringConstructor; banner_hash: StringConstructor; - owner_id: typeof Types.Long; + owner_id: StringConstructor; region: StringConstructor; preferred_locale: StringConstructor; - afk_channel_id: typeof Types.Long; + afk_channel_id: StringConstructor; afk_timeout: NumberConstructor; - rules_channel_id: typeof Types.Long; - public_updates_channel_id: typeof Types.Long; + rules_channel_id: StringConstructor; + public_updates_channel_id: StringConstructor; mfa_level: NumberConstructor; verification_level: NumberConstructor; explicit_content_filter: NumberConstructor; @@ -113,14 +113,14 @@ export declare const AuditLogChanges: { $remove: {}[]; prune_delete_days: NumberConstructor; widget_enabled: BooleanConstructor; - widget_channel_id: typeof Types.Long; - system_channel_id: typeof Types.Long; + widget_channel_id: StringConstructor; + system_channel_id: StringConstructor; position: NumberConstructor; topic: StringConstructor; bitrate: NumberConstructor; permission_overwrites: {}[]; nsfw: BooleanConstructor; - application_id: typeof Types.Long; + application_id: StringConstructor; rate_limit_per_user: NumberConstructor; permissions: StringConstructor; color: NumberConstructor; @@ -129,8 +129,8 @@ export declare const AuditLogChanges: { allow: StringConstructor; deny: StringConstructor; code: StringConstructor; - channel_id: typeof Types.Long; - inviter_id: typeof Types.Long; + channel_id: StringConstructor; + inviter_id: StringConstructor; max_uses: NumberConstructor; uses: NumberConstructor; max_age: NumberConstructor; @@ -139,7 +139,7 @@ export declare const AuditLogChanges: { mute: BooleanConstructor; nick: StringConstructor; avatar_hash: StringConstructor; - id: typeof Types.Long; + id: StringConstructor; type: NumberConstructor; enable_emoticons: BooleanConstructor; expire_behavior: NumberConstructor; diff --git a/dist/models/AuditLog.js b/dist/models/AuditLog.js index 53df5c30..2a76e5b7 100644 --- a/dist/models/AuditLog.js +++ b/dist/models/AuditLog.js @@ -13,13 +13,13 @@ exports.AuditLogChanges = { splash_hash: String, discovery_splash_hash: String, banner_hash: String, - owner_id: mongoose_1.Types.Long, + owner_id: String, region: String, preferred_locale: String, - afk_channel_id: mongoose_1.Types.Long, + afk_channel_id: String, afk_timeout: Number, - rules_channel_id: mongoose_1.Types.Long, - public_updates_channel_id: mongoose_1.Types.Long, + rules_channel_id: String, + public_updates_channel_id: String, mfa_level: Number, verification_level: Number, explicit_content_filter: Number, @@ -29,14 +29,14 @@ exports.AuditLogChanges = { $remove: [{}], prune_delete_days: Number, widget_enabled: Boolean, - widget_channel_id: mongoose_1.Types.Long, - system_channel_id: mongoose_1.Types.Long, + widget_channel_id: String, + system_channel_id: String, position: Number, topic: String, bitrate: Number, permission_overwrites: [{}], nsfw: Boolean, - application_id: mongoose_1.Types.Long, + application_id: String, rate_limit_per_user: Number, permissions: String, color: Number, @@ -45,8 +45,8 @@ exports.AuditLogChanges = { allow: String, deny: String, code: String, - channel_id: mongoose_1.Types.Long, - inviter_id: mongoose_1.Types.Long, + channel_id: String, + inviter_id: String, max_uses: Number, uses: Number, max_age: Number, @@ -55,7 +55,7 @@ exports.AuditLogChanges = { mute: Boolean, nick: String, avatar_hash: String, - id: mongoose_1.Types.Long, + id: String, type: Number, enable_emoticons: Boolean, expire_behavior: Number, @@ -63,17 +63,17 @@ exports.AuditLogChanges = { 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 }, + target_id: String, + user_id: { type: String, required: true }, + id: { type: String, required: true }, action_type: { type: Number, required: true }, options: { delete_member_days: String, members_removed: String, - channel_id: mongoose_1.Types.Long, - messaged_id: mongoose_1.Types.Long, + channel_id: String, + messaged_id: String, count: String, - id: mongoose_1.Types.Long, + id: String, type: String, role_name: String, }, diff --git a/dist/models/AuditLog.js.map b/dist/models/AuditLog.js.map index b809fa3d..6529c239 100644 --- a/dist/models/AuditLog.js.map +++ b/dist/models/AuditLog.js.map @@ -1 +1 @@ -{"version":3,"file":"AuditLog.js","sourceRoot":"","sources":["../../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;AApCD,WAAY,cAAc;IACzB,mEAAgB,CAAA;IAChB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,4FAA6B,CAAA;IAC7B,4FAA6B,CAAA;IAC7B,4FAA6B,CAAA;IAC7B,kEAAgB,CAAA;IAChB,oEAAiB,CAAA;IACjB,wEAAmB,CAAA;IACnB,8EAAsB,CAAA;IACtB,sEAAkB,CAAA;IAClB,gFAAuB,CAAA;IACvB,kEAAgB,CAAA;IAChB,8EAAsB,CAAA;IACtB,0DAAY,CAAA;IACZ,kEAAgB,CAAA;IAChB,kEAAgB,CAAA;IAChB,kEAAgB,CAAA;IAChB,sEAAkB,CAAA;IAClB,sEAAkB,CAAA;IAClB,sEAAkB,CAAA;IAClB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,oEAAiB,CAAA;IACjB,oEAAiB,CAAA;IACjB,oEAAiB,CAAA;IACjB,wEAAmB,CAAA;IACnB,kFAAwB,CAAA;IACxB,kEAAgB,CAAA;IAChB,sEAAkB,CAAA;IAClB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;AACxB,CAAC,EApCW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAoCzB"} \ No newline at end of file +{"version":3,"file":"AuditLog.js","sourceRoot":"","sources":["../../src/models/AuditLog.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAiGrB,QAAA,eAAe,GAAG;IAC9B,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,MAAM;IACnB,qBAAqB,EAAE,MAAM;IAC7B,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,MAAM;IACxB,cAAc,EAAE,MAAM;IACtB,WAAW,EAAE,MAAM;IACnB,gBAAgB,EAAE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EAAmB,CAAA;IACnB,kFAAwB,CAAA;IACxB,kEAAgB,CAAA;IAChB,sEAAkB,CAAA;IAClB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;AACxB,CAAC,EApCW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAoCzB"} \ No newline at end of file diff --git a/dist/models/Ban.d.ts b/dist/models/Ban.d.ts index a4357d5c..ad3a39b7 100644 --- a/dist/models/Ban.d.ts +++ b/dist/models/Ban.d.ts @@ -1,9 +1,9 @@ /// import { Schema, Document } from "mongoose"; export interface Ban extends Document { - user_id: bigint; - guild_id: bigint; - executor_id: bigint; + user_id: string; + guild_id: string; + executor_id: string; ip: string; reason?: string; } diff --git a/dist/models/Ban.js b/dist/models/Ban.js index abb0a4e2..0b7f30b5 100644 --- a/dist/models/Ban.js +++ b/dist/models/Ban.js @@ -7,9 +7,9 @@ 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 }, + user_id: { type: String, required: true }, + guild_id: { type: String, required: true }, + executor_id: { type: String, required: true }, reason: String, ip: String, }); diff --git a/dist/models/Ban.js.map b/dist/models/Ban.js.map index 580002a0..6a10fccb 100644 --- a/dist/models/Ban.js.map +++ b/dist/models/Ban.js.map @@ -1 +1 @@ -{"version":3,"file":"Ban.js","sourceRoot":"","sources":["../../src/models/Ban.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAUrB,QAAA,SAAS,GAAG,IAAI,iBAAM,CAAC;IACnC,OAAO,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC7C,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC9C,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACjD,MAAM,EAAE,MAAM;IACd,EAAE,EAAE,MAAM;CACV,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,QAAQ,GAAG,kBAAE,CAAC,KAAK,CAAM,KAAK,EAAE,iBAAS,EAAE,MAAM,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"Ban.js","sourceRoot":"","sources":["../../src/models/Ban.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAUrB,QAAA,SAAS,GAAG,IAAI,iBAAM,CAAC;IACnC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1C,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC7C,MAAM,EAAE,MAAM;IACd,EAAE,EAAE,MAAM;CACV,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,QAAQ,GAAG,kBAAE,CAAC,KAAK,CAAM,KAAK,EAAE,iBAAS,EAAE,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Channel.d.ts b/dist/models/Channel.d.ts index 5cd7b342..d3048622 100644 --- a/dist/models/Channel.d.ts +++ b/dist/models/Channel.d.ts @@ -3,30 +3,30 @@ import { Schema, Document } from "mongoose"; export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel { } export interface ChannelDocument extends Document, AnyChannel { - id: bigint; + id: string; } export declare const ChannelSchema: Schema, import("mongoose").Model>, undefined>; export declare const ChannelModel: import("mongoose").Model; export interface Channel { - id: bigint; + id: string; created_at: Date; name: string; type: number; } export interface TextBasedChannel { - last_message_id?: bigint; + last_message_id?: string; last_pin_timestamp?: number; } export interface GuildChannel extends Channel { - guild_id: bigint; + guild_id: string; position: number; - parent_id?: bigint; + parent_id?: string; permission_overwrites: ChannelPermissionOverwrite[]; } export interface ChannelPermissionOverwrite { allow: bigint; deny: bigint; - id: bigint; + id: string; type: ChannelPermissionOverwriteType; } export declare enum ChannelPermissionOverwriteType { @@ -41,8 +41,8 @@ export interface TextChannel extends GuildChannel, TextBasedChannel { topic?: string; } export interface DMChannel extends Channel, TextBasedChannel { - owner_id: bigint; - recipients: bigint[]; + owner_id: string; + recipients: string[]; } export declare enum ChannelType { GUILD_TEXT = 0, diff --git a/dist/models/Channel.js b/dist/models/Channel.js index 0c9a652a..956b1fc5 100644 --- a/dist/models/Channel.js +++ b/dist/models/Channel.js @@ -7,16 +7,16 @@ exports.ChannelType = exports.ChannelPermissionOverwriteType = exports.ChannelMo const mongoose_1 = require("mongoose"); const Database_1 = __importDefault(require("../util/Database")); exports.ChannelSchema = new mongoose_1.Schema({ - id: mongoose_1.Types.Long, + id: String, 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], + guild_id: String, + owner_id: String, + parent_id: String, + recipients: [String], position: Number, - last_message_id: mongoose_1.Types.Long, + last_message_id: String, last_pin_timestamp: Date, nsfw: Boolean, rate_limit_per_user: Number, @@ -25,7 +25,7 @@ exports.ChannelSchema = new mongoose_1.Schema({ { allow: mongoose_1.Types.Long, deny: mongoose_1.Types.Long, - id: mongoose_1.Types.Long, + id: String, type: Number, }, ], diff --git a/dist/models/Channel.js.map b/dist/models/Channel.js.map index 845169ac..ff804845 100644 --- a/dist/models/Channel.js.map +++ b/dist/models/Channel.js.map @@ -1 +1 @@ -{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../../src/models/Channel.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAA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Ac,CAAA;IACd,2DAAe,CAAA;AAChB,CAAC,EARW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAQtB"} \ No newline at end of file +{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../../src/models/Channel.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAQrB,QAAA,aAAa,GAAG,IAAI,iBAAM,CAAC;IACvC,EAAE,EAAE,MAAM;IACV,UAAU,EAAE,EAAE,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM;IAChB,eAAe,EAAE,MAAM;IACvB,kBAAkB,EAAE,IAAI;IACxB,IAAI,EAAE,OAAO;IACb,mBAAmB,EAAE,MAAM;IAC3B,KAAK,EAAE,MAAM;IACb,qBAAqB,EAAE;QACtB;YACC,KAAK,EAAE,gBAAK,CAAC,IAAI;YACjB,IAAI,EAAE,gBAAK,CAAC,IAAI;YAChB,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,MAAM;SACZ;KACD;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,YAAY,GAAG,kBAAE,CAAC,KAAK,CAAkB,SAAS,EAAE,qBAAa,EAAE,UAAU,CAAC,CAAC;AA4B5F,IAAY,8BAGX;AAHD,WAAY,8BAA8B;IACzC,mFAAQ,CAAA;IACR,uFAAU,CAAA;AACX,CAAC,EAHW,8BAA8B,GAA9B,sCAA8B,KAA9B,sCAA8B,QAGzC;AAeD,IAAY,WAQX;AARD,WAAY,WAAW;IACtB,yDAAc,CAAA;IACd,yCAAM,CAAA;IACN,2DAAe,CAAA;IACf,qDAAY,CAAA;IACZ,iEAAkB,CAAA;IAClB,yDAAc,CAAA;IACd,2DAAe,CAAA;AAChB,CAAC,EARW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAQtB"} \ No newline at end of file diff --git a/dist/models/Emoji.d.ts b/dist/models/Emoji.d.ts index 91c1abfe..9e53cc72 100644 --- a/dist/models/Emoji.d.ts +++ b/dist/models/Emoji.d.ts @@ -1,15 +1,15 @@ /// import { Schema, Document } from "mongoose"; export interface Emoji extends Document { - id: bigint; + id: string; animated: boolean; available: boolean; - guild_id: bigint; + guild_id: string; managed: boolean; name: string; require_colons: boolean; url: string; - roles: bigint[]; + roles: string[]; } export declare const EmojiSchema: Schema, import("mongoose").Model>, undefined>; export declare const EmojiModel: import("mongoose").Model; diff --git a/dist/models/Emoji.js b/dist/models/Emoji.js index 79f2543f..5f9fc56f 100644 --- a/dist/models/Emoji.js +++ b/dist/models/Emoji.js @@ -7,15 +7,15 @@ 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 }, + id: { type: String, required: true }, animated: Boolean, available: Boolean, - guild_id: mongoose_1.Types.Long, + guild_id: String, managed: Boolean, name: String, require_colons: Boolean, url: String, - roles: [mongoose_1.Types.Long], + roles: [String], }); // @ts-ignore exports.EmojiModel = Database_1.default.model("Emoji", exports.EmojiSchema, "emojis"); diff --git a/dist/models/Emoji.js.map b/dist/models/Emoji.js.map index 76e2fd4d..f66fe302 100644 --- a/dist/models/Emoji.js.map +++ b/dist/models/Emoji.js.map @@ -1 +1 @@ -{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../src/models/Emoji.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAcrB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,OAAO;IACvB,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;CACnB,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAQ,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../src/models/Emoji.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAcrB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpC,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,OAAO;IACvB,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,CAAC,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAQ,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Event.d.ts b/dist/models/Event.d.ts index e00c2a97..00ca7cac 100644 --- a/dist/models/Event.d.ts +++ b/dist/models/Event.d.ts @@ -13,9 +13,9 @@ 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; + guild_id?: string; + user_id?: string; + channel_id?: string; created_at?: Date; event: EVENT; data?: any; @@ -90,14 +90,14 @@ export interface ReadyEventData { partial: boolean; }; application?: { - id: bigint; + id: string; flags: bigint; }; merged_members?: Omit[][]; users?: { avatar?: string; discriminator: string; - id: bigint; + id: string; username: string; bot: boolean; public_flags: bigint; @@ -122,8 +122,8 @@ export interface ChannelDeleteEvent extends Event { export interface ChannelPinsUpdateEvent extends Event { event: "CHANNEL_PINS_UPDATE"; data: { - guild_id?: bigint; - channel_id: bigint; + guild_id?: string; + channel_id: string; last_pin_timestamp: number; }; } @@ -138,55 +138,55 @@ export interface GuildUpdateEvent extends Event { export interface GuildDeleteEvent extends Event { event: "GUILD_DELETE"; data: { - id: bigint; + id: string; unavailable?: boolean; }; } export interface GuildBanAddEvent extends Event { event: "GUILD_BAN_ADD"; data: { - guild_id: bigint; + guild_id: string; user: User; }; } export interface GuildBanRemoveEvent extends Event { event: "GUILD_BAN_REMOVE"; data: { - guild_id: bigint; + guild_id: string; user: User; }; } export interface GuildEmojiUpdateEvent extends Event { event: "GUILD_EMOJI_UPDATE"; data: { - guild_id: bigint; + guild_id: string; emojis: Emoji[]; }; } export interface GuildIntegrationUpdateEvent extends Event { event: "GUILD_INTEGRATIONS_UPDATE"; data: { - guild_id: bigint; + guild_id: string; }; } export interface GuildMemberAddEvent extends Event { event: "GUILD_MEMBER_ADD"; data: PublicMember & { - guild_id: bigint; + guild_id: string; }; } export interface GuildMemberRemoveEvent extends Event { event: "GUILD_MEMBER_REMOVE"; data: { - guild_id: bigint; + guild_id: string; user: User; }; } export interface GuildMemberUpdateEvent extends Event { event: "GUILD_MEMBER_UPDATE"; data: { - guild_id: bigint; - roles: bigint[]; + guild_id: string; + roles: string[]; user: User; nick?: string; joined_at: Date; @@ -197,11 +197,11 @@ export interface GuildMemberUpdateEvent extends Event { export interface GuildMembersChunkEvent extends Event { event: "GUILD_MEMBERS_CHUNK"; data: { - guild_id: bigint; + guild_id: string; members: PublicMember[]; chunk_index: number; chunk_count: number; - not_found: bigint[]; + not_found: string[]; presences: Presence[]; nonce?: string; }; @@ -209,42 +209,42 @@ export interface GuildMembersChunkEvent extends Event { export interface GuildRoleCreateEvent extends Event { event: "GUILD_ROLE_CREATE"; data: { - guild_id: bigint; + guild_id: string; role: Role; }; } export interface GuildRoleUpdateEvent extends Event { event: "GUILD_ROLE_UPDATE"; data: { - guild_id: bigint; + guild_id: string; role: Role; }; } export interface GuildRoleDeleteEvent extends Event { event: "GUILD_ROLE_DELETE"; data: { - guild_id: bigint; - role_id: bigint; + guild_id: string; + role_id: string; }; } export interface InviteCreateEvent extends Event { event: "INVITE_CREATE"; data: Omit & { - channel_id: bigint; - guild_id?: bigint; + channel_id: string; + guild_id?: string; }; } export interface InviteDeleteEvent extends Event { event: "INVITE_DELETE"; data: { - channel_id: bigint; - guild_id?: bigint; + channel_id: string; + guild_id?: string; code: string; }; } export declare type MessagePayload = Omit & { - channel_id: bigint; - guild_id?: bigint; + channel_id: string; + guild_id?: string; author: User; member: PublicMember; mentions: (User & { @@ -262,26 +262,26 @@ export interface MessageUpdateEvent extends Event { export interface MessageDeleteEvent extends Event { event: "MESSAGE_DELETE"; data: { - id: bigint; - channel_id: bigint; - guild_id?: bigint; + id: string; + channel_id: string; + guild_id?: string; }; } export interface MessageDeleteBulkEvent extends Event { event: "MESSAGE_DELETE_BULK"; data: { - ids: bigint[]; - channel_id: bigint; - guild_id?: bigint; + ids: string[]; + channel_id: string; + guild_id?: string; }; } export interface MessageReactionAddEvent extends Event { event: "MESSAGE_REACTION_ADD"; data: { - user_id: bigint; - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + user_id: string; + channel_id: string; + message_id: string; + guild_id?: string; member?: PublicMember; emoji: PartialEmoji; }; @@ -289,27 +289,27 @@ export interface MessageReactionAddEvent extends Event { export interface MessageReactionRemoveEvent extends Event { event: "MESSAGE_REACTION_REMOVE"; data: { - user_id: bigint; - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + user_id: string; + channel_id: string; + message_id: string; + guild_id?: string; emoji: PartialEmoji; }; } export interface MessageReactionRemoveAllEvent extends Event { event: "MESSAGE_REACTION_REMOVE_ALL"; data: { - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + channel_id: string; + message_id: string; + guild_id?: string; }; } export interface MessageReactionRemoveEmojiEvent extends Event { event: "MESSAGE_REACTION_REMOVE_EMOJI"; data: { - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + channel_id: string; + message_id: string; + guild_id?: string; emoji: PartialEmoji; }; } @@ -320,10 +320,10 @@ export interface PresenceUpdateEvent extends Event { export interface TypingStartEvent extends Event { event: "TYPING_START"; data: { - channel_id: bigint; - user_id: bigint; + channel_id: string; + user_id: string; timestamp: number; - guild_id?: bigint; + guild_id?: string; member?: PublicMember; }; } @@ -341,19 +341,19 @@ export interface VoiceServerUpdateEvent extends Event { event: "VOICE_SERVER_UPDATE"; data: { token: string; - guild_id: bigint; + guild_id: string; endpoint: string; }; } export interface WebhooksUpdateEvent extends Event { event: "WEBHOOKS_UPDATE"; data: { - guild_id: bigint; - channel_id: bigint; + guild_id: string; + channel_id: string; }; } export declare type ApplicationCommandPayload = ApplicationCommand & { - guild_id: bigint; + guild_id: string; }; export interface ApplicationCommandCreateEvent extends Event { event: "APPLICATION_COMMAND_CREATE"; diff --git a/dist/models/Event.js b/dist/models/Event.js index d6eb6f6e..9d442aad 100644 --- a/dist/models/Event.js +++ b/dist/models/Event.js @@ -7,9 +7,9 @@ exports.EVENTEnum = exports.EventModel = exports.EventSchema = void 0; const mongoose_1 = require("mongoose"); const Database_1 = __importDefault(require("../util/Database")); exports.EventSchema = new mongoose_1.Schema({ - guild_id: mongoose_1.Types.Long, - user_id: mongoose_1.Types.Long, - channel_id: mongoose_1.Types.Long, + guild_id: String, + user_id: String, + channel_id: String, created_at: { type: Date, required: true }, event: { type: String, required: true }, data: Object, diff --git a/dist/models/Event.js.map b/dist/models/Event.js.map index 268c8597..bd27fa9e 100644 --- a/dist/models/Event.js.map +++ b/dist/models/Event.js.map @@ -1 +1 @@ -{"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;AAkYlF,+BAA+B;AAE/B,IAAY,SAyCX;AAzCD,WAAY,SAAS;IACpB,4BAAe,CAAA;IACf,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,yCAA4B,CAAA;IAC5B,yCAA4B,CAAA;IAC5B,0CAA6B,CAAA;IAC7B,gDAAmC,CAAA;IACnC,mDAAsC,CAAA;IACtC,kEAAqD,CAAA;IACrD,gDAAmC,CAAA;IACnC,sDAAyC,CAAA;IACzC,sDAAyC,CAAA;IACzC,0DAA6C,CAAA;IAC7C,sDAAyC,CAAA;IACzC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,2CAA8B,CAAA;IAC9B,2CAA8B,CAAA;IAC9B,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,sDAAyC,CAAA;IACzC,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;IACjD,qEAAwD,CAAA;IACxD,yEAA4D,CAAA;IAC5D,+CAAkC,CAAA;IAClC,yCAA4B,CAAA;IAC5B,uCAA0B,CAAA;IAC1B,+CAAkC,CAAA;IAClC,qDAAwC,CAAA;IACxC,oDAAuC,CAAA;IACvC,sDAAyC,CAAA;IACzC,oEAAuD,CAAA;IACvD,oEAAuD,CAAA;IACvD,oEAAuD,CAAA;AACxD,CAAC,EAzCW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAyCpB"} \ No newline at end of file +{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../src/models/Event.ts"],"names":[],"mappings":";;;;;;AAYA,uCAA0D;AAC1D,gEAAkC;AAarB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1C,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvC,IAAI,EAAE,MAAM;CACZ,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAgB,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC;AAkYlF,+BAA+B;AAE/B,IAAY,SAyCX;AAzCD,WAAY,SAAS;IACpB,4BAAe,CAAA;IACf,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,yCAA4B,CAAA;IAC5B,yCAA4B,CAAA;IAC5B,0CAA6B,CAAA;IAC7B,gDAAmC,CAAA;IACnC,mDAAsC,CAAA;IACtC,kEAAqD,CAAA;IACrD,gDAAmC,CAAA;IACnC,sDAAyC,CAAA;IACzC,sDAAyC,CAAA;IACzC,0DAA6C,CAAA;IAC7C,sDAAyC,CAAA;IACzC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,2CAA8B,CAAA;IAC9B,2CAA8B,CAAA;IAC9B,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,sDAAyC,CAAA;IACzC,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;IACjD,qEAAwD,CAAA;IACxD,yEAA4D,CAAA;IAC5D,+CAAkC,CAAA;IAClC,yCAA4B,CAAA;IAC5B,uCAA0B,CAAA;IAC1B,+CAAkC,CAAA;IAClC,qDAAwC,CAAA;IACxC,oDAAuC,CAAA;IACvC,sDAAyC,CAAA;IACzC,oEAAuD,CAAA;IACvD,oEAAuD,CAAA;IACvD,oEAAuD,CAAA;AACxD,CAAC,EAzCW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAyCpB"} \ No newline at end of file diff --git a/dist/models/Guild.d.ts b/dist/models/Guild.d.ts index 7ea96716..d7d94cb2 100644 --- a/dist/models/Guild.d.ts +++ b/dist/models/Guild.d.ts @@ -1,13 +1,13 @@ /// import { Schema, Document } from "mongoose"; export interface GuildDocument extends Document, Guild { - id: bigint; + id: string; } export interface Guild { - id: bigint; - afk_channel_id?: bigint; + id: string; + afk_channel_id?: string; afk_timeout?: number; - application_id?: bigint; + application_id?: string; banner?: string; default_message_notifications?: number; description?: string; @@ -23,21 +23,21 @@ export interface Guild { presence_count?: number; mfa_level?: number; name: string; - owner_id: bigint; + owner_id: string; preferred_locale?: string; premium_subscription_count?: number; premium_tier?: number; - public_updates_channel_id?: bigint; + public_updates_channel_id?: string; region?: string; - rules_channel_id?: bigint; + rules_channel_id?: string; splash?: string; system_channel_flags?: number; - system_channel_id?: bigint; + system_channel_id?: string; unavailable?: boolean; vanity_url_code?: string; verification_level?: number; welcome_screen: []; - widget_channel_id?: bigint; + widget_channel_id?: string; widget_enabled?: boolean; } export declare const GuildSchema: Schema, import("mongoose").Model>, undefined>; diff --git a/dist/models/Guild.js b/dist/models/Guild.js index 6a8adfc5..fa87d542 100644 --- a/dist/models/Guild.js +++ b/dist/models/Guild.js @@ -11,10 +11,10 @@ const Emoji_1 = require("./Emoji"); const Member_1 = require("./Member"); const Role_1 = require("./Role"); exports.GuildSchema = new mongoose_1.Schema({ - id: { type: mongoose_1.Types.Long, required: true }, - afk_channel_id: mongoose_1.Types.Long, + id: { type: String, required: true }, + afk_channel_id: String, afk_timeout: Number, - application_id: mongoose_1.Types.Long, + application_id: String, banner: String, default_message_notifications: Number, description: String, @@ -30,22 +30,22 @@ exports.GuildSchema = new mongoose_1.Schema({ presence_count: Number, mfa_level: Number, name: { type: String, required: true }, - owner_id: { type: mongoose_1.Types.Long, required: true }, + owner_id: { type: String, required: true }, preferred_locale: String, premium_subscription_count: Number, premium_tier: Number, - public_updates_channel_id: mongoose_1.Types.Long, + public_updates_channel_id: String, region: String, - rules_channel_id: mongoose_1.Types.Long, + rules_channel_id: String, splash: String, system_channel_flags: Number, - system_channel_id: mongoose_1.Types.Long, + system_channel_id: String, unavailable: Boolean, vanity_url_code: String, verification_level: Number, voice_states: { type: [Object], default: [] }, welcome_screen: { type: [Object], default: [] }, - widget_channel_id: mongoose_1.Types.Long, + widget_channel_id: String, widget_enabled: Boolean, }); exports.GuildSchema.virtual("channels", { diff --git a/dist/models/Guild.js.map b/dist/models/Guild.js.map index e64d6c61..aaa3951b 100644 --- a/dist/models/Guild.js.map +++ b/dist/models/Guild.js.map @@ -1 +1 @@ -{"version":3,"file":"Guild.js","sourceRoot":"","sources":["../../src/models/Guild.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAClC,uCAAyC;AACzC,mCAAqC;AACrC,qCAAuC;AACvC,iCAAmC;AAiDtB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI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,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,SAAS,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAgB,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Interaction.d.ts b/dist/models/Interaction.d.ts index df03b8a9..53836981 100644 --- a/dist/models/Interaction.d.ts +++ b/dist/models/Interaction.d.ts @@ -1,11 +1,11 @@ import { AllowedMentions, Embed } from "./Message"; export interface Interaction { - id: bigint; + id: string; type: InteractionType; data?: {}; - guild_id: bigint; - channel_id: bigint; - member_id: bigint; + guild_id: string; + channel_id: string; + member_id: string; token: string; version: number; } diff --git a/dist/models/Invite.d.ts b/dist/models/Invite.d.ts index a151322b..e6de64d3 100644 --- a/dist/models/Invite.d.ts +++ b/dist/models/Invite.d.ts @@ -7,10 +7,10 @@ export interface Invite extends Document { max_uses: number; max_age: number; created_at: Date; - guild_id: bigint; - channel_id: bigint; - inviter_id: bigint; - target_user_id?: bigint; + guild_id: string; + channel_id: string; + inviter_id: string; + target_user_id?: string; target_user_type?: number; } export declare const InviteSchema: Schema, import("mongoose").Model>, undefined>; diff --git a/dist/models/Invite.js b/dist/models/Invite.js index 31d21278..9113abcc 100644 --- a/dist/models/Invite.js +++ b/dist/models/Invite.js @@ -13,11 +13,11 @@ exports.InviteSchema = new mongoose_1.Schema({ 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, + guild_id: String, + channel_id: String, + inviter_id: String, + // ? What the fucking shit is this + target_user_id: String, target_user_type: Number, }); // @ts-ignore diff --git a/dist/models/Invite.js.map b/dist/models/Invite.js.map index 3b25219f..3e69e1d1 100644 --- a/dist/models/Invite.js.map +++ b/dist/models/Invite.js.map @@ -1 +1 @@ -{"version":3,"file":"Invite.js","sourceRoot":"","sources":["../../src/models/Invite.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAmBrB,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,UAAU,EAAE,gBAAK,CAAC,IAAI;IACtB,UAAU,EAAE,gBAAK,CAAC,IAAI;IAEtB,iCAAiC;IACjC,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,gBAAgB,EAAE,MAAM;CAExB,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,WAAW,GAAG,kBAAE,CAAC,KAAK,CAAS,QAAQ,EAAE,oBAAY,EAAE,SAAS,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"Invite.js","sourceRoot":"","sources":["../../src/models/Invite.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAkBrB,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAElB,kCAAkC;IAClC,cAAc,EAAE,MAAM;IACtB,gBAAgB,EAAE,MAAM;CACxB,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,WAAW,GAAG,kBAAE,CAAC,KAAK,CAAS,QAAQ,EAAE,oBAAY,EAAE,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Member.d.ts b/dist/models/Member.d.ts index bf930613..26079e7c 100644 --- a/dist/models/Member.d.ts +++ b/dist/models/Member.d.ts @@ -2,10 +2,10 @@ import { PublicUser, User } from "./User"; import { Schema, Document } from "mongoose"; export interface Member { - id: bigint; - guild_id: bigint; + id: string; + guild_id: string; nick?: string; - roles: bigint[]; + roles: string[]; joined_at: Date; premium_since?: number; deaf: boolean; @@ -15,11 +15,11 @@ export interface Member { user?: User; } export interface MemberDocument extends Member, Document { - id: bigint; + id: string; } export interface UserGuildSettings { channel_overrides: { - channel_id: bigint; + channel_id: string; message_notifications: number; mute_config: MuteConfig; muted: boolean; diff --git a/dist/models/Member.js b/dist/models/Member.js index 26a728f0..c7717dd2 100644 --- a/dist/models/Member.js +++ b/dist/models/Member.js @@ -12,10 +12,10 @@ const MuteConfig = { selected_time_window: Number, }; exports.MemberSchema = new mongoose_1.Schema({ - id: { type: mongoose_1.Types.Long, required: true }, - guild_id: mongoose_1.Types.Long, + id: { type: String, required: true }, + guild_id: String, nick: String, - roles: [mongoose_1.Types.Long], + roles: [String], joined_at: Date, premium_since: Number, deaf: Boolean, @@ -24,7 +24,7 @@ exports.MemberSchema = new mongoose_1.Schema({ settings: { channel_overrides: [ { - channel_id: mongoose_1.Types.Long, + channel_id: String, message_notifications: Number, mute_config: MuteConfig, muted: Boolean, diff --git a/dist/models/Member.js.map b/dist/models/Member.js.map index aa0bae9b..c39e4bd1 100644 --- a/dist/models/Member.js.map +++ b/dist/models/Member.js.map @@ -1 +1 @@ -{"version":3,"file":"Member.js","sourceRoot":"","sources":["../../src/models/Member.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAqD;AACrD,uCAAmD;AACnD,gEAAkC;AAyClC,MAAM,UAAU,GAAG;IAClB,QAAQ,EAAE,MAAM;IAChB,oBAAoB,EAAE,MAAM;CAC5B,CAAC;AAEW,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;IACnB,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,MAAM;IACrB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE;QACT,iBAAiB,EAAE;YAClB;gBACC,UAAU,EAAE,gBAAK,CAAC,IAAI;gBACtB,qBAAqB,EAAE,MAAM;gBAC7B,WAAW,EAAE,UAAU;gBACvB,KAAK,EAAE,OAAO;aACd;SACD;QACD,qBAAqB,EAAE,MAAM;QAC7B,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE,OAAO;QACd,iBAAiB,EAAE,OAAO;QAC1B,cAAc,EAAE,OAAO;QACvB,OAAO,EAAE,MAAM;KACf;CACD,CAAC,CAAC;AAEH,oBAAY,CAAC,OAAO,CAAC,MAAM,EAAE;IAC5B,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,WAAW,GAAG,kBAAE,CAAC,KAAK,CAAiB,QAAQ,EAAE,oBAAY,EAAE,SAAS,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"Member.js","sourceRoot":"","sources":["../../src/models/Member.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAqD;AACrD,uCAAmD;AACnD,gEAAkC;AAyClC,MAAM,UAAU,GAAG;IAClB,QAAQ,EAAE,MAAM;IAChB,oBAAoB,EAAE,MAAM;CAC5B,CAAC;AAEW,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpC,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,CAAC,MAAM,CAAC;IACf,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,MAAM;IACrB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE;QACT,iBAAiB,EAAE;YAClB;gBACC,UAAU,EAAE,MAAM;gBAClB,qBAAqB,EAAE,MAAM;gBAC7B,WAAW,EAAE,UAAU;gBACvB,KAAK,EAAE,OAAO;aACd;SACD;QACD,qBAAqB,EAAE,MAAM;QAC7B,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE,OAAO;QACd,iBAAiB,EAAE,OAAO;QAC1B,cAAc,EAAE,OAAO;QACvB,OAAO,EAAE,MAAM;KACf;CACD,CAAC,CAAC;AAEH,oBAAY,CAAC,OAAO,CAAC,MAAM,EAAE;IAC5B,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,WAAW,GAAG,kBAAE,CAAC,KAAK,CAAiB,QAAQ,EAAE,oBAAY,EAAE,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Message.d.ts b/dist/models/Message.d.ts index a823ce5e..a629f7ee 100644 --- a/dist/models/Message.d.ts +++ b/dist/models/Message.d.ts @@ -1,20 +1,20 @@ /// -import { Schema, Types, Document } from "mongoose"; +import { Schema, Document } from "mongoose"; export interface Message { - id: bigint; - channel_id: bigint; - guild_id?: bigint; - author_id?: bigint; - webhook_id?: bigint; - application_id?: bigint; + id: string; + channel_id: string; + guild_id?: string; + author_id?: string; + webhook_id?: string; + application_id?: string; content?: string; timestamp: Date; edited_timestamp?: Date; tts?: boolean; mention_everyone?: boolean; - mention_user_ids: bigint[]; - mention_role_ids: bigint[]; - mention_channels_ids: bigint[]; + mention_user_ids: string[]; + mention_role_ids: string[]; + mention_channels_ids: string[]; attachments: Attachment[]; embeds: Embed[]; reactions: Reaction[]; @@ -28,13 +28,13 @@ export interface Message { flags?: bigint; stickers?: []; message_reference?: { - message_id: bigint; - channel_id?: bigint; - guild_id?: bigint; + message_id: string; + channel_id?: string; + guild_id?: string; }; } export interface MessageDocument extends Document, Message { - id: bigint; + id: string; } export declare enum MessageType { DEFAULT = 0, @@ -56,7 +56,7 @@ export declare enum MessageType { APPLICATION_COMMAND = 20 } export interface Attachment { - id: bigint; + id: string; filename: string; size: number; url: string; @@ -106,18 +106,18 @@ export interface Reaction { emoji: PartialEmoji; } export interface PartialEmoji { - id?: bigint; + id?: string; name: string; animated?: boolean; } export interface AllowedMentions { parse?: ("users" | "roles" | "everyone")[]; - roles?: bigint[]; - users?: bigint[]; + roles?: string[]; + users?: string[]; replied_user?: boolean; } export declare const Attachment: { - id: typeof Types.Long; + id: StringConstructor; filename: StringConstructor; size: NumberConstructor; url: StringConstructor; diff --git a/dist/models/Message.js b/dist/models/Message.js index add929c6..1adca30c 100644 --- a/dist/models/Message.js +++ b/dist/models/Message.js @@ -30,7 +30,7 @@ var MessageType; MessageType[MessageType["APPLICATION_COMMAND"] = 20] = "APPLICATION_COMMAND"; })(MessageType = exports.MessageType || (exports.MessageType = {})); exports.Attachment = { - id: mongoose_1.Types.Long, + id: String, filename: String, size: Number, url: String, @@ -47,7 +47,7 @@ exports.EmbedImage = { const Reaction = { count: Number, emoji: { - id: mongoose_1.Types.Long, + id: String, name: String, animated: Boolean, }, @@ -86,20 +86,20 @@ exports.Embed = { ], }; 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, + id: String, + channel_id: String, + author_id: String, + webhook_id: String, + guild_id: String, + application_id: String, content: String, timestamp: Date, edited_timestamp: Date, tts: Boolean, mention_everyone: Boolean, - mention_user_ids: [mongoose_1.Types.Long], - mention_role_ids: [mongoose_1.Types.Long], - mention_channel_ids: [mongoose_1.Types.Long], + mention_user_ids: [String], + mention_role_ids: [String], + mention_channel_ids: [String], attachments: [exports.Attachment], embeds: [exports.Embed], reactions: [Reaction], @@ -113,9 +113,9 @@ exports.MessageSchema = new mongoose_1.Schema({ 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, + message_id: String, + channel_id: String, + guild_id: String, }, }); exports.MessageSchema.virtual("author", { diff --git a/dist/models/Message.js.map b/dist/models/Message.js.map index 6e8bb229..e4387a0e 100644 --- a/dist/models/Message.js.map +++ b/dist/models/Message.js.map @@ -1 +1 @@ -{"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,E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G,EAAE,gBAAS;IACd,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,eAAe,EAAE;IACtC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,kBAAkB,EAAE;IACzC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,kCAAkC;AAClC,yCAAyC;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"} \ No newline at end of file +{"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,QAkBt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,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,eAAe,EAAE;IACtC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,kBAAkB,EAAE;IACzC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,kCAAkC;AAClC,yCAAyC;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"} \ No newline at end of file diff --git a/dist/models/Role.d.ts b/dist/models/Role.d.ts index 6a3f1669..d6765283 100644 --- a/dist/models/Role.d.ts +++ b/dist/models/Role.d.ts @@ -1,8 +1,8 @@ /// import { Schema, Document } from "mongoose"; export interface Role { - id: bigint; - guild_id: bigint; + id: string; + guild_id: string; color: number; hoist: boolean; managed: boolean; @@ -11,11 +11,11 @@ export interface Role { permissions: bigint; position: number; tags?: { - bot_id?: bigint; + bot_id?: string; }; } export interface RoleDocument extends Document, Role { - id: bigint; + id: string; } export declare const RoleSchema: Schema, import("mongoose").Model>, undefined>; export declare const RoleModel: import("mongoose").Model; diff --git a/dist/models/Role.js b/dist/models/Role.js index ed681849..86c06db9 100644 --- a/dist/models/Role.js +++ b/dist/models/Role.js @@ -7,8 +7,8 @@ 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, + id: String, + guild_id: String, color: Number, hoist: Boolean, managed: Boolean, @@ -17,7 +17,7 @@ exports.RoleSchema = new mongoose_1.Schema({ permissions: mongoose_1.Types.Long, position: Number, tags: { - bot_id: mongoose_1.Types.Long, + bot_id: String, }, }); // @ts-ignore diff --git a/dist/models/Role.js.map b/dist/models/Role.js.map index b3ed1758..87872154 100644 --- a/dist/models/Role.js.map +++ b/dist/models/Role.js.map @@ -1 +1 @@ -{"version":3,"file":"Role.js","sourceRoot":"","sources":["../../src/models/Role.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAqBrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,gBAAK,CAAC,IAAI;IACd,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,gBAAK,CAAC,IAAI;IACvB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE;QACL,MAAM,EAAE,gBAAK,CAAC,IAAI;KAClB;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"Role.js","sourceRoot":"","sources":["../../src/models/Role.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAqBrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,gBAAK,CAAC,IAAI;IACvB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE;QACL,MAAM,EAAE,MAAM;KACd;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/User.d.ts b/dist/models/User.d.ts index 109dd177..ae101061 100644 --- a/dist/models/User.d.ts +++ b/dist/models/User.d.ts @@ -3,7 +3,7 @@ import { Activity } from "./Activity"; import { ClientStatus, Status } from "./Status"; import { Schema, Document } from "mongoose"; export interface User { - id: bigint; + id: string; username: string; discriminator: string; avatar: string | null; @@ -23,7 +23,7 @@ export interface User { flags: bigint; public_flags: bigint; user_settings: UserSettings; - guilds: bigint[]; + guilds: string[]; user_data: UserData; presence: { status: Status; @@ -39,10 +39,10 @@ export interface UserData { fingerprints: string[]; } export interface UserDocument extends User, Document { - id: bigint; + id: string; } export interface PublicUser { - id: bigint; + id: string; discriminator: string; username: string; avatar?: string; @@ -60,10 +60,10 @@ export interface ConnectedAccount { visibility: number; } export interface Relationship { - id: bigint; + id: string; nickname?: string; type: number; - user_id: bigint; + user_id: string; } export interface UserSettings { afk_timeout: number; @@ -73,7 +73,7 @@ export interface UserSettings { contact_sync_enabled: boolean; convert_emoticons: boolean; custom_status: { - emoji_id: bigint | null; + emoji_id: string | null; emoji_name: string | null; expires_at: number | null; text: string | null; @@ -91,11 +91,11 @@ export interface UserSettings { gif_auto_play: boolean; guild_folders: { color: number; - guild_ids: bigint[]; + guild_ids: string[]; id: number; name: string; }[]; - guild_positions: bigint[]; + guild_positions: string[]; inline_attachment_media: boolean; inline_embed_media: boolean; locale: string; @@ -103,7 +103,7 @@ export interface UserSettings { native_phone_integration_enabled: boolean; render_embeds: boolean; render_reactions: boolean; - restricted_guilds: bigint[]; + restricted_guilds: string[]; show_current_game: boolean; status: "online" | "offline" | "dnd" | "idle"; stream_notifications_enabled: boolean; diff --git a/dist/models/User.js b/dist/models/User.js index 7c98f27e..3ba04503 100644 --- a/dist/models/User.js +++ b/dist/models/User.js @@ -9,7 +9,7 @@ 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, + id: String, username: String, discriminator: String, avatar: String, @@ -28,17 +28,17 @@ exports.UserSchema = new mongoose_1.Schema({ email: String, flags: mongoose_1.Types.Long, public_flags: mongoose_1.Types.Long, - guilds: [mongoose_1.Types.Long], + guilds: [String], user_data: { fingerprints: [String], hash: String, valid_tokens_since: Date, relationships: [ { - id: mongoose_1.Types.Long, + id: String, nickname: String, type: Number, - user_id: mongoose_1.Types.Long, + user_id: String, }, ], connected_accounts: [ @@ -63,7 +63,7 @@ exports.UserSchema = new mongoose_1.Schema({ contact_sync_enabled: Boolean, convert_emoticons: Boolean, custom_status: { - emoji_id: mongoose_1.Types.Long, + emoji_id: String, emoji_name: String, expires_at: Number, text: String, @@ -81,12 +81,12 @@ exports.UserSchema = new mongoose_1.Schema({ guild_folders: [ { color: Number, - guild_ids: [mongoose_1.Types.Long], + guild_ids: [String], id: Number, name: String, }, ], - guild_positions: [mongoose_1.Types.Long], + guild_positions: [String], inline_attachment_media: Boolean, inline_embed_media: Boolean, locale: String, @@ -94,7 +94,7 @@ exports.UserSchema = new mongoose_1.Schema({ native_phone_integration_enabled: Boolean, render_embeds: Boolean, render_reactions: Boolean, - restricted_guilds: [mongoose_1.Types.Long], + restricted_guilds: [String], show_current_game: Boolean, status: String, stream_notifications_enabled: Boolean, diff --git a/dist/models/User.js.map b/dist/models/User.js.map index 03a92cb6..d57da8db 100644 --- a/dist/models/User.js.map +++ b/dist/models/User.js.map @@ -1 +1 @@ -{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AACtC,qCAAgD;AAChD,uCAAmD;AACnD,gEAAkC;AAqHrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EA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,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/VoiceState.d.ts b/dist/models/VoiceState.d.ts index 50faa253..cf0fa523 100644 --- a/dist/models/VoiceState.d.ts +++ b/dist/models/VoiceState.d.ts @@ -1,9 +1,9 @@ /// import { Schema, Document } from "mongoose"; export interface VoiceState extends Document { - guild_id?: bigint; - channel_id: bigint; - user_id: bigint; + guild_id?: string; + channel_id: string; + user_id: string; session_id: string; deaf: boolean; mute: boolean; diff --git a/dist/models/VoiceState.js b/dist/models/VoiceState.js index c646879c..d96a5ad4 100644 --- a/dist/models/VoiceState.js +++ b/dist/models/VoiceState.js @@ -7,9 +7,9 @@ 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, + guild_id: String, + channel_id: String, + user_id: String, session_id: String, deaf: Boolean, mute: Boolean, diff --git a/dist/models/VoiceState.js.map b/dist/models/VoiceState.js.map index 1e21605d..1e7905d8 100644 --- a/dist/models/VoiceState.js.map +++ b/dist/models/VoiceState.js.map @@ -1 +1 @@ -{"version":3,"file":"VoiceState.js","sourceRoot":"","sources":["../../src/models/VoiceState.ts"],"names":[],"mappings":";;;;;;AACA,uCAA0D;AAC1D,gEAAkC;AAgBrB,QAAA,eAAe,GAAG,IAAI,iBAAM,CAAC;IACzC,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,UAAU,EAAE,gBAAK,CAAC,IAAI;IACtB,OAAO,EAAE,gBAAK,CAAC,IAAI;IACnB,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,OAAO;IAClB,SAAS,EAAE,OAAO;IAClB,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE,OAAO;IACnB,QAAQ,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,eAAe,GAAG,kBAAE,CAAC,KAAK,CAAa,YAAY,EAAE,uBAAe,EAAE,aAAa,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"VoiceState.js","sourceRoot":"","sources":["../../src/models/VoiceState.ts"],"names":[],"mappings":";;;;;;AACA,uCAA0D;AAC1D,gEAAkC;AAgBrB,QAAA,eAAe,GAAG,IAAI,iBAAM,CAAC;IACzC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,OAAO;IAClB,SAAS,EAAE,OAAO;IAClB,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE,OAAO;IACnB,QAAQ,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,eAAe,GAAG,kBAAE,CAAC,KAAK,CAAa,YAAY,EAAE,uBAAe,EAAE,aAAa,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/util/Permissions.d.ts b/dist/util/Permissions.d.ts index 1cedf036..19135666 100644 --- a/dist/util/Permissions.d.ts +++ b/dist/util/Permissions.d.ts @@ -48,8 +48,8 @@ export declare class Permissions extends BitField { static rolePermission(roles: Role[]): bigint; static finalPermission({ user, guild, channel, }: { user: { - id: bigint; - roles: bigint[]; + id: string; + roles: string[]; }; guild: { roles: Role[]; @@ -59,7 +59,7 @@ export declare class Permissions extends BitField { }; }): bigint; } -export declare function getPermission(user_id: bigint, guild_id: bigint, channel_id?: bigint, cache?: { +export declare function getPermission(user_id: string, guild_id: string, channel_id?: string, cache?: { channel?: ChannelDocument | null; member?: MemberDocument | null; }): Promise; diff --git a/src/models/Activity.ts b/src/models/Activity.ts index bf77856f..340590c4 100644 --- a/src/models/Activity.ts +++ b/src/models/Activity.ts @@ -4,7 +4,7 @@ import { Schema, model, Types, Document } from "mongoose"; export interface Presence { user: User; - guild_id?: bigint; + guild_id?: string; status: Status; activities: Activity[]; client_status: ClientStatus; @@ -19,12 +19,12 @@ export interface Activity { start?: number; end?: number; }[]; - application_id?: bigint; + application_id?: string; details?: string; state?: string; emoji?: { name: string; - id?: bigint; + id?: string; amimated?: boolean; }; party?: { @@ -57,12 +57,12 @@ export const Activity = { $end: Number, }, ], - $application_id: Types.Long, + $application_id: String, $details: String, $state: String, $emoji: { $name: String, - $id: Types.Long, + $id: String, $amimated: Boolean, }, $party: { diff --git a/src/models/Application.ts b/src/models/Application.ts index ea443dc9..4c519ff2 100644 --- a/src/models/Application.ts +++ b/src/models/Application.ts @@ -1,6 +1,6 @@ export interface ApplicationCommand { - id: bigint; - application_id: bigint; + id: string; + application_id: string; name: string; description: string; options?: ApplicationCommandOption[]; @@ -32,7 +32,7 @@ export enum ApplicationCommandOptionType { } export interface ApplicationCommandInteractionData { - id: bigint; + id: string; name: string; options?: ApplicationCommandInteractionDataOption[]; } diff --git a/src/models/AuditLog.ts b/src/models/AuditLog.ts index a0f91a82..c1f83c13 100644 --- a/src/models/AuditLog.ts +++ b/src/models/AuditLog.ts @@ -11,17 +11,17 @@ export interface AuditLogResponse { } export interface AuditLogEntries { - target_id?: bigint; - user_id: bigint; - id: bigint; + target_id?: string; + user_id: string; + id: string; action_type: AuditLogEvents; options?: { delete_member_days?: string; members_removed?: string; - channel_id?: bigint; - messaged_id?: bigint; + channel_id?: string; + messaged_id?: string; count?: string; - id?: bigint; + id?: string; type?: string; role_name?: string; }; @@ -42,13 +42,13 @@ export interface AuditLogChangeValue { splash_hash?: string; discovery_splash_hash?: string; banner_hash?: string; - owner_id?: bigint; + owner_id?: string; region?: string; preferred_locale?: string; - afk_channel_id?: bigint; + afk_channel_id?: string; afk_timeout?: number; - rules_channel_id?: bigint; - public_updates_channel_id?: bigint; + rules_channel_id?: string; + public_updates_channel_id?: string; mfa_level?: number; verification_level?: number; explicit_content_filter?: number; @@ -58,14 +58,14 @@ export interface AuditLogChangeValue { $remove?: {}[]; prune_delete_days?: number; widget_enabled?: boolean; - widget_channel_id?: bigint; - system_channel_id?: bigint; + widget_channel_id?: string; + system_channel_id?: string; position?: number; topic?: string; bitrate?: number; permission_overwrites?: ChannelPermissionOverwrite[]; nsfw?: boolean; - application_id?: bigint; + application_id?: string; rate_limit_per_user?: number; permissions?: string; color?: number; @@ -74,8 +74,8 @@ export interface AuditLogChangeValue { allow?: string; deny?: string; code?: string; - channel_id?: bigint; - inviter_id?: bigint; + channel_id?: string; + inviter_id?: string; max_uses?: number; uses?: number; max_age?: number; @@ -84,7 +84,7 @@ export interface AuditLogChangeValue { mute?: boolean; nick?: string; avatar_hash?: string; - id?: bigint; + id?: string; type?: number; enable_emoticons?: boolean; expire_behavior?: number; @@ -93,7 +93,7 @@ export interface AuditLogChangeValue { } export interface AuditLogEntriesDocument extends Document, AuditLogEntries { - id: bigint; + id: string; } export const AuditLogChanges = { @@ -103,13 +103,13 @@ export const AuditLogChanges = { splash_hash: String, discovery_splash_hash: String, banner_hash: String, - owner_id: Types.Long, + owner_id: String, region: String, preferred_locale: String, - afk_channel_id: Types.Long, + afk_channel_id: String, afk_timeout: Number, - rules_channel_id: Types.Long, - public_updates_channel_id: Types.Long, + rules_channel_id: String, + public_updates_channel_id: String, mfa_level: Number, verification_level: Number, explicit_content_filter: Number, @@ -119,14 +119,14 @@ export const AuditLogChanges = { $remove: [{}], prune_delete_days: Number, widget_enabled: Boolean, - widget_channel_id: Types.Long, - system_channel_id: Types.Long, + widget_channel_id: String, + system_channel_id: String, position: Number, topic: String, bitrate: Number, permission_overwrites: [{}], nsfw: Boolean, - application_id: Types.Long, + application_id: String, rate_limit_per_user: Number, permissions: String, color: Number, @@ -135,8 +135,8 @@ export const AuditLogChanges = { allow: String, deny: String, code: String, - channel_id: Types.Long, - inviter_id: Types.Long, + channel_id: String, + inviter_id: String, max_uses: Number, uses: Number, max_age: Number, @@ -145,7 +145,7 @@ export const AuditLogChanges = { mute: Boolean, nick: String, avatar_hash: String, - id: Types.Long, + id: String, type: Number, enable_emoticons: Boolean, expire_behavior: Number, @@ -154,17 +154,17 @@ export const AuditLogChanges = { }; export const AuditLogSchema = new Schema({ - target_id: Types.Long, - user_id: { type: Types.Long, required: true }, - id: { type: Types.Long, required: true }, + target_id: String, + user_id: { type: String, required: true }, + id: { type: String, required: true }, action_type: { type: Number, required: true }, options: { delete_member_days: String, members_removed: String, - channel_id: Types.Long, - messaged_id: Types.Long, + channel_id: String, + messaged_id: String, count: String, - id: Types.Long, + id: String, type: String, role_name: String, }, diff --git a/src/models/Ban.ts b/src/models/Ban.ts index 8fc3b124..27893029 100644 --- a/src/models/Ban.ts +++ b/src/models/Ban.ts @@ -2,17 +2,17 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; export interface Ban extends Document { - user_id: bigint; - guild_id: bigint; - executor_id: bigint; + user_id: string; + guild_id: string; + executor_id: string; ip: string; reason?: string; } export const BanSchema = new Schema({ - user_id: { type: Types.Long, required: true }, - guild_id: { type: Types.Long, required: true }, - executor_id: { type: Types.Long, required: true }, + user_id: { type: String, required: true }, + guild_id: { type: String, required: true }, + executor_id: { type: String, required: true }, reason: String, ip: String, // ? Should we store this in here, or in the UserModel? }); diff --git a/src/models/Channel.ts b/src/models/Channel.ts index bf03c939..82ad2999 100644 --- a/src/models/Channel.ts +++ b/src/models/Channel.ts @@ -4,20 +4,20 @@ import db from "../util/Database"; export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel {} export interface ChannelDocument extends Document, AnyChannel { - id: bigint; + id: string; } export const ChannelSchema = new Schema({ - id: Types.Long, + id: String, created_at: { type: Schema.Types.Date, required: true }, name: { type: String, required: true }, type: { type: Number, required: true }, - guild_id: Types.Long, - owner_id: Types.Long, - parent_id: Types.Long, - recipients: [Types.Long], + guild_id: String, + owner_id: String, + parent_id: String, + recipients: [String], position: Number, - last_message_id: Types.Long, + last_message_id: String, last_pin_timestamp: Date, nsfw: Boolean, rate_limit_per_user: Number, @@ -26,7 +26,7 @@ export const ChannelSchema = new Schema({ { allow: Types.Long, deny: Types.Long, - id: Types.Long, + id: String, type: Number, }, ], @@ -36,28 +36,28 @@ export const ChannelSchema = new Schema({ export const ChannelModel = db.model("Channel", ChannelSchema, "channels"); export interface Channel { - id: bigint; + id: string; created_at: Date; name: string; type: number; } export interface TextBasedChannel { - last_message_id?: bigint; + last_message_id?: string; last_pin_timestamp?: number; } export interface GuildChannel extends Channel { - guild_id: bigint; + guild_id: string; position: number; - parent_id?: bigint; + parent_id?: string; permission_overwrites: ChannelPermissionOverwrite[]; } export interface ChannelPermissionOverwrite { - allow: bigint; - deny: bigint; - id: bigint; + allow: bigint; // for bitfields we use bigints + deny: bigint; // for bitfields we use bigints + id: string; type: ChannelPermissionOverwriteType; } @@ -75,8 +75,8 @@ export interface TextChannel extends GuildChannel, TextBasedChannel { } export interface DMChannel extends Channel, TextBasedChannel { - owner_id: bigint; - recipients: bigint[]; + owner_id: string; + recipients: string[]; } export enum ChannelType { diff --git a/src/models/Emoji.ts b/src/models/Emoji.ts index 530c2cc7..3e5cad53 100644 --- a/src/models/Emoji.ts +++ b/src/models/Emoji.ts @@ -2,27 +2,27 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; export interface Emoji extends Document { - id: bigint; + id: string; animated: boolean; available: boolean; - guild_id: bigint; + guild_id: string; managed: boolean; name: string; require_colons: boolean; url: string; - roles: bigint[]; // roles this emoji is whitelisted to + roles: string[]; // roles this emoji is whitelisted to (new discord feature?) } export const EmojiSchema = new Schema({ - id: { type: Types.Long, required: true }, + id: { type: String, required: true }, animated: Boolean, available: Boolean, - guild_id: Types.Long, + guild_id: String, managed: Boolean, name: String, require_colons: Boolean, url: String, - roles: [Types.Long], + roles: [String], }); // @ts-ignore diff --git a/src/models/Event.ts b/src/models/Event.ts index 97da98c0..9a5b5283 100644 --- a/src/models/Event.ts +++ b/src/models/Event.ts @@ -14,9 +14,9 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; export interface Event { - guild_id?: bigint; - user_id?: bigint; - channel_id?: bigint; + guild_id?: string; + user_id?: string; + channel_id?: string; created_at?: Date; event: EVENT; data?: any; @@ -25,9 +25,9 @@ export interface Event { export interface EventDocument extends Event, Document {} export const EventSchema = new Schema({ - guild_id: Types.Long, - user_id: Types.Long, - channel_id: Types.Long, + guild_id: String, + user_id: String, + channel_id: String, created_at: { type: Date, required: true }, event: { type: String, required: true }, data: Object, @@ -98,7 +98,7 @@ export interface ReadyEventData { partial: boolean; }; application?: { - id: bigint; + id: string; flags: bigint; }; merged_members?: Omit[][]; @@ -106,7 +106,7 @@ export interface ReadyEventData { users?: { avatar?: string; discriminator: string; - id: bigint; + id: string; username: string; bot: boolean; public_flags: bigint; @@ -136,8 +136,8 @@ export interface ChannelDeleteEvent extends Event { export interface ChannelPinsUpdateEvent extends Event { event: "CHANNEL_PINS_UPDATE"; data: { - guild_id?: bigint; - channel_id: bigint; + guild_id?: string; + channel_id: string; last_pin_timestamp: number; }; } @@ -155,7 +155,7 @@ export interface GuildUpdateEvent extends Event { export interface GuildDeleteEvent extends Event { event: "GUILD_DELETE"; data: { - id: bigint; + id: string; unavailable?: boolean; }; } @@ -163,7 +163,7 @@ export interface GuildDeleteEvent extends Event { export interface GuildBanAddEvent extends Event { event: "GUILD_BAN_ADD"; data: { - guild_id: bigint; + guild_id: string; user: User; }; } @@ -171,7 +171,7 @@ export interface GuildBanAddEvent extends Event { export interface GuildBanRemoveEvent extends Event { event: "GUILD_BAN_REMOVE"; data: { - guild_id: bigint; + guild_id: string; user: User; }; } @@ -179,7 +179,7 @@ export interface GuildBanRemoveEvent extends Event { export interface GuildEmojiUpdateEvent extends Event { event: "GUILD_EMOJI_UPDATE"; data: { - guild_id: bigint; + guild_id: string; emojis: Emoji[]; }; } @@ -187,21 +187,21 @@ export interface GuildEmojiUpdateEvent extends Event { export interface GuildIntegrationUpdateEvent extends Event { event: "GUILD_INTEGRATIONS_UPDATE"; data: { - guild_id: bigint; + guild_id: string; }; } export interface GuildMemberAddEvent extends Event { event: "GUILD_MEMBER_ADD"; data: PublicMember & { - guild_id: bigint; + guild_id: string; }; } export interface GuildMemberRemoveEvent extends Event { event: "GUILD_MEMBER_REMOVE"; data: { - guild_id: bigint; + guild_id: string; user: User; }; } @@ -209,8 +209,8 @@ export interface GuildMemberRemoveEvent extends Event { export interface GuildMemberUpdateEvent extends Event { event: "GUILD_MEMBER_UPDATE"; data: { - guild_id: bigint; - roles: bigint[]; + guild_id: string; + roles: string[]; user: User; nick?: string; joined_at: Date; @@ -222,11 +222,11 @@ export interface GuildMemberUpdateEvent extends Event { export interface GuildMembersChunkEvent extends Event { event: "GUILD_MEMBERS_CHUNK"; data: { - guild_id: bigint; + guild_id: string; members: PublicMember[]; chunk_index: number; chunk_count: number; - not_found: bigint[]; + not_found: string[]; presences: Presence[]; nonce?: string; }; @@ -235,7 +235,7 @@ export interface GuildMembersChunkEvent extends Event { export interface GuildRoleCreateEvent extends Event { event: "GUILD_ROLE_CREATE"; data: { - guild_id: bigint; + guild_id: string; role: Role; }; } @@ -243,7 +243,7 @@ export interface GuildRoleCreateEvent extends Event { export interface GuildRoleUpdateEvent extends Event { event: "GUILD_ROLE_UPDATE"; data: { - guild_id: bigint; + guild_id: string; role: Role; }; } @@ -251,31 +251,31 @@ export interface GuildRoleUpdateEvent extends Event { export interface GuildRoleDeleteEvent extends Event { event: "GUILD_ROLE_DELETE"; data: { - guild_id: bigint; - role_id: bigint; + guild_id: string; + role_id: string; }; } export interface InviteCreateEvent extends Event { event: "INVITE_CREATE"; data: Omit & { - channel_id: bigint; - guild_id?: bigint; + channel_id: string; + guild_id?: string; }; } export interface InviteDeleteEvent extends Event { event: "INVITE_DELETE"; data: { - channel_id: bigint; - guild_id?: bigint; + channel_id: string; + guild_id?: string; code: string; }; } export type MessagePayload = Omit & { - channel_id: bigint; - guild_id?: bigint; + channel_id: string; + guild_id?: string; author: User; member: PublicMember; mentions: (User & { member: PublicMember })[]; @@ -294,28 +294,28 @@ export interface MessageUpdateEvent extends Event { export interface MessageDeleteEvent extends Event { event: "MESSAGE_DELETE"; data: { - id: bigint; - channel_id: bigint; - guild_id?: bigint; + id: string; + channel_id: string; + guild_id?: string; }; } export interface MessageDeleteBulkEvent extends Event { event: "MESSAGE_DELETE_BULK"; data: { - ids: bigint[]; - channel_id: bigint; - guild_id?: bigint; + ids: string[]; + channel_id: string; + guild_id?: string; }; } export interface MessageReactionAddEvent extends Event { event: "MESSAGE_REACTION_ADD"; data: { - user_id: bigint; - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + user_id: string; + channel_id: string; + message_id: string; + guild_id?: string; member?: PublicMember; emoji: PartialEmoji; }; @@ -324,10 +324,10 @@ export interface MessageReactionAddEvent extends Event { export interface MessageReactionRemoveEvent extends Event { event: "MESSAGE_REACTION_REMOVE"; data: { - user_id: bigint; - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + user_id: string; + channel_id: string; + message_id: string; + guild_id?: string; emoji: PartialEmoji; }; } @@ -335,18 +335,18 @@ export interface MessageReactionRemoveEvent extends Event { export interface MessageReactionRemoveAllEvent extends Event { event: "MESSAGE_REACTION_REMOVE_ALL"; data: { - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + channel_id: string; + message_id: string; + guild_id?: string; }; } export interface MessageReactionRemoveEmojiEvent extends Event { event: "MESSAGE_REACTION_REMOVE_EMOJI"; data: { - channel_id: bigint; - message_id: bigint; - guild_id?: bigint; + channel_id: string; + message_id: string; + guild_id?: string; emoji: PartialEmoji; }; } @@ -359,10 +359,10 @@ export interface PresenceUpdateEvent extends Event { export interface TypingStartEvent extends Event { event: "TYPING_START"; data: { - channel_id: bigint; - user_id: bigint; + channel_id: string; + user_id: string; timestamp: number; - guild_id?: bigint; + guild_id?: string; member?: PublicMember; }; } @@ -383,7 +383,7 @@ export interface VoiceServerUpdateEvent extends Event { event: "VOICE_SERVER_UPDATE"; data: { token: string; - guild_id: bigint; + guild_id: string; endpoint: string; }; } @@ -391,13 +391,13 @@ export interface VoiceServerUpdateEvent extends Event { export interface WebhooksUpdateEvent extends Event { event: "WEBHOOKS_UPDATE"; data: { - guild_id: bigint; - channel_id: bigint; + guild_id: string; + channel_id: string; }; } export type ApplicationCommandPayload = ApplicationCommand & { - guild_id: bigint; + guild_id: string; }; export interface ApplicationCommandCreateEvent extends Event { diff --git a/src/models/Guild.ts b/src/models/Guild.ts index a92a60cf..d3f098ea 100644 --- a/src/models/Guild.ts +++ b/src/models/Guild.ts @@ -6,14 +6,14 @@ import { MemberModel } from "./Member"; import { RoleModel } from "./Role"; export interface GuildDocument extends Document, Guild { - id: bigint; + id: string; } export interface Guild { - id: bigint; - afk_channel_id?: bigint; + id: string; + afk_channel_id?: string; afk_timeout?: number; - application_id?: bigint; + application_id?: string; banner?: string; default_message_notifications?: number; description?: string; @@ -34,29 +34,29 @@ export interface Guild { // voice_states: []; // * voice_states are stored in a seperate collection mfa_level?: number; name: string; - owner_id: bigint; + owner_id: string; preferred_locale?: string; // only community guilds can choose this premium_subscription_count?: number; premium_tier?: number; // nitro boost level - public_updates_channel_id?: bigint; + public_updates_channel_id?: string; region?: string; - rules_channel_id?: bigint; + rules_channel_id?: string; splash?: string; system_channel_flags?: number; - system_channel_id?: bigint; + system_channel_id?: string; unavailable?: boolean; vanity_url_code?: string; verification_level?: number; welcome_screen: []; // welcome splash screen if a user joins guild - widget_channel_id?: bigint; + widget_channel_id?: string; widget_enabled?: boolean; } export const GuildSchema = new Schema({ - id: { type: Types.Long, required: true }, - afk_channel_id: Types.Long, + id: { type: String, required: true }, + afk_channel_id: String, afk_timeout: Number, - application_id: Types.Long, + application_id: String, banner: String, default_message_notifications: Number, description: String, @@ -72,22 +72,22 @@ export const GuildSchema = new Schema({ presence_count: Number, mfa_level: Number, name: { type: String, required: true }, - owner_id: { type: Types.Long, required: true }, + owner_id: { type: String, required: true }, preferred_locale: String, premium_subscription_count: Number, premium_tier: Number, - public_updates_channel_id: Types.Long, + public_updates_channel_id: String, region: String, - rules_channel_id: Types.Long, + rules_channel_id: String, splash: String, system_channel_flags: Number, - system_channel_id: Types.Long, + system_channel_id: String, unavailable: Boolean, vanity_url_code: String, verification_level: Number, voice_states: { type: [Object], default: [] }, welcome_screen: { type: [Object], default: [] }, - widget_channel_id: Types.Long, + widget_channel_id: String, widget_enabled: Boolean, }); diff --git a/src/models/Interaction.ts b/src/models/Interaction.ts index 6f36c14a..764247a5 100644 --- a/src/models/Interaction.ts +++ b/src/models/Interaction.ts @@ -1,12 +1,12 @@ import { AllowedMentions, Embed } from "./Message"; export interface Interaction { - id: bigint; + id: string; type: InteractionType; data?: {}; - guild_id: bigint; - channel_id: bigint; - member_id: bigint; + guild_id: string; + channel_id: string; + member_id: string; token: string; version: number; } diff --git a/src/models/Invite.ts b/src/models/Invite.ts index fc60b93c..590a4598 100644 --- a/src/models/Invite.ts +++ b/src/models/Invite.ts @@ -8,14 +8,13 @@ export interface Invite extends Document { max_uses: number; max_age: number; created_at: Date; - guild_id: bigint; - channel_id: bigint; - inviter_id: bigint; + guild_id: string; + channel_id: string; + inviter_id: string; - //! What the fucking shit is this - target_user_id?: bigint; + // ? What the fucking shit is this + target_user_id?: string; target_user_type?: number; - // ! } export const InviteSchema = new Schema({ @@ -25,14 +24,13 @@ export const InviteSchema = new Schema({ max_uses: Number, max_age: Number, created_at: Date, - guild_id: Types.Long, - channel_id: Types.Long, - inviter_id: Types.Long, + guild_id: String, + channel_id: String, + inviter_id: String, - //! What the fucking shit is this - target_user_id: Types.Long, + // ? What the fucking shit is this + target_user_id: String, target_user_type: Number, - // ! }); // @ts-ignore diff --git a/src/models/Member.ts b/src/models/Member.ts index 145b5df4..fc9d5b99 100644 --- a/src/models/Member.ts +++ b/src/models/Member.ts @@ -3,10 +3,10 @@ import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; export interface Member { - id: bigint; - guild_id: bigint; + id: string; + guild_id: string; nick?: string; - roles: bigint[]; + roles: string[]; joined_at: Date; premium_since?: number; deaf: boolean; @@ -17,12 +17,12 @@ export interface Member { } export interface MemberDocument extends Member, Document { - id: bigint; + id: string; } export interface UserGuildSettings { channel_overrides: { - channel_id: bigint; + channel_id: string; message_notifications: number; mute_config: MuteConfig; muted: boolean; @@ -47,10 +47,10 @@ const MuteConfig = { }; export const MemberSchema = new Schema({ - id: { type: Types.Long, required: true }, - guild_id: Types.Long, + id: { type: String, required: true }, + guild_id: String, nick: String, - roles: [Types.Long], + roles: [String], joined_at: Date, premium_since: Number, deaf: Boolean, @@ -59,7 +59,7 @@ export const MemberSchema = new Schema({ settings: { channel_overrides: [ { - channel_id: Types.Long, + channel_id: String, message_notifications: Number, mute_config: MuteConfig, muted: Boolean, diff --git a/src/models/Message.ts b/src/models/Message.ts index e80ec1f8..4adf8024 100644 --- a/src/models/Message.ts +++ b/src/models/Message.ts @@ -5,20 +5,20 @@ import { MemberModel } from "./Member"; import { RoleModel } from "./Role"; export interface Message { - id: bigint; - channel_id: bigint; - guild_id?: bigint; - author_id?: bigint; - webhook_id?: bigint; - application_id?: bigint; + id: string; + channel_id: string; + guild_id?: string; + author_id?: string; + webhook_id?: string; + application_id?: string; content?: string; timestamp: Date; edited_timestamp?: Date; tts?: boolean; mention_everyone?: boolean; - mention_user_ids: bigint[]; - mention_role_ids: bigint[]; - mention_channels_ids: bigint[]; + mention_user_ids: string[]; + mention_role_ids: string[]; + mention_channels_ids: string[]; attachments: Attachment[]; embeds: Embed[]; reactions: Reaction[]; @@ -32,14 +32,14 @@ export interface Message { flags?: bigint; stickers?: []; message_reference?: { - message_id: bigint; - channel_id?: bigint; - guild_id?: bigint; + message_id: string; + channel_id?: string; + guild_id?: string; }; } export interface MessageDocument extends Document, Message { - id: bigint; + id: string; } export enum MessageType { @@ -63,7 +63,7 @@ export enum MessageType { } export interface Attachment { - id: bigint; // attachment id + id: string; // attachment id filename: string; // name of file attached size: number; // size of file in bytes url: string; // source url of file @@ -118,20 +118,20 @@ export interface Reaction { } export interface PartialEmoji { - id?: bigint; + id?: string; name: string; animated?: boolean; } export interface AllowedMentions { parse?: ("users" | "roles" | "everyone")[]; - roles?: bigint[]; - users?: bigint[]; + roles?: string[]; + users?: string[]; replied_user?: boolean; } export const Attachment = { - id: Types.Long, // attachment id + id: String, // attachment id filename: String, // name of file attached size: Number, // size of file in bytes url: String, // source url of file @@ -150,7 +150,7 @@ export const EmbedImage = { const Reaction = { count: Number, emoji: { - id: Types.Long, + id: String, name: String, animated: Boolean, }, @@ -191,20 +191,20 @@ export const Embed = { }; export const MessageSchema = new Schema({ - id: Types.Long, - channel_id: Types.Long, - author_id: Types.Long, - webhook_id: Types.Long, - guild_id: Types.Long, - application_id: Types.Long, + id: String, + channel_id: String, + author_id: String, + webhook_id: String, + guild_id: String, + application_id: String, content: String, timestamp: Date, edited_timestamp: Date, tts: Boolean, mention_everyone: Boolean, - mention_user_ids: [Types.Long], - mention_role_ids: [Types.Long], - mention_channel_ids: [Types.Long], + mention_user_ids: [String], + mention_role_ids: [String], + mention_channel_ids: [String], attachments: [Attachment], embeds: [Embed], reactions: [Reaction], @@ -218,9 +218,9 @@ export const MessageSchema = new Schema({ flags: Types.Long, stickers: [], message_reference: { - message_id: Types.Long, - channel_id: Types.Long, - guild_id: Types.Long, + message_id: String, + channel_id: String, + guild_id: String, }, }); diff --git a/src/models/Role.ts b/src/models/Role.ts index fe716593..adb75b0a 100644 --- a/src/models/Role.ts +++ b/src/models/Role.ts @@ -2,8 +2,8 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; export interface Role { - id: bigint; - guild_id: bigint; + id: string; + guild_id: string; color: number; hoist: boolean; managed: boolean; @@ -12,17 +12,17 @@ export interface Role { permissions: bigint; position: number; tags?: { - bot_id?: bigint; + bot_id?: string; }; } export interface RoleDocument extends Document, Role { - id: bigint; + id: string; } export const RoleSchema = new Schema({ - id: Types.Long, - guild_id: Types.Long, + id: String, + guild_id: String, color: Number, hoist: Boolean, managed: Boolean, @@ -31,7 +31,7 @@ export const RoleSchema = new Schema({ permissions: Types.Long, position: Number, tags: { - bot_id: Types.Long, + bot_id: String, }, }); diff --git a/src/models/User.ts b/src/models/User.ts index 9f447d91..7173e9a3 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -4,7 +4,7 @@ import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; export interface User { - id: bigint; + id: string; username: string; // username max length 32, min 2 discriminator: string; // #0001 4 digit long string from #0001 - #9999 avatar: string | null; // hash of the user avatar @@ -24,7 +24,7 @@ export interface User { flags: bigint; // UserFlags public_flags: bigint; user_settings: UserSettings; - guilds: bigint[]; // array of guild ids the user is part of + guilds: string[]; // array of guild ids the user is part of user_data: UserData; presence: { status: Status; @@ -43,11 +43,11 @@ export interface UserData { } export interface UserDocument extends User, Document { - id: bigint; + id: string; } export interface PublicUser { - id: bigint; + id: string; discriminator: string; username: string; avatar?: string; @@ -67,10 +67,10 @@ export interface ConnectedAccount { } export interface Relationship { - id: bigint; + id: string; nickname?: string; type: number; - user_id: bigint; + user_id: string; } export interface UserSettings { @@ -81,7 +81,7 @@ export interface UserSettings { contact_sync_enabled: boolean; convert_emoticons: boolean; custom_status: { - emoji_id: bigint | null; + emoji_id: string | null; emoji_name: string | null; expires_at: number | null; text: string | null; @@ -98,11 +98,11 @@ export interface UserSettings { guild_folders: // every top guild is displayed as a "folder" { color: number; - guild_ids: bigint[]; + guild_ids: string[]; id: number; name: string; }[]; - guild_positions: bigint[]; // guild ids ordered by position + guild_positions: string[]; // guild ids ordered by position inline_attachment_media: boolean; inline_embed_media: boolean; locale: string; // en_US @@ -110,7 +110,7 @@ export interface UserSettings { native_phone_integration_enabled: boolean; render_embeds: boolean; render_reactions: boolean; - restricted_guilds: bigint[]; + restricted_guilds: string[]; show_current_game: boolean; status: "online" | "offline" | "dnd" | "idle"; stream_notifications_enabled: boolean; @@ -119,7 +119,7 @@ export interface UserSettings { } export const UserSchema = new Schema({ - id: Types.Long, + id: String, username: String, discriminator: String, avatar: String, @@ -138,17 +138,17 @@ export const UserSchema = new Schema({ email: String, flags: Types.Long, // TODO: automatically convert Types.Long to BitField of UserFlags public_flags: Types.Long, - guilds: [Types.Long], // array of guild ids the user is part of + guilds: [String], // array of guild ids the user is part of user_data: { fingerprints: [String], hash: String, // hash of the password, salt is saved in password (bcrypt) valid_tokens_since: Date, // all tokens with a previous issue date are invalid relationships: [ { - id: Types.Long, + id: String, nickname: String, type: Number, - user_id: Types.Long, + user_id: String, }, ], connected_accounts: [ @@ -173,7 +173,7 @@ export const UserSchema = new Schema({ contact_sync_enabled: Boolean, convert_emoticons: Boolean, custom_status: { - emoji_id: Types.Long, + emoji_id: String, emoji_name: String, expires_at: Number, text: String, @@ -191,12 +191,12 @@ export const UserSchema = new Schema({ guild_folders: [ { color: Number, - guild_ids: [Types.Long], + guild_ids: [String], id: Number, name: String, }, ], - guild_positions: [Types.Long], // guild ids ordered by position + guild_positions: [String], // guild ids ordered by position inline_attachment_media: Boolean, inline_embed_media: Boolean, locale: String, // en_US @@ -204,7 +204,7 @@ export const UserSchema = new Schema({ native_phone_integration_enabled: Boolean, render_embeds: Boolean, render_reactions: Boolean, - restricted_guilds: [Types.Long], + restricted_guilds: [String], show_current_game: Boolean, status: String, stream_notifications_enabled: Boolean, diff --git a/src/models/VoiceState.ts b/src/models/VoiceState.ts index 30439feb..c1f90edd 100644 --- a/src/models/VoiceState.ts +++ b/src/models/VoiceState.ts @@ -3,9 +3,9 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; export interface VoiceState extends Document { - guild_id?: bigint; - channel_id: bigint; - user_id: bigint; + guild_id?: string; + channel_id: string; + user_id: string; session_id: string; deaf: boolean; mute: boolean; @@ -17,9 +17,9 @@ export interface VoiceState extends Document { } export const VoiceSateSchema = new Schema({ - guild_id: Types.Long, - channel_id: Types.Long, - user_id: Types.Long, + guild_id: String, + channel_id: String, + user_id: String, session_id: String, deaf: Boolean, mute: Boolean, diff --git a/src/util/Permissions.ts b/src/util/Permissions.ts index 809111bf..4bad70d3 100644 --- a/src/util/Permissions.ts +++ b/src/util/Permissions.ts @@ -121,7 +121,7 @@ export class Permissions extends BitField { guild, channel, }: { - user: { id: bigint; roles: bigint[] }; + user: { id: string; roles: string[] }; guild: { roles: Role[] }; channel?: { overwrites?: ChannelPermissionOverwrite[]; @@ -144,9 +144,9 @@ export class Permissions extends BitField { } export async function getPermission( - user_id: bigint, - guild_id: bigint, - channel_id?: bigint, + user_id: string, + guild_id: string, + channel_id?: string, cache?: { channel?: ChannelDocument | null; member?: MemberDocument | null } ) { var { channel, member } = cache || {}; diff --git a/src/util/Snowflake.ts b/src/util/Snowflake.ts index 9e94bbd9..1ccae43c 100644 --- a/src/util/Snowflake.ts +++ b/src/util/Snowflake.ts @@ -87,7 +87,7 @@ export class Snowflake { var worker = Snowflake.workerId << 17n; var process = Snowflake.processId << 12n; var increment = Snowflake.INCREMENT++; - return time | worker | process | increment; + return (time | worker | process | increment).toString(); } /** -- cgit 1.5.1 From 49f931197c7d7906d53d86525b428c61503f3d41 Mon Sep 17 00:00:00 2001 From: afeuerstein <32029275+afeuerstein@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:33:09 +0200 Subject: resolve deprecation warnings --- src/util/Database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/util') diff --git a/src/util/Database.ts b/src/util/Database.ts index fee3cc31..6e774262 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -6,7 +6,7 @@ const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPre console.log(`[DB] connect: ${uri}`); -const connection = mongoose.createConnection(uri, { autoIndex: true }); +const connection = mongoose.createConnection(uri, { autoIndex: true , useNewUrlParser: true, useUnifiedTopology: true }); export default connection; -- cgit 1.5.1 From 7d9cc0efbf536bcf9bf596360bd8a12652d85b95 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 22:06:53 +0200 Subject: :art: remove _id and __v from response --- dist/index.d.ts | 24 ++-------------- dist/index.js | 24 ++-------------- dist/index.js.map | 2 +- dist/models/Message.js | 8 ++++++ dist/models/Message.js.map | 2 +- dist/models/index.d.ts | 15 ++++++++++ dist/models/index.js | 42 +++++++++++++++++++++++++++ dist/models/index.js.map | 1 + dist/util/index.d.ts | 7 +++++ dist/util/index.js | 20 +++++++++++++ dist/util/index.js.map | 1 + src/index.ts | 25 ++-------------- src/models/Message.ts | 71 ++++++++++++++++++++++++++-------------------- src/models/index.ts | 28 ++++++++++++++++++ src/util/index.ts | 7 +++++ 15 files changed, 178 insertions(+), 99 deletions(-) create mode 100644 dist/models/index.d.ts create mode 100644 dist/models/index.js create mode 100644 dist/models/index.js.map create mode 100644 dist/util/index.d.ts create mode 100644 dist/util/index.js create mode 100644 dist/util/index.js.map create mode 100644 src/models/index.ts create mode 100644 src/util/index.ts (limited to 'src/util') diff --git a/dist/index.d.ts b/dist/index.d.ts index df0761b1..4bf16a66 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,27 +1,7 @@ export * from "./util/checkToken"; export * as Constants from "./util/Constants"; -export * from "./models/Ban"; -export * from "./models/Channel"; -export * from "./models/Emoji"; -export * from "./models/Guild"; -export * from "./models/Invite"; -export * from "./models/Member"; -export * from "./models/Role"; -export * from "./models/User"; -export * from "./models/Activity"; -export * from "./models/Application"; -export * from "./models/Interaction"; -export * from "./models/Message"; -export * from "./models/Status"; -export * from "./models/VoiceState"; -export * from "./util/String"; -export * from "./util/BitField"; -export * from "./util/Intents"; -export * from "./util/MessageFlags"; -export * from "./util/Permissions"; -export * from "./util/Snowflake"; -export * from "./util/UserFlags"; -export * from "./models/Event"; +export * from "./models/index"; +export * from "./util/index"; import Config, { DefaultOptions } from "./util/Config"; import db, { MongooseCache } from "./util/Database"; export { Config, db, DefaultOptions, MongooseCache }; diff --git a/dist/index.js b/dist/index.js index 99f66d3d..29b12d98 100644 --- a/dist/index.js +++ b/dist/index.js @@ -25,28 +25,8 @@ 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); +__exportStar(require("./models/index"), exports); +__exportStar(require("./util/index"), exports); const Config_1 = __importStar(require("./util/Config")); exports.Config = Config_1.default; Object.defineProperty(exports, "DefaultOptions", { enumerable: true, get: function () { return Config_1.DefaultOptions; } }); diff --git a/dist/index.js.map b/dist/index.js.map index 7db4514c..fe75c8ca 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAkC;AAElC,8DAA8C;AAC9C,+CAA6B;AAC7B,mDAAiC;AACjC,iDAA+B;AAC/B,iDAA+B;AAC/B,kDAAgC;AAChC,kDAAgC;AAChC,gDAA8B;AAC9B,gDAA8B;AAC9B,oDAAkC;AAClC,uDAAqC;AACrC,uDAAqC;AACrC,mDAAiC;AACjC,kDAAgC;AAChC,sDAAoC;AAEpC,gDAA8B;AAC9B,kDAAgC;AAChC,iDAA+B;AAC/B,sDAAoC;AACpC,qDAAmC;AACnC,mDAAiC;AACjC,mDAAiC;AACjC,iDAA+B;AAE/B,wDAAuD;AAG9C,iBAHF,gBAAM,CAGE;AAAM,+FAHJ,uBAAc,OAGI;AAFnC,4DAAoD;AAEnC,aAFV,kBAAE,CAEU;AAAkB,8FAFxB,wBAAa,OAEwB"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAkC;AAElC,8DAA8C;AAC9C,iDAA+B;AAC/B,+CAA6B;AAE7B,wDAAuD;AAG9C,iBAHF,gBAAM,CAGE;AAAM,+FAHJ,uBAAc,OAGI;AAFnC,4DAAoD;AAEnC,aAFV,kBAAE,CAEU;AAAkB,8FAFxB,wBAAa,OAEwB"} \ No newline at end of file diff --git a/dist/models/Message.js b/dist/models/Message.js index 18bb509d..dfa22d42 100644 --- a/dist/models/Message.js +++ b/dist/models/Message.js @@ -117,6 +117,14 @@ exports.MessageSchema = new mongoose_1.Schema({ channel_id: String, guild_id: String, }, +}, { + toJSON: { + transform: function (doc, ret) { + delete ret.mention_channel_ids; + delete ret.mention_user_ids; + delete ret.mention_role_ids; + }, + }, }); exports.MessageSchema.virtual("author", { ref: User_1.UserModel, diff --git a/dist/models/Message.js.map b/dist/models/Message.js.map index 2e617b31..bb0f7b83 100644 --- a/dist/models/Message.js.map +++ b/dist/models/Message.js.map @@ -1 +1 @@ -{"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,6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;IACvB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,QAAQ,EAAE;IAC/B,GAAG,EAAE,oBAAW;IAChB,UAAU,EAAE,WAAW;IACvB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,UAAU,EAAE;IACjC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,eAAe,EAAE;IACtC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,kBAAkB,EAAE;IACzC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,qBAAqB;IACjC,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,kCAAkC;AAClC,yCAAyC;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"} \ No newline at end of file +{"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,i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,gBAAgB,CAAC;QAC7B,CAAC;KACD;CACD,CACD,CAAC;AAEF,qBAAa,CAAC,OAAO,CAAC,QAAQ,EAAE;IAC/B,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,WAAW;IACvB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,QAAQ,EAAE;IAC/B,GAAG,EAAE,oBAAW;IAChB,UAAU,EAAE,WAAW;IACvB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,UAAU,EAAE;IACjC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,eAAe,EAAE;IACtC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,qBAAa,CAAC,OAAO,CAAC,kBAAkB,EAAE;IACzC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,qBAAqB;IACjC,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,kCAAkC;AAClC,yCAAyC;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"} \ No newline at end of file diff --git a/dist/models/index.d.ts b/dist/models/index.d.ts new file mode 100644 index 00000000..f82f24de --- /dev/null +++ b/dist/models/index.d.ts @@ -0,0 +1,15 @@ +export * from "./Ban"; +export * from "./Channel"; +export * from "./Emoji"; +export * from "./Guild"; +export * from "./Invite"; +export * from "./Member"; +export * from "./Role"; +export * from "./User"; +export * from "./Activity"; +export * from "./Application"; +export * from "./Interaction"; +export * from "./Message"; +export * from "./Status"; +export * from "./VoiceState"; +export * from "./Event"; diff --git a/dist/models/index.js b/dist/models/index.js new file mode 100644 index 00000000..3c81f38f --- /dev/null +++ b/dist/models/index.js @@ -0,0 +1,42 @@ +"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 __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 __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")); +__exportStar(require("./Ban"), exports); +__exportStar(require("./Channel"), exports); +__exportStar(require("./Emoji"), exports); +__exportStar(require("./Guild"), exports); +__exportStar(require("./Invite"), exports); +__exportStar(require("./Member"), exports); +__exportStar(require("./Role"), exports); +__exportStar(require("./User"), exports); +__exportStar(require("./Activity"), exports); +__exportStar(require("./Application"), exports); +__exportStar(require("./Interaction"), exports); +__exportStar(require("./Message"), exports); +__exportStar(require("./Status"), exports); +__exportStar(require("./VoiceState"), exports); +__exportStar(require("./Event"), exports); +mongoose_1.default.plugin((schema) => { + schema.options.toJSON = { + virtuals: true, + versionKey: false, + transform(doc, ret) { + delete ret._id; + delete ret.__v; + }, + }; +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/models/index.js.map b/dist/models/index.js.map new file mode 100644 index 00000000..db9b8835 --- /dev/null +++ b/dist/models/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAAgC;AAEhC,wCAAsB;AACtB,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,yCAAuB;AACvB,yCAAuB;AACvB,6CAA2B;AAC3B,gDAA8B;AAC9B,gDAA8B;AAC9B,4CAA0B;AAC1B,2CAAyB;AACzB,+CAA6B;AAC7B,0CAAwB;AAExB,kBAAQ,CAAC,MAAM,CAAC,CAAC,MAAW,EAAE,EAAE;IAC/B,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG;QACvB,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,KAAK;QACjB,SAAS,CAAC,GAAQ,EAAE,GAAQ;YAC3B,OAAO,GAAG,CAAC,GAAG,CAAC;YACf,OAAO,GAAG,CAAC,GAAG,CAAC;QAChB,CAAC;KACD,CAAC;AACH,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/util/index.d.ts b/dist/util/index.d.ts new file mode 100644 index 00000000..b0c7fe62 --- /dev/null +++ b/dist/util/index.d.ts @@ -0,0 +1,7 @@ +export * from "./String"; +export * from "./BitField"; +export * from "./Intents"; +export * from "./MessageFlags"; +export * from "./Permissions"; +export * from "./Snowflake"; +export * from "./UserFlags"; diff --git a/dist/util/index.js b/dist/util/index.js new file mode 100644 index 00000000..25791a96 --- /dev/null +++ b/dist/util/index.js @@ -0,0 +1,20 @@ +"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 __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); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./String"), exports); +__exportStar(require("./BitField"), exports); +__exportStar(require("./Intents"), exports); +__exportStar(require("./MessageFlags"), exports); +__exportStar(require("./Permissions"), exports); +__exportStar(require("./Snowflake"), exports); +__exportStar(require("./UserFlags"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/util/index.js.map b/dist/util/index.js.map new file mode 100644 index 00000000..ce0269d5 --- /dev/null +++ b/dist/util/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2B;AAC3B,4CAA0B;AAC1B,iDAA+B;AAC/B,gDAA8B;AAC9B,8CAA4B;AAC5B,8CAA4B"} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 8484565a..914431d8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,29 +1,8 @@ export * from "./util/checkToken"; export * as Constants from "./util/Constants"; -export * from "./models/Ban"; -export * from "./models/Channel"; -export * from "./models/Emoji"; -export * from "./models/Guild"; -export * from "./models/Invite"; -export * from "./models/Member"; -export * from "./models/Role"; -export * from "./models/User"; -export * from "./models/Activity"; -export * from "./models/Application"; -export * from "./models/Interaction"; -export * from "./models/Message"; -export * from "./models/Status"; -export * from "./models/VoiceState"; - -export * from "./util/String"; -export * from "./util/BitField"; -export * from "./util/Intents"; -export * from "./util/MessageFlags"; -export * from "./util/Permissions"; -export * from "./util/Snowflake"; -export * from "./util/UserFlags"; -export * from "./models/Event"; +export * from "./models/index"; +export * from "./util/index"; import Config, { DefaultOptions } from "./util/Config"; import db, { MongooseCache } from "./util/Database"; diff --git a/src/models/Message.ts b/src/models/Message.ts index bb3c2d5b..15f00cf4 100644 --- a/src/models/Message.ts +++ b/src/models/Message.ts @@ -190,39 +190,50 @@ export const Embed = { ], }; -export const MessageSchema = new Schema({ - id: String, - channel_id: String, - author_id: String, - webhook_id: String, - guild_id: String, - application_id: String, - content: String, - timestamp: Date, - edited_timestamp: Date, - tts: Boolean, - mention_everyone: Boolean, - mention_user_ids: [String], - mention_role_ids: [String], - mention_channel_ids: [String], - attachments: [Attachment], - embeds: [Embed], - reactions: [Reaction], - nonce: Schema.Types.Mixed, // can be a long or a string - pinned: Boolean, - type: { type: Number }, - activity: { - type: Number, - party_id: String, - }, - flags: Types.Long, - stickers: [], - message_reference: { - message_id: String, +export const MessageSchema = new Schema( + { + id: String, channel_id: String, + author_id: String, + webhook_id: String, guild_id: String, + application_id: String, + content: String, + timestamp: Date, + edited_timestamp: Date, + tts: Boolean, + mention_everyone: Boolean, + mention_user_ids: [String], + mention_role_ids: [String], + mention_channel_ids: [String], + attachments: [Attachment], + embeds: [Embed], + reactions: [Reaction], + nonce: Schema.Types.Mixed, // can be a long or a string + pinned: Boolean, + type: { type: Number }, + activity: { + type: Number, + party_id: String, + }, + flags: Types.Long, + stickers: [], + message_reference: { + message_id: String, + channel_id: String, + guild_id: String, + }, }, -}); + { + toJSON: { + transform: function (doc, ret) { + delete ret.mention_channel_ids; + delete ret.mention_user_ids; + delete ret.mention_role_ids; + }, + }, + } +); MessageSchema.virtual("author", { ref: UserModel, diff --git a/src/models/index.ts b/src/models/index.ts new file mode 100644 index 00000000..bb6024fe --- /dev/null +++ b/src/models/index.ts @@ -0,0 +1,28 @@ +import mongoose from "mongoose"; + +export * from "./Ban"; +export * from "./Channel"; +export * from "./Emoji"; +export * from "./Guild"; +export * from "./Invite"; +export * from "./Member"; +export * from "./Role"; +export * from "./User"; +export * from "./Activity"; +export * from "./Application"; +export * from "./Interaction"; +export * from "./Message"; +export * from "./Status"; +export * from "./VoiceState"; +export * from "./Event"; + +mongoose.plugin((schema: any) => { + schema.options.toJSON = { + virtuals: true, + versionKey: false, + transform(doc: any, ret: any) { + delete ret._id; + delete ret.__v; + }, + }; +}); diff --git a/src/util/index.ts b/src/util/index.ts new file mode 100644 index 00000000..b0c7fe62 --- /dev/null +++ b/src/util/index.ts @@ -0,0 +1,7 @@ +export * from "./String"; +export * from "./BitField"; +export * from "./Intents"; +export * from "./MessageFlags"; +export * from "./Permissions"; +export * from "./Snowflake"; +export * from "./UserFlags"; -- cgit 1.5.1 From e6830735497f261df1b7e4c56ddb9c7578ef7106 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 23:25:11 +0200 Subject: :arrow_up: update mongodb --- README.md | 10 ++++++- package-lock.json | 85 ++++++++++++++++++++++++++++++++++++++++++++++------ package.json | 2 +- src/util/Database.ts | 3 +- tsconfig.json | 2 +- 5 files changed, 89 insertions(+), 13 deletions(-) (limited to 'src/util') diff --git a/README.md b/README.md index c08a72d5..c2d275c4 100644 --- a/README.md +++ b/README.md @@ -1 +1,9 @@ -# server-util \ No newline at end of file +# server-util + +add to package.json: + +```json +"start": "npm run build:util && npm run build && node dist/", +"build": "tsc -b .", +"build:util": "tsc -b ./node_modules/fosscord-server-util/" +``` diff --git a/package-lock.json b/package-lock.json index 4448c6fb..0e721c0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "jsonwebtoken": "^8.5.1", "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2", - "mongodb": "^3.6.4", + "mongodb": "^3.6.6", "mongoose": "^5.12.3" }, "devDependencies": { @@ -563,14 +563,14 @@ } }, "node_modules/mongodb": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", - "integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==", + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", + "integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==", "dependencies": { "bl": "^2.2.1", "bson": "^1.1.4", "denque": "^1.4.1", - "require_optional": "^1.0.1", + "optional-require": "^1.0.2", "safe-buffer": "^5.1.2", "saslprep": "^1.0.0" }, @@ -708,6 +708,45 @@ "mongoose": "*" } }, + "node_modules/mongoose/node_modules/mongodb": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", + "integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==", + "dependencies": { + "bl": "^2.2.1", + "bson": "^1.1.4", + "denque": "^1.4.1", + "require_optional": "^1.0.1", + "safe-buffer": "^5.1.2", + "saslprep": "^1.0.0" + }, + "engines": { + "node": ">=4" + }, + "optionalDependencies": { + "saslprep": "^1.0.0" + }, + "peerDependenciesMeta": { + "aws4": { + "optional": true + }, + "bson-ext": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "mongodb-extjson": { + "optional": true + }, + "snappy": { + "optional": true + } + } + }, "node_modules/mpath": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.3.tgz", @@ -762,6 +801,14 @@ "wrappy": "1" } }, + "node_modules/optional-require": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz", + "integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg==", + "engines": { + "node": ">=4" + } + }, "node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -1506,14 +1553,14 @@ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" }, "mongodb": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", - "integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==", + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", + "integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==", "requires": { "bl": "^2.2.1", "bson": "^1.1.4", "denque": "^1.4.1", - "require_optional": "^1.0.1", + "optional-require": "^1.0.2", "safe-buffer": "^5.1.2", "saslprep": "^1.0.0" } @@ -1591,6 +1638,21 @@ "safe-buffer": "5.2.1", "sift": "7.0.1", "sliced": "1.0.1" + }, + "dependencies": { + "mongodb": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz", + "integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==", + "requires": { + "bl": "^2.2.1", + "bson": "^1.1.4", + "denque": "^1.4.1", + "require_optional": "^1.0.1", + "safe-buffer": "^5.1.2", + "saslprep": "^1.0.0" + } + } } }, "mongoose-legacy-pluralize": { @@ -1649,6 +1711,11 @@ "wrappy": "1" } }, + "optional-require": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz", + "integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg==" + }, "p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", diff --git a/package.json b/package.json index 0ac2c9ce..7900d301 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "jsonwebtoken": "^8.5.1", "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2", - "mongodb": "^3.6.4", + "mongodb": "^3.6.6", "mongoose": "^5.12.3" }, "devDependencies": { diff --git a/src/util/Database.ts b/src/util/Database.ts index 6e774262..883c8dcd 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -6,7 +6,7 @@ const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPre console.log(`[DB] connect: ${uri}`); -const connection = mongoose.createConnection(uri, { autoIndex: true , useNewUrlParser: true, useUnifiedTopology: true }); +const connection = mongoose.createConnection(uri, { autoIndex: true, useNewUrlParser: true, useUnifiedTopology: true }); export default connection; @@ -32,6 +32,7 @@ export class MongooseCache extends EventEmitter { } init = async () => { + // @ts-ignore this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" }); this.stream.on("change", this.change); diff --git a/tsconfig.json b/tsconfig.json index 6cc2a681..520774d3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "include": ["src"], + "include": ["src/**/*.ts"], "compilerOptions": { /* Visit https://aka.ms/tsconfig.json to read more about this file */ -- cgit 1.5.1 From f48127f8a4881afc6dfb9b066b4eb357f1ef6c63 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Wed, 7 Apr 2021 03:02:13 +0200 Subject: :bug: fix lean not working with virtuals --- package-lock.json | 39 +++++++++++++++++++++++ package.json | 1 + src/index.ts | 4 +-- src/models/Message.ts | 86 +++++++++++++++++++++++++-------------------------- src/models/index.ts | 27 +++++++++------- src/util/Database.ts | 9 ++++++ 6 files changed, 109 insertions(+), 57 deletions(-) (limited to 'src/util') diff --git a/package-lock.json b/package-lock.json index 0e721c0c..902566ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ }, "devDependencies": { "@types/jsonwebtoken": "^8.5.0", + "@types/mongoose-lean-virtuals": "^0.5.1", "@types/node": "^14.14.25", "typescript": "^4.1.3" } @@ -47,6 +48,25 @@ "@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-lean-virtuals": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@types/mongoose-lean-virtuals/-/mongoose-lean-virtuals-0.5.1.tgz", + "integrity": "sha512-bNk+QLjP5VZU4EsJag4xQsjLAa8CEm/SKZDyiC2kM208wIrGum6daD7j45Oqs50bWNGfqZYRuEhh8xZ17D7aEw==", + "dev": true, + "dependencies": { + "@types/mongoose": "*" + } + }, "node_modules/@types/node": { "version": "14.14.25", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz", @@ -1164,6 +1184,25 @@ "@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-lean-virtuals": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@types/mongoose-lean-virtuals/-/mongoose-lean-virtuals-0.5.1.tgz", + "integrity": "sha512-bNk+QLjP5VZU4EsJag4xQsjLAa8CEm/SKZDyiC2kM208wIrGum6daD7j45Oqs50bWNGfqZYRuEhh8xZ17D7aEw==", + "dev": true, + "requires": { + "@types/mongoose": "*" + } + }, "@types/node": { "version": "14.14.25", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz", diff --git a/package.json b/package.json index 7900d301..b92228ff 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ }, "devDependencies": { "@types/jsonwebtoken": "^8.5.0", + "@types/mongoose-lean-virtuals": "^0.5.1", "@types/node": "^14.14.25", "typescript": "^4.1.3" } diff --git a/src/index.ts b/src/index.ts index 914431d8..343a7496 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,6 @@ export * from "./models/index"; export * from "./util/index"; import Config, { DefaultOptions } from "./util/Config"; -import db, { MongooseCache } from "./util/Database"; +import db, { MongooseCache, toObject } from "./util/Database"; -export { Config, db, DefaultOptions, MongooseCache }; +export { Config, db, DefaultOptions, MongooseCache, toObject }; diff --git a/src/models/Message.ts b/src/models/Message.ts index 15f00cf4..ee038f97 100644 --- a/src/models/Message.ts +++ b/src/models/Message.ts @@ -1,8 +1,9 @@ import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; -import { UserModel } from "./User"; -import { MemberModel } from "./Member"; -import { RoleModel } from "./Role"; +import { PublicUser, UserModel } from "./User"; +import { MemberModel, PublicMember } from "./Member"; +import { Role, RoleModel } from "./Role"; +import { Channel } from "./Channel"; export interface Message { id: string; @@ -36,6 +37,12 @@ export interface Message { channel_id?: string; guild_id?: string; }; + // mongoose virtuals: + author?: PublicUser; + member?: PublicMember; + mentions?: PublicUser[]; + mention_roles?: Role[]; + mention_channels?: Channel[]; } export interface MessageDocument extends Document, Message { @@ -190,50 +197,39 @@ export const Embed = { ], }; -export const MessageSchema = new Schema( - { - id: String, +export const MessageSchema = new Schema({ + id: String, + channel_id: String, + author_id: String, + webhook_id: String, + guild_id: String, + application_id: String, + content: String, + timestamp: Date, + edited_timestamp: Date, + tts: Boolean, + mention_everyone: Boolean, + mention_user_ids: [String], + mention_role_ids: [String], + mention_channel_ids: [String], + attachments: [Attachment], + embeds: [Embed], + reactions: [Reaction], + nonce: Schema.Types.Mixed, // can be a long or a string + pinned: Boolean, + type: { type: Number }, + activity: { + type: Number, + party_id: String, + }, + flags: Types.Long, + stickers: [], + message_reference: { + message_id: String, channel_id: String, - author_id: String, - webhook_id: String, guild_id: String, - application_id: String, - content: String, - timestamp: Date, - edited_timestamp: Date, - tts: Boolean, - mention_everyone: Boolean, - mention_user_ids: [String], - mention_role_ids: [String], - mention_channel_ids: [String], - attachments: [Attachment], - embeds: [Embed], - reactions: [Reaction], - nonce: Schema.Types.Mixed, // can be a long or a string - pinned: Boolean, - type: { type: Number }, - activity: { - type: Number, - party_id: String, - }, - flags: Types.Long, - stickers: [], - message_reference: { - message_id: String, - channel_id: String, - guild_id: String, - }, }, - { - toJSON: { - transform: function (doc, ret) { - delete ret.mention_channel_ids; - delete ret.mention_user_ids; - delete ret.mention_role_ids; - }, - }, - } -); +}); MessageSchema.virtual("author", { ref: UserModel, @@ -270,6 +266,8 @@ MessageSchema.virtual("mention_channels", { justOne: false, }); +MessageSchema.set("removeResponse", ["mention_channel_ids", "mention_role_ids", "mention_user_ids", "author_id"]); + // TODO: missing Application Model // MessageSchema.virtual("application", { // ref: Application, diff --git a/src/models/index.ts b/src/models/index.ts index bb6024fe..03b9fe70 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,4 +1,20 @@ import mongoose from "mongoose"; +import { Schema } from "mongoose"; + +mongoose.plugin((schema: Schema, opts: any) => { + schema.set("toObject", { + virtuals: true, + versionKey: false, + transform(doc: any, ret: any) { + delete ret._id; + delete ret.__v; + const props = schema.get("removeResponse") || []; + props.forEach((prop: string) => { + delete ret[prop]; + }); + }, + }); +}); export * from "./Ban"; export * from "./Channel"; @@ -15,14 +31,3 @@ export * from "./Message"; export * from "./Status"; export * from "./VoiceState"; export * from "./Event"; - -mongoose.plugin((schema: any) => { - schema.options.toJSON = { - virtuals: true, - versionKey: false, - transform(doc: any, ret: any) { - delete ret._id; - delete ret.__v; - }, - }; -}); diff --git a/src/util/Database.ts b/src/util/Database.ts index 883c8dcd..e17eeccb 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -2,6 +2,7 @@ import "./MongoBigInt"; import mongoose, { Collection, Connection } from "mongoose"; import { ChangeStream, ChangeEvent, Long } from "mongodb"; import EventEmitter from "events"; +import { Document } from "mongoose"; const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPreference=secondaryPreferred"; console.log(`[DB] connect: ${uri}`); @@ -10,6 +11,14 @@ const connection = mongoose.createConnection(uri, { autoIndex: true, useNewUrlPa export default connection; +function transform(document: T) { + return document.toObject({ virtuals: true }); +} + +export function toObject(document: T | T[]) { + return Array.isArray(document) ? document.map((x) => transform(x)) : transform(document); +} + export interface MongooseCache { on(event: "delete", listener: (id: string) => void): this; on(event: "change", listener: (data: any) => void): this; -- cgit 1.5.1 From 084c396e8d85da5450f50bb3a3631a8621d9eb21 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Wed, 7 Apr 2021 04:01:47 +0200 Subject: fix toObject type --- src/util/Database.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/util') diff --git a/src/util/Database.ts b/src/util/Database.ts index e17eeccb..5d9afab9 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -1,5 +1,5 @@ import "./MongoBigInt"; -import mongoose, { Collection, Connection } from "mongoose"; +import mongoose, { Collection, Connection, LeanDocument } from "mongoose"; import { ChangeStream, ChangeEvent, Long } from "mongodb"; import EventEmitter from "events"; import { Document } from "mongoose"; @@ -11,11 +11,13 @@ const connection = mongoose.createConnection(uri, { autoIndex: true, useNewUrlPa export default connection; -function transform(document: T) { +function transform(document: T) { + // @ts-ignore return document.toObject({ virtuals: true }); } -export function toObject(document: T | T[]) { +export function toObject(document: T): LeanDocument { + // @ts-ignore return Array.isArray(document) ? document.map((x) => transform(x)) : transform(document); } -- cgit 1.5.1 From 25d901e8e1399afa050b078b88662afede5bd9d1 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Wed, 7 Apr 2021 15:54:27 +0200 Subject: getPermission use cache --- src/util/Permissions.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/util') diff --git a/src/util/Permissions.ts b/src/util/Permissions.ts index 4bad70d3..fb7e0b88 100644 --- a/src/util/Permissions.ts +++ b/src/util/Permissions.ts @@ -147,21 +147,21 @@ export async function getPermission( user_id: string, guild_id: string, channel_id?: string, - cache?: { channel?: ChannelDocument | null; member?: MemberDocument | null } + cache?: { channel?: ChannelDocument | null; member?: MemberDocument | null; guild?: GuildDocument | null } ) { - var { channel, member } = cache || {}; + var { channel, member, guild } = cache || {}; - const guild = await GuildModel.findOne({ id: guild_id }, { owner_id: true }).exec(); + if (!guild) guild = await GuildModel.findOne({ id: guild_id }, { owner_id: true }).exec(); if (!guild) throw new Error("Guild not found"); if (guild.owner_id === user_id) return new Permissions(Permissions.FLAGS.ADMINISTRATOR); - member = await MemberModel.findOne({ guild_id, id: user_id }, "roles").exec(); + if (!member) member = await MemberModel.findOne({ guild_id, id: user_id }, "roles").exec(); if (!member) throw new Error("Member not found"); var roles = await RoleModel.find({ guild_id, id: { $in: member.roles } }) .lean() .exec(); - if (channel_id) { + if (channel_id && !channel) { channel = await ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec(); } -- cgit 1.5.1 From 9e7963824a47757d747ff5eda0226d939812f462 Mon Sep 17 00:00:00 2001 From: xnacly Date: Thu, 8 Apr 2021 15:56:09 +0200 Subject: added hasThrow --- src/util/Permissions.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/util') diff --git a/src/util/Permissions.ts b/src/util/Permissions.ts index ae21e138..88a54954 100644 --- a/src/util/Permissions.ts +++ b/src/util/Permissions.ts @@ -97,6 +97,16 @@ export class Permissions extends BitField { return (checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.has(permission); } + /** + * Checks whether the bitfield has a permission, or multiple permissions, but throws an Error if user fails to match auth criteria. + */ + hasThrow(permission: PermissionResolvable, checkAdmin = true) { + if ((checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.has(permission)) { + return true; + } + throw new Error(`User doesn't fulfill the following permission criteria: ${permission}`); + } + static channelPermission(overwrites: ChannelPermissionOverwrite[], init?: bigint) { // TODO: do not deny any permissions if admin return overwrites.reduce((permission, overwrite) => { -- cgit 1.5.1 From e8c097ef273100c6200c8e814965f2cb02de0bc9 Mon Sep 17 00:00:00 2001 From: notsapinho <52896767+notsapinho@users.noreply.github.com> Date: Thu, 8 Apr 2021 11:43:26 -0300 Subject: added toBigInt and BigInt getters to bitfields --- src/models/Channel.ts | 5 +++-- src/models/Guild.ts | 6 +++++- src/models/Role.ts | 4 +++- src/models/User.ts | 5 +++-- src/util/Database.ts | 13 ++++++++++++- src/util/MongoBigInt.ts | 2 +- src/util/checkToken.ts | 2 +- src/util/index.ts | 1 + src/util/toBigInt.ts | 3 +++ 9 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 src/util/toBigInt.ts (limited to 'src/util') diff --git a/src/models/Channel.ts b/src/models/Channel.ts index 82ad2999..1b9a167c 100644 --- a/src/models/Channel.ts +++ b/src/models/Channel.ts @@ -1,5 +1,6 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; +import toBigInt from "../util/toBigInt"; export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel {} @@ -24,8 +25,8 @@ export const ChannelSchema = new Schema({ topic: String, permission_overwrites: [ { - allow: Types.Long, - deny: Types.Long, + allow: { type: String, get: toBigInt }, + deny: { type: String, get: toBigInt }, id: String, type: Number, }, diff --git a/src/models/Guild.ts b/src/models/Guild.ts index 819ac840..ef343010 100644 --- a/src/models/Guild.ts +++ b/src/models/Guild.ts @@ -32,6 +32,8 @@ export interface Guild { // channels: GuildChannel[]; // * Channels are stored in a seperate collection // emojis: Emoji[]; // * Emojis are stored in a seperate collection // voice_states: []; // * voice_states are stored in a seperate collection + //TODO: + presences?: object[]; mfa_level?: number; name: string; owner_id: string; @@ -69,6 +71,7 @@ export const GuildSchema = new Schema({ max_presences: Number, max_video_channel_users: { type: Number, default: 25 }, member_count: Number, + presences: { type: [Object], default: [] }, presence_count: Number, mfa_level: Number, name: { type: String, required: true }, @@ -98,6 +101,7 @@ GuildSchema.virtual("channels", { justOne: false, autopopulate: true, }); + GuildSchema.virtual("roles", { ref: RoleModel, localField: "id", @@ -128,7 +132,7 @@ GuildSchema.virtual("joined_at", { foreignField: "guild_id", justOne: true, }).get((member: any, virtual: any, doc: any) => { - return member.joined_at; + return member?.joined_at; }); // @ts-ignore diff --git a/src/models/Role.ts b/src/models/Role.ts index 84ad55d0..c1111c84 100644 --- a/src/models/Role.ts +++ b/src/models/Role.ts @@ -1,5 +1,6 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; +import toBigInt from "../util/toBigInt"; export interface Role { id: string; @@ -28,12 +29,13 @@ export const RoleSchema = new Schema({ managed: Boolean, mentionable: Boolean, name: String, - permissions: Types.Long, + permissions: { type: String, get: toBigInt }, position: Number, tags: { bot_id: String, }, }); + RoleSchema.set("removeResponse", ["guild_id"]); // @ts-ignore diff --git a/src/models/User.ts b/src/models/User.ts index 1f01e837..8511a9b0 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -2,6 +2,7 @@ import { Activity } from "./Activity"; import { ClientStatus, Status } from "./Status"; import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; +import toBigInt from "../util/toBigInt"; export const PublicUserProjection = { username: true, @@ -141,8 +142,8 @@ export const UserSchema = new Schema({ created_at: Date, verified: Boolean, email: String, - flags: Types.Long, // TODO: automatically convert Types.Long to BitField of UserFlags - public_flags: Types.Long, + flags: { type: String, get: toBigInt }, // TODO: automatically convert Types.Long to BitField of UserFlags + public_flags: { type: String, get: toBigInt }, guilds: [String], // array of guild ids the user is part of user_data: { fingerprints: [String], diff --git a/src/util/Database.ts b/src/util/Database.ts index 5d9afab9..339ac65b 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -7,7 +7,12 @@ const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPre console.log(`[DB] connect: ${uri}`); -const connection = mongoose.createConnection(uri, { autoIndex: true, useNewUrlParser: true, useUnifiedTopology: true }); +const connection = mongoose.createConnection(uri, { + autoIndex: true, + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify: false, +}); export default connection; @@ -56,6 +61,12 @@ export class MongooseCache extends EventEmitter { } }; + changeStream = (pipeline: any) => { + this.pipeline = pipeline; + this.destroy(); + this.init(); + }; + convertResult = (obj: any) => { if (obj instanceof Long) return BigInt(obj.toString()); if (typeof obj === "object") { diff --git a/src/util/MongoBigInt.ts b/src/util/MongoBigInt.ts index c4e5f623..fc451925 100644 --- a/src/util/MongoBigInt.ts +++ b/src/util/MongoBigInt.ts @@ -44,7 +44,7 @@ class LongSchema extends mongoose.SchemaType { if (val instanceof Number || "number" == typeof val) return BigInt(val); if (!Array.isArray(val) && val.toString) return BigInt(val.toString()); - // @ts-ignore + //@ts-ignore throw new SchemaType.CastError("Long", val); } diff --git a/src/util/checkToken.ts b/src/util/checkToken.ts index b4635126..d5a128b4 100644 --- a/src/util/checkToken.ts +++ b/src/util/checkToken.ts @@ -4,7 +4,7 @@ import Config from "./Config"; export function checkToken(token: string): Promise { return new Promise((res, rej) => { - jwt.verify(token, Config.getAll().api.security.jwtSecret, JWTOptions, (err, decoded: any) => { + jwt.verify(token, Config.getAll()?.api?.security?.jwtSecret, JWTOptions, (err, decoded: any) => { if (err || !decoded) return rej("Invalid Token"); return res(decoded); diff --git a/src/util/index.ts b/src/util/index.ts index b0c7fe62..7e8bca20 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -5,3 +5,4 @@ export * from "./MessageFlags"; export * from "./Permissions"; export * from "./Snowflake"; export * from "./UserFlags"; +export * from "./toBigInt" \ No newline at end of file diff --git a/src/util/toBigInt.ts b/src/util/toBigInt.ts new file mode 100644 index 00000000..d57c4568 --- /dev/null +++ b/src/util/toBigInt.ts @@ -0,0 +1,3 @@ +export default function toBigInt(string: String): BigInt { + return BigInt(string); +} -- cgit 1.5.1