From f22b6d3f0b530058b538c33670a5600e5d3b4abd Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sat, 27 Mar 2021 21:25:49 +0100 Subject: [PATCH 01/35] :art: update Message timestamp to use Date --- dist/models/Message.d.ts | 8 ++++---- dist/models/Message.js | 6 +++--- dist/models/Message.js.map | 2 +- src/models/Message.ts | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dist/models/Message.d.ts b/dist/models/Message.d.ts index 403e84c3..cd0fc7a0 100644 --- a/dist/models/Message.d.ts +++ b/dist/models/Message.d.ts @@ -8,8 +8,8 @@ export interface Message { webhook_id?: bigint; application_id: bigint; content: string; - timestamp: number; - edited_timestamp: number; + timestamp: Date; + edited_timestamp: Date; tts: boolean; mention_everyone: boolean; mention_user_ids: bigint[]; @@ -69,7 +69,7 @@ export interface Embed { type?: string; description?: string; url?: string; - timestamp?: number; + timestamp?: Date; color?: number; footer?: { text: string; @@ -136,7 +136,7 @@ export declare const Embed: { type: StringConstructor; description: StringConstructor; url: StringConstructor; - timestamp: NumberConstructor; + timestamp: DateConstructor; color: NumberConstructor; footer: { text: StringConstructor; diff --git a/dist/models/Message.js b/dist/models/Message.js index 3ae1d6db..add929c6 100644 --- a/dist/models/Message.js +++ b/dist/models/Message.js @@ -57,7 +57,7 @@ exports.Embed = { type: String, description: String, url: String, - timestamp: Number, + timestamp: Date, color: Number, footer: { text: String, @@ -93,8 +93,8 @@ exports.MessageSchema = new mongoose_1.Schema({ guild_id: mongoose_1.Types.Long, application_id: mongoose_1.Types.Long, content: String, - timestamp: Number, - edited_timestamp: Number, + timestamp: Date, + edited_timestamp: Date, tts: Boolean, mention_everyone: Boolean, mention_user_ids: [mongoose_1.Types.Long], diff --git a/dist/models/Message.js.map b/dist/models/Message.js.map index 82bbecc1..6e8bb229 100644 --- a/dist/models/Message.js.map +++ b/dist/models/Message.js.map @@ -1 +1 @@ -{"version":3,"file":"Message.js","sourceRoot":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,QAAA,YAAY,GAAG,kBAAE,CAAC,KAAK,CAAkB,SAAS,EAAE,qBAAa,EAAE,UAAU,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../src/models/Message.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAClC,iCAAmC;AACnC,qCAAuC;AACvC,iCAAmC;AAwCnC,IAAY,WAkBX;AAlBD,WAAY,WAAW;IACtB,mDAAW,CAAA;IACX,+DAAiB,CAAA;IACjB,qEAAoB,CAAA;IACpB,6CAAQ,CAAA;IACR,2EAAuB,CAAA;IACvB,2EAAuB,CAAA;IACvB,iFAA0B,CAAA;IAC1B,uEAAqB,CAAA;IACrB,mGAAmC,CAAA;IACnC,iHAA0C,CAAA;IAC1C,kHAA2C,CAAA;IAC3C,kHAA2C,CAAA;IAC3C,0EAAuB,CAAA;IACvB,8FAAiC,CAAA;IACjC,4FAAgC,CAAA;IAChC,gDAAU,CAAA;IACV,4EAAwB,CAAA;AACzB,CAAC,EAlBW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAkBtB;AAsEY,QAAA,UAAU,GAAG;IACzB,EAAE,EAAE,gBAAK,CAAC,IAAI;IACd,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;CACb,CAAC;AAEW,QAAA,UAAU,GAAG;IACzB,GAAG,EAAE,MAAM;IACX,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,QAAQ,GAAG;IAChB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE;QACN,EAAE,EAAE,gBAAK,CAAC,IAAI;QACd,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,OAAO;KACjB;CACD,CAAC;AAEW,QAAA,KAAK,GAAG;IACpB,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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/src/models/Message.ts b/src/models/Message.ts index 88291f9f..81f617d3 100644 --- a/src/models/Message.ts +++ b/src/models/Message.ts @@ -12,8 +12,8 @@ export interface Message { webhook_id?: bigint; application_id: bigint; content: string; - timestamp: number; - edited_timestamp: number; + timestamp: Date; + edited_timestamp: Date; tts: boolean; mention_everyone: boolean; mention_user_ids: bigint[]; @@ -77,7 +77,7 @@ export interface Embed { type?: string; // type of embed (always "rich" for webhook embeds) description?: string; // description of embed url?: string; // url of embed - timestamp?: number; // timestamp of embed content + timestamp?: Date; // timestamp of embed content color?: number; // color code of the embed footer?: { text: string; @@ -161,7 +161,7 @@ export const Embed = { type: String, // type of embed (always "rich" for webhook embeds) description: String, // description of embed url: String, // url of embed - timestamp: Number, // timestamp of embed content + timestamp: Date, // timestamp of embed content color: Number, // color code of the embed footer: { text: String, @@ -198,8 +198,8 @@ export const MessageSchema = new Schema({ guild_id: Types.Long, application_id: Types.Long, content: String, - timestamp: Number, - edited_timestamp: Number, + timestamp: Date, + edited_timestamp: Date, tts: Boolean, mention_everyone: Boolean, mention_user_ids: [Types.Long], From 9d06aa09bf8e1b44766d502a5549ac49fcb79e4c Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sat, 27 Mar 2021 21:51:45 +0100 Subject: [PATCH 02/35] :art: Message --- dist/models/Message.d.ts | 14 +++++++------- src/models/Message.ts | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dist/models/Message.d.ts b/dist/models/Message.d.ts index cd0fc7a0..a823ce5e 100644 --- a/dist/models/Message.d.ts +++ b/dist/models/Message.d.ts @@ -6,20 +6,20 @@ export interface Message { guild_id?: bigint; author_id?: bigint; webhook_id?: bigint; - application_id: bigint; - content: string; + application_id?: bigint; + content?: string; timestamp: Date; - edited_timestamp: Date; - tts: boolean; - mention_everyone: boolean; + edited_timestamp?: Date; + tts?: boolean; + mention_everyone?: boolean; mention_user_ids: bigint[]; mention_role_ids: bigint[]; mention_channels_ids: bigint[]; attachments: Attachment[]; embeds: Embed[]; - reactions?: Reaction[]; + reactions: Reaction[]; nonce?: string | number; - pinned: boolean; + pinned?: boolean; type: MessageType; activity?: { type: number; diff --git a/src/models/Message.ts b/src/models/Message.ts index 81f617d3..e80ec1f8 100644 --- a/src/models/Message.ts +++ b/src/models/Message.ts @@ -10,20 +10,20 @@ export interface Message { guild_id?: bigint; author_id?: bigint; webhook_id?: bigint; - application_id: bigint; - content: string; + application_id?: bigint; + content?: string; timestamp: Date; - edited_timestamp: Date; - tts: boolean; - mention_everyone: boolean; + edited_timestamp?: Date; + tts?: boolean; + mention_everyone?: boolean; mention_user_ids: bigint[]; mention_role_ids: bigint[]; mention_channels_ids: bigint[]; attachments: Attachment[]; embeds: Embed[]; - reactions?: Reaction[]; + reactions: Reaction[]; nonce?: string | number; - pinned: boolean; + pinned?: boolean; type: MessageType; activity?: { type: number; From 4d6fd4634fbc9f8e853f19c180555907d6547705 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Mon, 5 Apr 2021 22:28:51 +0200 Subject: [PATCH 03/35] :sparkles: Event Enum --- dist/models/Event.d.ts | 42 ++++++++++++++++++++++++++++++++++++ dist/models/Event.js | 46 +++++++++++++++++++++++++++++++++++++++- dist/models/Event.js.map | 2 +- src/models/Event.ts | 43 +++++++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+), 2 deletions(-) diff --git a/dist/models/Event.d.ts b/dist/models/Event.d.ts index eabde08a..b74930b9 100644 --- a/dist/models/Event.d.ts +++ b/dist/models/Event.d.ts @@ -353,5 +353,47 @@ export interface InteractionCreateEvent extends Event { event: "INTERACTION_CREATE"; data: Interaction; } +export declare enum EVENTEnum { + Ready = "READY", + ChannelCreate = "CHANNEL_CREATE", + ChannelUpdate = "CHANNEL_UPDATE", + ChannelDelete = "CHANNEL_DELETE", + ChannelPinsUpdate = "CHANNEL_PINS_UPDATE", + GuildCreate = "GUILD_CREATE", + GuildUpdate = "GUILD_UPDATE", + GuildDelete = "GUILD_DELETE", + GuildBanAdd = "GUILD_BAN_ADD", + GuildBanRemove = "GUILD_BAN_REMOVE", + GuildEmojUpdate = "GUILD_EMOJI_UPDATE", + GuildIntegrationsUpdate = "GUILD_INTEGRATIONS_UPDATE", + GuildMemberAdd = "GUILD_MEMBER_ADD", + GuildMemberRempve = "GUILD_MEMBER_REMOVE", + GuildMemberUpdate = "GUILD_MEMBER_UPDATE", + GuildMemberSpeaking = "GUILD_MEMBER_SPEAKING", + GuildMembersChunk = "GUILD_MEMBERS_CHUNK", + GuildRoleCreate = "GUILD_ROLE_CREATE", + GuildRoleDelete = "GUILD_ROLE_DELETE", + GuildRoleUpdate = "GUILD_ROLE_UPDATE", + InviteCreate = "INVITE_CREATE", + InviteDelete = "INVITE_DELETE", + MessageCreate = "MESSAGE_CREATE", + MessageUpdate = "MESSAGE_UPDATE", + MessageDelete = "MESSAGE_DELETE", + MessageDeleteBulk = "MESSAGE_DELETE_BULK", + MessageReactionAdd = "MESSAGE_REACTION_ADD", + MessageReactionRemove = "MESSAGE_REACTION_REMOVE", + MessageReactionRemoveAll = "MESSAGE_REACTION_REMOVE_ALL", + MessageReactionRemoveEmoji = "MESSAGE_REACTION_REMOVE_EMOJI", + PresenceUpdate = "PRESENCE_UPDATE", + TypingStart = "TYPING_START", + UserUpdate = "USER_UPDATE", + WebhooksUpdate = "WEBHOOKS_UPDATE", + InteractionCreate = "INTERACTION_CREATE", + VoiceStateUpdate = "VOICE_STATE_UPDATE", + VoiceServerUpdate = "VOICE_SERVER_UPDATE", + ApplicationCommandCreate = "APPLICATION_COMMAND_CREATE", + ApplicationCommandUpdate = "APPLICATION_COMMAND_UPDATE", + ApplicationCommandDelete = "APPLICATION_COMMAND_DELETE" +} export declare type EVENT = "READY" | "CHANNEL_CREATE" | "CHANNEL_UPDATE" | "CHANNEL_DELETE" | "CHANNEL_PINS_UPDATE" | "GUILD_CREATE" | "GUILD_UPDATE" | "GUILD_DELETE" | "GUILD_BAN_ADD" | "GUILD_BAN_REMOVE" | "GUILD_EMOJI_UPDATE" | "GUILD_INTEGRATIONS_UPDATE" | "GUILD_MEMBER_ADD" | "GUILD_MEMBER_REMOVE" | "GUILD_MEMBER_UPDATE" | "GUILD_MEMBER_SPEAKING" | "GUILD_MEMBERS_CHUNK" | "GUILD_ROLE_CREATE" | "GUILD_ROLE_DELETE" | "GUILD_ROLE_UPDATE" | "INVITE_CREATE" | "INVITE_DELETE" | "MESSAGE_CREATE" | "MESSAGE_UPDATE" | "MESSAGE_DELETE" | "MESSAGE_DELETE_BULK" | "MESSAGE_REACTION_ADD" | "MESSAGE_REACTION_REMOVE" | "MESSAGE_REACTION_REMOVE_ALL" | "MESSAGE_REACTION_REMOVE_EMOJI" | "PRESENCE_UPDATE" | "TYPING_START" | "USER_UPDATE" | "WEBHOOKS_UPDATE" | "INTERACTION_CREATE" | "VOICE_STATE_UPDATE" | "VOICE_SERVER_UPDATE" | "APPLICATION_COMMAND_CREATE" | "APPLICATION_COMMAND_UPDATE" | "APPLICATION_COMMAND_DELETE" | CUSTOMEVENTS; export declare type CUSTOMEVENTS = "INVALIDATED"; diff --git a/dist/models/Event.js b/dist/models/Event.js index 76ba96ff..d6eb6f6e 100644 --- a/dist/models/Event.js +++ b/dist/models/Event.js @@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.EventModel = exports.EventSchema = void 0; +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({ @@ -16,4 +16,48 @@ exports.EventSchema = new mongoose_1.Schema({ }); // @ts-ignore exports.EventModel = Database_1.default.model("Event", exports.EventSchema, "events"); +// located in collection events +var EVENTEnum; +(function (EVENTEnum) { + EVENTEnum["Ready"] = "READY"; + EVENTEnum["ChannelCreate"] = "CHANNEL_CREATE"; + EVENTEnum["ChannelUpdate"] = "CHANNEL_UPDATE"; + EVENTEnum["ChannelDelete"] = "CHANNEL_DELETE"; + EVENTEnum["ChannelPinsUpdate"] = "CHANNEL_PINS_UPDATE"; + EVENTEnum["GuildCreate"] = "GUILD_CREATE"; + EVENTEnum["GuildUpdate"] = "GUILD_UPDATE"; + EVENTEnum["GuildDelete"] = "GUILD_DELETE"; + EVENTEnum["GuildBanAdd"] = "GUILD_BAN_ADD"; + EVENTEnum["GuildBanRemove"] = "GUILD_BAN_REMOVE"; + EVENTEnum["GuildEmojUpdate"] = "GUILD_EMOJI_UPDATE"; + EVENTEnum["GuildIntegrationsUpdate"] = "GUILD_INTEGRATIONS_UPDATE"; + EVENTEnum["GuildMemberAdd"] = "GUILD_MEMBER_ADD"; + EVENTEnum["GuildMemberRempve"] = "GUILD_MEMBER_REMOVE"; + EVENTEnum["GuildMemberUpdate"] = "GUILD_MEMBER_UPDATE"; + EVENTEnum["GuildMemberSpeaking"] = "GUILD_MEMBER_SPEAKING"; + EVENTEnum["GuildMembersChunk"] = "GUILD_MEMBERS_CHUNK"; + EVENTEnum["GuildRoleCreate"] = "GUILD_ROLE_CREATE"; + EVENTEnum["GuildRoleDelete"] = "GUILD_ROLE_DELETE"; + EVENTEnum["GuildRoleUpdate"] = "GUILD_ROLE_UPDATE"; + EVENTEnum["InviteCreate"] = "INVITE_CREATE"; + EVENTEnum["InviteDelete"] = "INVITE_DELETE"; + EVENTEnum["MessageCreate"] = "MESSAGE_CREATE"; + EVENTEnum["MessageUpdate"] = "MESSAGE_UPDATE"; + EVENTEnum["MessageDelete"] = "MESSAGE_DELETE"; + EVENTEnum["MessageDeleteBulk"] = "MESSAGE_DELETE_BULK"; + EVENTEnum["MessageReactionAdd"] = "MESSAGE_REACTION_ADD"; + EVENTEnum["MessageReactionRemove"] = "MESSAGE_REACTION_REMOVE"; + EVENTEnum["MessageReactionRemoveAll"] = "MESSAGE_REACTION_REMOVE_ALL"; + EVENTEnum["MessageReactionRemoveEmoji"] = "MESSAGE_REACTION_REMOVE_EMOJI"; + EVENTEnum["PresenceUpdate"] = "PRESENCE_UPDATE"; + EVENTEnum["TypingStart"] = "TYPING_START"; + EVENTEnum["UserUpdate"] = "USER_UPDATE"; + EVENTEnum["WebhooksUpdate"] = "WEBHOOKS_UPDATE"; + EVENTEnum["InteractionCreate"] = "INTERACTION_CREATE"; + EVENTEnum["VoiceStateUpdate"] = "VOICE_STATE_UPDATE"; + EVENTEnum["VoiceServerUpdate"] = "VOICE_SERVER_UPDATE"; + EVENTEnum["ApplicationCommandCreate"] = "APPLICATION_COMMAND_CREATE"; + EVENTEnum["ApplicationCommandUpdate"] = "APPLICATION_COMMAND_UPDATE"; + EVENTEnum["ApplicationCommandDelete"] = "APPLICATION_COMMAND_DELETE"; +})(EVENTEnum = exports.EVENTEnum || (exports.EVENTEnum = {})); //# sourceMappingURL=Event.js.map \ No newline at end of file diff --git a/dist/models/Event.js.map b/dist/models/Event.js.map index 7a096d42..bb43d136 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,I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ACzC,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/src/models/Event.ts b/src/models/Event.ts index 40cbcb20..9d328b00 100644 --- a/src/models/Event.ts +++ b/src/models/Event.ts @@ -404,6 +404,49 @@ export interface InteractionCreateEvent extends Event { // located in collection events +export enum EVENTEnum { + Ready = "READY", + ChannelCreate = "CHANNEL_CREATE", + ChannelUpdate = "CHANNEL_UPDATE", + ChannelDelete = "CHANNEL_DELETE", + ChannelPinsUpdate = "CHANNEL_PINS_UPDATE", + GuildCreate = "GUILD_CREATE", + GuildUpdate = "GUILD_UPDATE", + GuildDelete = "GUILD_DELETE", + GuildBanAdd = "GUILD_BAN_ADD", + GuildBanRemove = "GUILD_BAN_REMOVE", + GuildEmojUpdate = "GUILD_EMOJI_UPDATE", + GuildIntegrationsUpdate = "GUILD_INTEGRATIONS_UPDATE", + GuildMemberAdd = "GUILD_MEMBER_ADD", + GuildMemberRempve = "GUILD_MEMBER_REMOVE", + GuildMemberUpdate = "GUILD_MEMBER_UPDATE", + GuildMemberSpeaking = "GUILD_MEMBER_SPEAKING", + GuildMembersChunk = "GUILD_MEMBERS_CHUNK", + GuildRoleCreate = "GUILD_ROLE_CREATE", + GuildRoleDelete = "GUILD_ROLE_DELETE", + GuildRoleUpdate = "GUILD_ROLE_UPDATE", + InviteCreate = "INVITE_CREATE", + InviteDelete = "INVITE_DELETE", + MessageCreate = "MESSAGE_CREATE", + MessageUpdate = "MESSAGE_UPDATE", + MessageDelete = "MESSAGE_DELETE", + MessageDeleteBulk = "MESSAGE_DELETE_BULK", + MessageReactionAdd = "MESSAGE_REACTION_ADD", + MessageReactionRemove = "MESSAGE_REACTION_REMOVE", + MessageReactionRemoveAll = "MESSAGE_REACTION_REMOVE_ALL", + MessageReactionRemoveEmoji = "MESSAGE_REACTION_REMOVE_EMOJI", + PresenceUpdate = "PRESENCE_UPDATE", + TypingStart = "TYPING_START", + UserUpdate = "USER_UPDATE", + WebhooksUpdate = "WEBHOOKS_UPDATE", + InteractionCreate = "INTERACTION_CREATE", + VoiceStateUpdate = "VOICE_STATE_UPDATE", + VoiceServerUpdate = "VOICE_SERVER_UPDATE", + ApplicationCommandCreate = "APPLICATION_COMMAND_CREATE", + ApplicationCommandUpdate = "APPLICATION_COMMAND_UPDATE", + ApplicationCommandDelete = "APPLICATION_COMMAND_DELETE", +} + export type EVENT = | "READY" | "CHANNEL_CREATE" From a888147dfc44710b0e7c70d04b7a841a181fb71d Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Mon, 5 Apr 2021 22:33:01 +0200 Subject: [PATCH 04/35] :sparkles: export ReadyEventData --- dist/models/Event.d.ts | 119 ++++++++++++++++++++------------------- dist/models/Event.js.map | 2 +- src/models/Event.ts | 106 +++++++++++++++++----------------- 3 files changed, 115 insertions(+), 112 deletions(-) diff --git a/dist/models/Event.d.ts b/dist/models/Event.d.ts index b74930b9..e4a1517b 100644 --- a/dist/models/Event.d.ts +++ b/dist/models/Event.d.ts @@ -27,67 +27,68 @@ export declare const EventModel: import("mongoose").Model; export interface InvalidatedEvent extends Event { event: "INVALIDATED"; } +export interface ReadyEventData { + v: number; + user: Omit; + private_channels: DMChannel[]; + session_id: string; + guilds: Guild[]; + analytics_token?: string; + connected_accounts?: ConnectedAccount[]; + consents?: { + personalization?: { + consented?: boolean; + }; + }; + country_code?: string; + friend_suggestion_count?: number; + geo_ordered_rtc_regions?: string[]; + experiments?: [number, number, number, number, number][]; + guild_experiments?: [ + number, + null, + number, + [ + [number, { + e: number; + s: number; + }[]] + ], + [ + number, + [[number, [number, number]]] + ], + { + b: number; + k: bigint[]; + }[] + ][]; + guild_join_requests?: []; + shard?: [number, number]; + user_settings?: UserSettings; + relationships?: []; + user_guild_settings?: { + entries: UserGuildSettings[]; + version: number; + partial: boolean; + }; + application?: { + id: bigint; + flags: bigint; + }; + merged_members?: PublicMember[][]; + users?: { + avatar?: string; + discriminator: string; + id: bigint; + username: string; + bot: boolean; + public_flags: bigint; + }[]; +} export interface ReadyEvent extends Event { event: "READY"; - data: { - v: number; - user: Omit; - private_channels: DMChannel[]; - session_id: string; - guilds: Guild[]; - analytics_token?: string; - connected_accounts?: ConnectedAccount[]; - consents?: { - personalization?: { - consented?: boolean; - }; - }; - country_code?: string; - friend_suggestion_count?: number; - geo_ordered_rtc_regions?: string[]; - experiments?: [number, number, number, number, number][]; - guild_experiments?: [ - number, - null, - number, - [ - [number, { - e: number; - s: number; - }[]] - ], - [ - number, - [[number, [number, number]]] - ], - { - b: number; - k: bigint[]; - }[] - ][]; - guild_join_requests?: []; - shard?: [number, number]; - user_settings?: UserSettings; - relationships?: []; - user_guild_settings?: { - entries: UserGuildSettings[]; - version: number; - partial: boolean; - }; - application?: { - id: bigint; - flags: bigint; - }; - merged_members?: PublicMember[][]; - users?: { - avatar?: string; - discriminator: string; - id: bigint; - username: string; - bot: boolean; - public_flags: bigint; - }[]; - }; + data: ReadyEventData; } export interface ChannelCreateEvent extends Event { event: "CHANNEL_CREATE"; diff --git a/dist/models/Event.js.map b/dist/models/Event.js.map index bb43d136..1453ecc1 100644 --- a/dist/models/Event.js.map +++ b/dist/models/Event.js.map @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C7C,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/src/models/Event.ts b/src/models/Event.ts index 9d328b00..0a658940 100644 --- a/src/models/Event.ts +++ b/src/models/Event.ts @@ -44,60 +44,62 @@ export interface InvalidatedEvent extends Event { // ! END Custom Events that shouldn't get sent to the client but processed by the server +export interface ReadyEventData { + v: number; + user: Omit; + private_channels: DMChannel[]; // this will be empty for bots + session_id: string; // resuming + guilds: Guild[]; + analytics_token?: string; + connected_accounts?: ConnectedAccount[]; + consents?: { + personalization?: { + consented?: boolean; + }; + }; + country_code?: string; // e.g. DE + friend_suggestion_count?: number; + geo_ordered_rtc_regions?: string[]; // ["europe","russie","india","us-east","us-central"] + experiments?: [number, number, number, number, number][]; + guild_experiments?: [ + // ? what are guild_experiments? + // this is the structure of it: + number, + null, + number, + [[number, { e: number; s: number }[]]], + [number, [[number, [number, number]]]], + { b: number; k: bigint[] }[] + ][]; + guild_join_requests?: []; // ? what is this? this is new + shard?: [number, number]; + user_settings?: UserSettings; + relationships?: []; + user_guild_settings?: { + entries: UserGuildSettings[]; + version: number; + partial: boolean; + }; + application?: { + id: bigint; + flags: bigint; + }; + + merged_members?: PublicMember[][]; // every guild member object for the current user + // probably all users who the user is in contact with + users?: { + avatar?: string; + discriminator: string; + id: bigint; + username: string; + bot: boolean; + public_flags: bigint; + }[]; +} + export interface ReadyEvent extends Event { event: "READY"; - data: { - v: number; - user: Omit; - private_channels: DMChannel[]; // this will be empty for bots - session_id: string; // resuming - guilds: Guild[]; - analytics_token?: string; - connected_accounts?: ConnectedAccount[]; - consents?: { - personalization?: { - consented?: boolean; - }; - }; - country_code?: string; // e.g. DE - friend_suggestion_count?: number; - geo_ordered_rtc_regions?: string[]; // ["europe","russie","india","us-east","us-central"] - experiments?: [number, number, number, number, number][]; - guild_experiments?: [ - // ? what are guild_experiments? - // this is the structure of it: - number, - null, - number, - [[number, { e: number; s: number }[]]], - [number, [[number, [number, number]]]], - { b: number; k: bigint[] }[] - ][]; - guild_join_requests?: []; // ? what is this? this is new - shard?: [number, number]; - user_settings?: UserSettings; - relationships?: []; - user_guild_settings?: { - entries: UserGuildSettings[]; - version: number; - partial: boolean; - }; - application?: { - id: bigint; - flags: bigint; - }; - - merged_members?: PublicMember[][]; // every guild member object for the current user - // probably all users who the user is in contact with - users?: { - avatar?: string; - discriminator: string; - id: bigint; - username: string; - bot: boolean; - public_flags: bigint; - }[]; - }; + data: ReadyEventData; } export interface ChannelCreateEvent extends Event { From 10203787a31ca0221f96fcf4e27dd10efc122218 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 03:55:04 +0200 Subject: [PATCH 05/35] :bug: fix Activity Model --- src/models/Activity.ts | 66 +++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/models/Activity.ts b/src/models/Activity.ts index beaa43e8..bf77856f 100644 --- a/src/models/Activity.ts +++ b/src/models/Activity.ts @@ -14,10 +14,10 @@ export interface Activity { name: string; type: ActivityType; url?: string; - created_at: Date; + created_at?: Date; timestamps?: { - start: number; - end: number; + start?: number; + end?: number; }[]; application_id?: bigint; details?: string; @@ -32,10 +32,10 @@ export interface Activity { size?: [number, number]; }; assets?: { - large_image: string; - large_text: string; - small_image: string; - small_text: string; + large_image?: string; + large_text?: string; + small_image?: string; + small_text?: string; }; secrets?: { join?: string; @@ -49,39 +49,39 @@ export interface Activity { export const Activity = { name: String, type: Number, - url: String, - created_at: Date, - timestamps: [ + $url: String, + $created_at: Date, + $timestamps: [ { - start: Number, - end: Number, + $start: Number, + $end: Number, }, ], - application_id: Types.Long, - details: String, - state: String, - emoji: { - name: String, - id: Types.Long, - amimated: Boolean, + $application_id: Types.Long, + $details: String, + $state: String, + $emoji: { + $name: String, + $id: Types.Long, + $amimated: Boolean, }, - party: { - id: String, - size: [Number, Number], + $party: { + $id: String, + $size: [Number, Number], }, - assets: { - large_image: String, - large_text: String, - small_image: String, - small_text: String, + $assets: { + $large_image: String, + $large_text: String, + $small_image: String, + $small_text: String, }, - secrets: { - join: String, - spectate: String, - match: String, + $secrets: { + $join: String, + $spectate: String, + $match: String, }, - instance: Boolean, - flags: Types.Long, + $instance: Boolean, + $flags: Types.Long, }; export enum ActivityType { From 1def5ff09faf10d9fb102dedf8402e04b5be615b Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 03:55:25 +0200 Subject: [PATCH 06/35] :bug: fix Ready event --- src/models/Event.ts | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/models/Event.ts b/src/models/Event.ts index 0a658940..97da98c0 100644 --- a/src/models/Event.ts +++ b/src/models/Event.ts @@ -1,7 +1,7 @@ -import { ConnectedAccount, User, UserSettings } from "./User"; +import { ConnectedAccount, PublicUser, User, UserSettings } from "./User"; import { DMChannel, Channel } from "./Channel"; import { Guild } from "./Guild"; -import { PublicMember, UserGuildSettings } from "./Member"; +import { Member, PublicMember, UserGuildSettings } from "./Member"; import { Emoji } from "./Emoji"; import { Presence } from "./Activity"; import { Role } from "./Role"; @@ -46,7 +46,19 @@ export interface InvalidatedEvent extends Event { export interface ReadyEventData { v: number; - user: Omit; + user: PublicUser & { + mobile: boolean; + desktop: boolean; + email: string; + flags: bigint; + mfa_enabled: boolean; + nsfw_allowed: boolean; + phone: string; + premium: boolean; + premium_type: number; + verified: boolean; + bot: boolean; + }; private_channels: DMChannel[]; // this will be empty for bots session_id: string; // resuming guilds: Guild[]; @@ -74,7 +86,12 @@ export interface ReadyEventData { guild_join_requests?: []; // ? what is this? this is new shard?: [number, number]; user_settings?: UserSettings; - relationships?: []; + relationships?: []; // TODO + read_state: { + entries: []; // TODO + partial: boolean; + version: number; + }; user_guild_settings?: { entries: UserGuildSettings[]; version: number; @@ -84,8 +101,7 @@ export interface ReadyEventData { id: bigint; flags: bigint; }; - - merged_members?: PublicMember[][]; // every guild member object for the current user + merged_members?: Omit[][]; // probably all users who the user is in contact with users?: { avatar?: string; From 75b690600df1190d0e4527898396cb4f504216ca Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 03:55:46 +0200 Subject: [PATCH 07/35] :sparkles: add Guild virtual fields --- src/models/Guild.ts | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/models/Guild.ts b/src/models/Guild.ts index b25be7aa..a92a60cf 100644 --- a/src/models/Guild.ts +++ b/src/models/Guild.ts @@ -1,5 +1,9 @@ import { Schema, model, Types, Document } from "mongoose"; import db from "../util/Database"; +import { ChannelModel } from "./Channel"; +import { EmojiModel } from "./Emoji"; +import { MemberModel } from "./Member"; +import { RoleModel } from "./Role"; export interface GuildDocument extends Document, Guild { id: bigint; @@ -87,7 +91,43 @@ export const GuildSchema = new Schema({ widget_enabled: Boolean, }); -// GuildSchema.virtual +GuildSchema.virtual("channels", { + ref: ChannelModel, + localField: "id", + foreignField: "guild_id", + justOne: false, +}); +GuildSchema.virtual("roles", { + ref: RoleModel, + localField: "id", + foreignField: "guild_id", + justOne: false, +}); + +// nested populate is needed for member users: https://gist.github.com/yangsu/5312204 +GuildSchema.virtual("members", { + ref: MemberModel, + localField: "id", + foreignField: "member_id", + justOne: false, +}); + +GuildSchema.virtual("emojis", { + ref: EmojiModel, + localField: "id", + foreignField: "guild_id", + justOne: false, +}); + +GuildSchema.virtual("joined_at", { + ref: MemberModel, + localField: "id", + foreignField: "guild_id", + justOne: true, +}).get((member: any, virtual: any, doc: any) => { + console.log("get", member, this); + return member.joined_at; +}); // @ts-ignore export const GuildModel = db.model("Guild", GuildSchema, "guilds"); From 35be87b86795b7ca4a8d7bfab95d399927c82b09 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 03:56:08 +0200 Subject: [PATCH 08/35] :sparkles: save private data in user.user_data --- src/models/User.ts | 71 +++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/src/models/User.ts b/src/models/User.ts index 971e8d20..589c2d09 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -8,7 +8,6 @@ export interface User { username: string; // username max length 32, min 2 discriminator: string; // #0001 4 digit long string from #0001 - #9999 avatar: string | null; // hash of the user avatar - fingerprints: string[]; // array of fingerprints -> used to prevent multiple accounts phone?: string; // phone number of the user desktop: boolean; // if the user has desktop app installed mobile: boolean; // if the user has mobile app installed @@ -16,7 +15,6 @@ export interface User { premium_type: number; // nitro level bot: boolean; // if user is bot system: boolean; // shouldn't be used, the api sents this field type true, if the genetaed message comes from a system generated author - level: string; // organization permission level (owner, moderator, user) nsfw_allowed: boolean; // if the user is older than 18 (resp. Config) mfa_enabled: boolean; // if multi factor authentication is enabled created_at: Date; // registration date @@ -24,12 +22,8 @@ export interface User { email?: string; // email of the user flags: bigint; // UserFlags public_flags: bigint; - hash: string; // hash of the password, salt is saved in password (bcrypt) - guilds: bigint[]; // array of guild ids the user is part of - valid_tokens_since: Date; // all tokens with a previous issue date are invalid user_settings: UserSettings; - relationships: Relationship[]; - connected_accounts: ConnectedAccount[]; + user_data: UserData; presence: { status: Status; activities: Activity[]; @@ -37,6 +31,16 @@ export interface User { }; } +// Privat user data: +export interface UserData { + valid_tokens_since: Date; // all tokens with a previous issue date are invalid + relationships: Relationship[]; + connected_accounts: ConnectedAccount[]; + guilds: bigint[]; // array of guild ids the user is part of + hash: string; // hash of the password, salt is saved in password (bcrypt) + fingerprints: string[]; // array of fingerprints -> used to prevent multiple accounts +} + export interface UserDocument extends User, Document { id: bigint; } @@ -118,7 +122,6 @@ export const UserSchema = new Schema({ username: String, discriminator: String, avatar: String, - fingerprints: [String], phone: String, desktop: Boolean, mobile: Boolean, @@ -133,9 +136,33 @@ export const UserSchema = new Schema({ email: String, flags: Types.Long, // TODO: automatically convert Types.Long to BitField of UserFlags public_flags: Types.Long, - hash: String, // hash of the password, salt is saved in password (bcrypt) - guilds: [Types.Long], // array of guild ids the user is part of - valid_tokens_since: Date, // all tokens with a previous issue date are invalid + 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: [ + { + id: Types.Long, + nickname: String, + type: Number, + user_id: Types.Long, + }, + ], + connected_accounts: [ + { + access_token: String, + friend_sync: Boolean, + id: String, + name: String, + revoked: Boolean, + show_activity: Boolean, + type: String, + verifie: Boolean, + visibility: Number, + }, + ], + }, user_settings: { afk_timeout: Number, allow_accessibility_detection: Boolean, @@ -182,27 +209,7 @@ export const UserSchema = new Schema({ theme: String, // dark timezone_offset: Number, // e.g -60, }, - relationships: [ - { - id: Types.Long, - nickname: String, - type: Number, - user_id: Types.Long, - }, - ], - connected_accounts: [ - { - access_token: String, - friend_sync: Boolean, - id: String, - name: String, - revoked: Boolean, - show_activity: Boolean, - type: String, - verifie: Boolean, - visibility: Number, - }, - ], + presence: { status: String, activities: [Activity], 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: [PATCH 09/35] :bug: fix Database --- dist/models/Activity.d.ts | 66 +++++++++++----------- dist/models/Activity.js | 52 ++++++++--------- dist/models/Activity.js.map | 2 +- dist/models/Event.d.ts | 25 +++++++-- dist/models/Event.js.map | 2 +- dist/models/Guild.js | 39 ++++++++++++- dist/models/Guild.js.map | 2 +- dist/models/User.d.ts | 16 +++--- dist/models/User.js | 52 ++++++++--------- dist/models/User.js.map | 2 +- dist/util/Database.d.ts | 6 +- dist/util/Database.js | 105 ++++++++++++++++++----------------- dist/util/Database.js.map | 2 +- dist/util/Permissions.js | 4 +- dist/util/Permissions.js.map | 2 +- src/util/Database.ts | 58 ++++++++++--------- src/util/Permissions.ts | 4 +- 17 files changed, 255 insertions(+), 184 deletions(-) diff --git a/dist/models/Activity.d.ts b/dist/models/Activity.d.ts index 6a97a871..dfa0815e 100644 --- a/dist/models/Activity.d.ts +++ b/dist/models/Activity.d.ts @@ -12,10 +12,10 @@ export interface Activity { name: string; type: ActivityType; url?: string; - created_at: Date; + created_at?: Date; timestamps?: { - start: number; - end: number; + start?: number; + end?: number; }[]; application_id?: bigint; details?: string; @@ -30,10 +30,10 @@ export interface Activity { size?: [number, number]; }; assets?: { - large_image: string; - large_text: string; - small_image: string; - small_text: string; + large_image?: string; + large_text?: string; + small_image?: string; + small_text?: string; }; secrets?: { join?: string; @@ -46,37 +46,37 @@ export interface Activity { export declare const Activity: { name: StringConstructor; type: NumberConstructor; - url: StringConstructor; - created_at: DateConstructor; - timestamps: { - start: NumberConstructor; - end: NumberConstructor; + $url: StringConstructor; + $created_at: DateConstructor; + $timestamps: { + $start: NumberConstructor; + $end: NumberConstructor; }[]; - application_id: typeof Types.Long; - details: StringConstructor; - state: StringConstructor; - emoji: { - name: StringConstructor; - id: typeof Types.Long; - amimated: BooleanConstructor; + $application_id: typeof Types.Long; + $details: StringConstructor; + $state: StringConstructor; + $emoji: { + $name: StringConstructor; + $id: typeof Types.Long; + $amimated: BooleanConstructor; }; - party: { - id: StringConstructor; - size: NumberConstructor[]; + $party: { + $id: StringConstructor; + $size: NumberConstructor[]; }; - assets: { - large_image: StringConstructor; - large_text: StringConstructor; - small_image: StringConstructor; - small_text: StringConstructor; + $assets: { + $large_image: StringConstructor; + $large_text: StringConstructor; + $small_image: StringConstructor; + $small_text: StringConstructor; }; - secrets: { - join: StringConstructor; - spectate: StringConstructor; - match: StringConstructor; + $secrets: { + $join: StringConstructor; + $spectate: StringConstructor; + $match: StringConstructor; }; - instance: BooleanConstructor; - flags: typeof Types.Long; + $instance: BooleanConstructor; + $flags: typeof Types.Long; }; export declare enum ActivityType { GAME = 0, diff --git a/dist/models/Activity.js b/dist/models/Activity.js index fe85ac65..020856db 100644 --- a/dist/models/Activity.js +++ b/dist/models/Activity.js @@ -5,39 +5,39 @@ const mongoose_1 = require("mongoose"); exports.Activity = { name: String, type: Number, - url: String, - created_at: Date, - timestamps: [ + $url: String, + $created_at: Date, + $timestamps: [ { - start: Number, - end: Number, + $start: Number, + $end: Number, }, ], - application_id: mongoose_1.Types.Long, - details: String, - state: String, - emoji: { - name: String, - id: mongoose_1.Types.Long, - amimated: Boolean, + $application_id: mongoose_1.Types.Long, + $details: String, + $state: String, + $emoji: { + $name: String, + $id: mongoose_1.Types.Long, + $amimated: Boolean, }, - party: { - id: String, - size: [Number, Number], + $party: { + $id: String, + $size: [Number, Number], }, - assets: { - large_image: String, - large_text: String, - small_image: String, - small_text: String, + $assets: { + $large_image: String, + $large_text: String, + $small_image: String, + $small_text: String, }, - secrets: { - join: String, - spectate: String, - match: String, + $secrets: { + $join: String, + $spectate: String, + $match: String, }, - instance: Boolean, - flags: mongoose_1.Types.Long, + $instance: Boolean, + $flags: mongoose_1.Types.Long, }; var ActivityType; (function (ActivityType) { diff --git a/dist/models/Activity.js.map b/dist/models/Activity.js.map index c27ae387..786f0184 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,GAAG,EAAE,MAAM;IACX,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE;QACX;YACC,KAAK,EAAE,MAAM;YACb,GAAG,EAAE,MAAM;SACX;KACD;IACD,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,MAAM;IACb,KAAK,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,gBAAK,CAAC,IAAI;QACd,QAAQ,EAAE,OAAO;KACjB;IACD,KAAK,EAAE;QACN,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;KACtB;IACD,MAAM,EAAE;QACP,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,MAAM;KAClB;IACD,OAAO,EAAE;QACR,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,MAAM;KACb;IACD,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,gBAAK,CAAC,IAAI;CACjB,CAAC;AAEF,IAAY,YAMX;AAND,WAAY,YAAY;IACvB,+CAAQ,CAAA;IACR,yDAAa,CAAA;IACb,yDAAa,CAAA;IACb,mDAAU,CAAA;IACV,yDAAa,CAAA;AACd,CAAC,EANW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAMvB"} \ No newline at end of file +{"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 diff --git a/dist/models/Event.d.ts b/dist/models/Event.d.ts index e4a1517b..e00c2a97 100644 --- a/dist/models/Event.d.ts +++ b/dist/models/Event.d.ts @@ -1,8 +1,8 @@ /// -import { ConnectedAccount, User, UserSettings } from "./User"; +import { ConnectedAccount, PublicUser, User, UserSettings } from "./User"; import { DMChannel, Channel } from "./Channel"; import { Guild } from "./Guild"; -import { PublicMember, UserGuildSettings } from "./Member"; +import { Member, PublicMember, UserGuildSettings } from "./Member"; import { Emoji } from "./Emoji"; import { Presence } from "./Activity"; import { Role } from "./Role"; @@ -29,7 +29,19 @@ export interface InvalidatedEvent extends Event { } export interface ReadyEventData { v: number; - user: Omit; + user: PublicUser & { + mobile: boolean; + desktop: boolean; + email: string; + flags: bigint; + mfa_enabled: boolean; + nsfw_allowed: boolean; + phone: string; + premium: boolean; + premium_type: number; + verified: boolean; + bot: boolean; + }; private_channels: DMChannel[]; session_id: string; guilds: Guild[]; @@ -67,6 +79,11 @@ export interface ReadyEventData { shard?: [number, number]; user_settings?: UserSettings; relationships?: []; + read_state: { + entries: []; + partial: boolean; + version: number; + }; user_guild_settings?: { entries: UserGuildSettings[]; version: number; @@ -76,7 +93,7 @@ export interface ReadyEventData { id: bigint; flags: bigint; }; - merged_members?: PublicMember[][]; + merged_members?: Omit[][]; users?: { avatar?: string; discriminator: string; diff --git a/dist/models/Event.js.map b/dist/models/Event.js.map index 1453ecc1..268c8597 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;AAkXlF,+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,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,IA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..6a8adfc5 100644 --- a/dist/models/Guild.js +++ b/dist/models/Guild.js @@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.GuildModel = exports.GuildSchema = void 0; const mongoose_1 = require("mongoose"); const Database_1 = __importDefault(require("../util/Database")); +const Channel_1 = require("./Channel"); +const Emoji_1 = require("./Emoji"); +const Member_1 = require("./Member"); +const Role_1 = require("./Role"); exports.GuildSchema = new mongoose_1.Schema({ id: { type: mongoose_1.Types.Long, required: true }, afk_channel_id: mongoose_1.Types.Long, @@ -44,7 +48,40 @@ exports.GuildSchema = new mongoose_1.Schema({ widget_channel_id: mongoose_1.Types.Long, widget_enabled: Boolean, }); -// GuildSchema.virtual +exports.GuildSchema.virtual("channels", { + ref: Channel_1.ChannelModel, + localField: "id", + foreignField: "guild_id", + justOne: false, +}); +exports.GuildSchema.virtual("roles", { + ref: Role_1.RoleModel, + localField: "id", + foreignField: "guild_id", + justOne: false, +}); +// nested populate is needed for member users: https://gist.github.com/yangsu/5312204 +exports.GuildSchema.virtual("members", { + ref: Member_1.MemberModel, + localField: "id", + foreignField: "member_id", + justOne: false, +}); +exports.GuildSchema.virtual("emojis", { + ref: Emoji_1.EmojiModel, + localField: "id", + foreignField: "guild_id", + justOne: false, +}); +exports.GuildSchema.virtual("joined_at", { + ref: Member_1.MemberModel, + localField: "id", + foreignField: "guild_id", + justOne: true, +}).get((member, virtual, doc) => { + console.log("get", member, this); + return member.joined_at; +}); // @ts-ignore exports.GuildModel = Database_1.default.model("Guild", exports.GuildSchema, "guilds"); //# sourceMappingURL=Guild.js.map \ No newline at end of file diff --git a/dist/models/Guild.js.map b/dist/models/Guild.js.map index 580db503..e64d6c61 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;AAiDrB,QAAA,WAAW,GAAG,I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B,YAAY,EAAE,WAAW;IACzB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,mBAAW,CAAC,OAAO,CAAC,QAAQ,EAAE;IAC7B,GAAG,EAAE,kBAAU;IACf,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,UAAU;IACxB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,mBAAW,CAAC,OAAO,CAAC,WAAW,EAAE;IAChC,GAAG,EAAE,oBAAW;IAChB,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,UAAU;IACxB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,OAAY,EAAE,GAAQ,EAAE,EAAE;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,SAAS,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAgB,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/User.d.ts b/dist/models/User.d.ts index adf6613f..2265c0a1 100644 --- a/dist/models/User.d.ts +++ b/dist/models/User.d.ts @@ -7,7 +7,6 @@ export interface User { username: string; discriminator: string; avatar: string | null; - fingerprints: string[]; phone?: string; desktop: boolean; mobile: boolean; @@ -15,7 +14,6 @@ export interface User { premium_type: number; bot: boolean; system: boolean; - level: string; nsfw_allowed: boolean; mfa_enabled: boolean; created_at: Date; @@ -23,18 +21,22 @@ export interface User { email?: string; flags: bigint; public_flags: bigint; - hash: string; - guilds: bigint[]; - valid_tokens_since: Date; user_settings: UserSettings; - relationships: Relationship[]; - connected_accounts: ConnectedAccount[]; + user_data: UserData; presence: { status: Status; activities: Activity[]; client_status: ClientStatus; }; } +export interface UserData { + valid_tokens_since: Date; + relationships: Relationship[]; + connected_accounts: ConnectedAccount[]; + guilds: bigint[]; + hash: string; + fingerprints: string[]; +} export interface UserDocument extends User, Document { id: bigint; } diff --git a/dist/models/User.js b/dist/models/User.js index e40df925..f6734de4 100644 --- a/dist/models/User.js +++ b/dist/models/User.js @@ -13,7 +13,6 @@ exports.UserSchema = new mongoose_1.Schema({ username: String, discriminator: String, avatar: String, - fingerprints: [String], phone: String, desktop: Boolean, mobile: Boolean, @@ -28,9 +27,33 @@ exports.UserSchema = new mongoose_1.Schema({ email: String, flags: mongoose_1.Types.Long, public_flags: mongoose_1.Types.Long, - hash: String, - guilds: [mongoose_1.Types.Long], - valid_tokens_since: Date, + user_data: { + fingerprints: [String], + hash: String, + guilds: [mongoose_1.Types.Long], + valid_tokens_since: Date, + relationships: [ + { + id: mongoose_1.Types.Long, + nickname: String, + type: Number, + user_id: mongoose_1.Types.Long, + }, + ], + connected_accounts: [ + { + access_token: String, + friend_sync: Boolean, + id: String, + name: String, + revoked: Boolean, + show_activity: Boolean, + type: String, + verifie: Boolean, + visibility: Number, + }, + ], + }, user_settings: { afk_timeout: Number, allow_accessibility_detection: Boolean, @@ -77,27 +100,6 @@ exports.UserSchema = new mongoose_1.Schema({ theme: String, timezone_offset: Number, }, - relationships: [ - { - id: mongoose_1.Types.Long, - nickname: String, - type: Number, - user_id: mongoose_1.Types.Long, - }, - ], - connected_accounts: [ - { - access_token: String, - friend_sync: Boolean, - id: String, - name: String, - revoked: Boolean, - show_activity: Boolean, - type: String, - verifie: Boolean, - visibility: Number, - }, - ], presence: { status: String, activities: [Activity_1.Activity], diff --git a/dist/models/User.js.map b/dist/models/User.js.map index 5d5e5b10..47442401 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;AAgHrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,gBAAK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C,gBAAK,CAAC,IAAI,CAAC;gBACvB,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,MAAM;aACZ;SACD;QACD,eAAe,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;QAC7B,uBAAuB,EAAE,OAAO;QAChC,kBAAkB,EAAE,OAAO;QAC3B,MAAM,EAAE,MAAM;QACd,uBAAuB,EAAE,OAAO;QAChC,gCAAgC,EAAE,OAAO;QACzC,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;QAC/B,iBAAiB,EAAE,OAAO;QAC1B,MAAM,EAAE,MAAM;QACd,4BAA4B,EAAE,OAAO;QACrC,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;KACvB;IACD,aAAa,EAAE;QACd;YACC,EAAE,EAAE,gBAAK,CAAC,IAAI;YACd,QAAQ,EAAE,MAAM;YAChB,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,gBAAK,CAAC,IAAI;SACnB;KACD;IACD,kBAAkB,EAAE;QACnB;YACC,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,OAAO;YACpB,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO;YAChB,aAAa,EAAE,OAAO;YACtB,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO;YAChB,UAAU,EAAE,MAAM;SAClB;KACD;IACD,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,CAAC,mBAAQ,CAAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AAC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K,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/util/Database.d.ts b/dist/util/Database.d.ts index dcb9bc90..766efaef 100644 --- a/dist/util/Database.d.ts +++ b/dist/util/Database.d.ts @@ -22,8 +22,8 @@ export declare class MongooseCache extends EventEmitter { constructor(collection: Collection, pipeline: Array>, opts: { onlyEvents: boolean; }); - init(): Promise; - convertResult(obj: any): any; + init: () => Promise; + convertResult: (obj: any) => any; change: (doc: ChangeEvent) => boolean | Promise | undefined; - destroy(): Promise | undefined; + destroy: () => Promise | undefined; } diff --git a/dist/util/Database.js b/dist/util/Database.js index 01b1b57c..6f8d284d 100644 --- a/dist/util/Database.js +++ b/dist/util/Database.js @@ -17,58 +17,63 @@ class MongooseCache extends events_1.default { this.collection = collection; this.pipeline = pipeline; this.opts = opts; - this.change = (doc) => { - // @ts-ignore - if (doc.fullDocument) { - // @ts-ignore - if (!this.opts.onlyEvents) - this.data = doc.fullDocument; - } - switch (doc.operationType) { - case "dropDatabase": - return this.destroy(); - case "drop": - return this.destroy(); - case "delete": - return this.emit("delete", doc.documentKey._id.toHexString()); - case "insert": - return this.emit("insert", doc.fullDocument); - case "update": - case "replace": - return this.emit("change", doc.fullDocument); - case "invalidate": - return this.destroy(); - default: - return; + this.init = async () => { + this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" }); + this.stream.on("change", this.change); + this.stream.on("close", this.destroy); + this.stream.on("error", console.error); + if (!this.opts.onlyEvents) { + const arr = await this.collection.aggregate(this.pipeline).toArray(); + this.data = arr.length ? arr[0] : arr; } }; - } - async init() { - this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" }); - this.stream.on("change", this.change); - this.stream.on("close", this.destroy); - this.stream.on("error", console.error); - if (!this.opts.onlyEvents) { - const arr = await this.collection.aggregate(this.pipeline).toArray(); - this.data = arr.length ? arr[0] : arr; - } - } - convertResult(obj) { - if (obj instanceof mongodb_1.Long) - return BigInt(obj.toString()); - if (typeof obj === "object") { - Object.keys(obj).forEach((key) => { - obj[key] = this.convertResult(obj[key]); - }); - } - return obj; - } - destroy() { - this.stream.off("change", this.change); - this.emit("close"); - if (this.stream.isClosed()) - return; - return this.stream.close(); + this.convertResult = (obj) => { + if (obj instanceof mongodb_1.Long) + return BigInt(obj.toString()); + if (typeof obj === "object") { + Object.keys(obj).forEach((key) => { + obj[key] = this.convertResult(obj[key]); + }); + } + return obj; + }; + this.change = (doc) => { + try { + // @ts-ignore + if (doc.fullDocument) { + // @ts-ignore + if (!this.opts.onlyEvents) + this.data = doc.fullDocument; + } + switch (doc.operationType) { + case "dropDatabase": + return this.destroy(); + case "drop": + return this.destroy(); + case "delete": + return this.emit("delete", doc.documentKey._id.toHexString()); + case "insert": + return this.emit("insert", doc.fullDocument); + case "update": + case "replace": + return this.emit("change", doc.fullDocument); + case "invalidate": + return this.destroy(); + default: + return; + } + } + catch (error) { + this.emit("error", error); + } + }; + this.destroy = () => { + this.stream?.off("change", this.change); + this.emit("close"); + if (this.stream.isClosed()) + return; + return this.stream.close(); + }; } } exports.MongooseCache = MongooseCache; diff --git a/dist/util/Database.js.map b/dist/util/Database.js.map index 7dacb4cd..f31cb665 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,E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,OAAO;iBACR;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;aAC1B;QACF,CAAC,CAAC;QAEF,YAAO,GAAG,GAAG,EAAE;YACd,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEnB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAAE,OAAO;YAEnC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC,CAAC;IA/DF,CAAC;CAgED;AA5ED,sCA4EC"} \ No newline at end of file diff --git a/dist/util/Permissions.js b/dist/util/Permissions.js index dfa2ea74..c170f3f9 100644 --- a/dist/util/Permissions.js +++ b/dist/util/Permissions.js @@ -96,7 +96,9 @@ async function getPermission(user_id, guild_id, channel_id, cache) { member = await Member_1.MemberModel.findOne({ guild_id, id: user_id }, "roles").exec(); if (!member) throw new Error("Member not found"); - var roles = await Role_1.RoleModel.find({ guild_id, id: { $in: member.roles } }).exec(); + var roles = await Role_1.RoleModel.find({ guild_id, id: { $in: member.roles } }) + .lean() + .exec(); if (channel_id) { channel = await Channel_1.ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec(); } diff --git a/dist/util/Permissions.js.map b/dist/util/Permissions.js.map index 39a64586..14774970 100644 --- a/dist/util/Permissions.js.map +++ b/dist/util/Permissions.js.map @@ -1 +1 @@ -{"version":3,"file":"Permissions.js","sourceRoot":"","sources":["../../src/util/Permissions.ts"],"names":[],"mappings":";;;AAAA,8EAA8E;AAC9E,8DAA8D;AAC9D,6CAA+D;AAC/D,+CAAkE;AAElE,yCAAiD;AACjD,yCAAsC;AACtC,2CAA4D;AAqC5D,MAAM,wBAAwB,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,qEAAqE;AAEjH,MAAa,WA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,IAAI,EAAE;SACN,IAAI,EAAE,CAAC;IACT,IAAI,UAAU,EAAE;QACf,OAAO,GAAG,MAAM,sBAAY,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,uBAAuB,CAAC,CAAC,IAAI,EAAE,CAAC;KACzF;IAED,IAAI,UAAU,GAAG,WAAW,CAAC,eAAe,CAAC;QAC5C,IAAI,EAAE;YACL,EAAE,EAAE,OAAO;YACX,KAAK,EAAE,MAAM,CAAC,KAAK;SACnB;QACD,KAAK,EAAE;YACN,KAAK,EAAE,KAAK;SACZ;QACD,OAAO,EAAE;YACR,UAAU,EAAE,OAAO,EAAE,qBAAqB;SAC1C;KACD,CAAC,CAAC;IAEH,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC;AApCD,sCAoCC"} \ No newline at end of file diff --git a/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(); } From 770b07400e282c5e06fe0638d791139e3984f50f Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 04:04:14 +0200 Subject: [PATCH 10/35] :rewind: revert guilds in user_data --- dist/models/User.d.ts | 2 +- src/models/User.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/models/User.d.ts b/dist/models/User.d.ts index 2265c0a1..f7f9e684 100644 --- a/dist/models/User.d.ts +++ b/dist/models/User.d.ts @@ -22,6 +22,7 @@ export interface User { flags: bigint; public_flags: bigint; user_settings: UserSettings; + guilds: bigint[]; user_data: UserData; presence: { status: Status; @@ -33,7 +34,6 @@ export interface UserData { valid_tokens_since: Date; relationships: Relationship[]; connected_accounts: ConnectedAccount[]; - guilds: bigint[]; hash: string; fingerprints: string[]; } diff --git a/src/models/User.ts b/src/models/User.ts index 589c2d09..eb6a4182 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -23,6 +23,7 @@ export interface User { flags: bigint; // UserFlags public_flags: bigint; user_settings: UserSettings; + guilds: bigint[]; // array of guild ids the user is part of user_data: UserData; presence: { status: Status; @@ -36,7 +37,6 @@ export interface UserData { valid_tokens_since: Date; // all tokens with a previous issue date are invalid relationships: Relationship[]; connected_accounts: ConnectedAccount[]; - guilds: bigint[]; // array of guild ids the user is part of hash: string; // hash of the password, salt is saved in password (bcrypt) fingerprints: string[]; // array of fingerprints -> used to prevent multiple accounts } From 6fbfcac1ba72ad123700824535c1e076190f4630 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 04:30:24 +0200 Subject: [PATCH 11/35] :sparkles: add date of birth to user --- dist/models/User.d.ts | 1 + dist/models/User.js | 1 + dist/models/User.js.map | 2 +- src/models/User.ts | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dist/models/User.d.ts b/dist/models/User.d.ts index f7f9e684..109dd177 100644 --- a/dist/models/User.d.ts +++ b/dist/models/User.d.ts @@ -12,6 +12,7 @@ export interface User { mobile: boolean; premium: boolean; premium_type: number; + date_of_birth: Date; bot: boolean; system: boolean; nsfw_allowed: boolean; diff --git a/dist/models/User.js b/dist/models/User.js index f6734de4..9384d10b 100644 --- a/dist/models/User.js +++ b/dist/models/User.js @@ -17,6 +17,7 @@ exports.UserSchema = new mongoose_1.Schema({ desktop: Boolean, mobile: Boolean, premium: Boolean, + date_of_birth: Date, premium_type: Number, bot: Boolean, system: Boolean, diff --git a/dist/models/User.js.map b/dist/models/User.js.map index 47442401..76e43b41 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":";;;;;;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kBAAE,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,SAAS,EAAE;QACV,YAAY,EAAE,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;QACpB,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;g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AM;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/src/models/User.ts b/src/models/User.ts index eb6a4182..fb914fa0 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -13,6 +13,7 @@ export interface User { mobile: boolean; // if the user has mobile app installed premium: boolean; // if user bought nitro premium_type: number; // nitro level + date_of_birth: Date; bot: boolean; // if user is bot system: boolean; // shouldn't be used, the api sents this field type true, if the genetaed message comes from a system generated author nsfw_allowed: boolean; // if the user is older than 18 (resp. Config) @@ -126,6 +127,7 @@ export const UserSchema = new Schema({ desktop: Boolean, mobile: Boolean, premium: Boolean, + date_of_birth: Date, premium_type: Number, bot: Boolean, system: Boolean, 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: [PATCH 12/35] :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(-) 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,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,SAAS,EAAE;QACV,YAAY,EAAE,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;QACpB,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;gBACtB,IAA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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 +{"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,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iB,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;QAC/B,iBAAiB,EAAE,OAAO;QAC1B,MAAM,EAAE,MAAM;QACd,4BAA4B,EAAE,OAAO;QACrC,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;KACvB;IAED,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,CAAC,mBAAQ,CAAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/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,UAA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D,KAAK,QAAQ;wBACZ,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC9C,KAAK,QAAQ,CAAC;oBACd,KAAK,SAAS;wBACb,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC9C,KAAK,YAAY;wBAChB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;oBACvB;wBACC,OAAO;iBACR;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;aAC1B;QACF,CAAC,CAAC;QAEF,YAAO,GAAG,GAAG,EAAE;YACd,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEnB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAAE,OAAO;YAEnC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC,CAAC;IA/DF,CAAC;CAgED;AA5ED,sCA4EC"} \ No newline at end of file diff --git a/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; 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: [PATCH 13/35] :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(-) 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":["../../src/models/AuditLog.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAiGrB,QAAA,eAAe,GAAG;IAC9B,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,MAAM;IACnB,qBAAqB,EAAE,MAAM;IAC7B,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,MAAM;IACxB,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,WAAW,EAAE,MAAM;IACnB,gBAAgB,EAAE,gBAAK,CAAC,IAAI;IAC5B,yBAAyB,EAAE,gBAAK,CAAC,IAAI;IACrC,SAAS,EAAE,MAAM;IACjB,kBAAkB,EAAE,MAAM;IAC1B,uBAAuB,EAAE,MAAM;IAC/B,6BAA6B,EAAE,MAAM;IACrC,eAAe,EAAE,MAAM;IACvB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,iBAAiB,EAAE,MAAM;IACzB,cAAc,EAAE,OAAO;IACvB,iBAAiB,EAAE,gBAAK,CAAC,IAAI;IAC7B,iBAAiB,EAAE,gBAAK,CAAC,IAAI;IAC7B,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,MAAM;IACf,qBAAqB,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAI,EAAE,OAAO;IACb,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,mBAAmB,EAAE,MAAM;IAC3B,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,OAAO;IACpB,KAAK,EAAE,MAA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;AACA,QAAA,aAAa,GAAG,kBAAE,CAAC,KAAK,CAAkB,UAAU,EAAE,sBAAc,EAAE,WAAW,CAAC,CAAC;AAEhG,IAAY,cAoCX;AApCD,WAAY,cAAc;IACzB,mEAAgB,CAAA;IAChB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,4FAA6B,CAAA;IAC7B,4FAA6B,CAAA;IAC7B,4FAA6B,CAAA;IAC7B,kEAAgB,CAAA;IAChB,oEAAiB,CAAA;IACjB,wEAAmB,CAAA;IACnB,8EAAsB,CAAA;IACtB,sEAAkB,CAAA;IAClB,gFAAuB,CAAA;IACvB,kEAAgB,CAAA;IAChB,8EAAsB,CAAA;IACtB,0DAAY,CAAA;IACZ,kEAAgB,CAAA;IAChB,kEAAgB,CAAA;IAChB,kEAAgB,CAAA;IAChB,sEAAkB,CAAA;IAClB,sEAAkB,CAAA;IAClB,sEAAkB,CAAA;IAClB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,oEAAiB,CAAA;IACjB,oEAAiB,CAAA;IACjB,oEAAiB,CAAA;IACjB,wEAAmB,CAAA;IACnB,kFAAwB,CAAA;IACxB,kEAAgB,CAAA;IAChB,sEAAkB,CAAA;IAClB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;AACxB,CAAC,EApCW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAoCzB"} \ No newline at end of file +{"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;IACh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AA;IACnB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,oEAAiB,CAAA;IACjB,oEAAiB,CAAA;IACjB,oEAAiB,CAAA;IACjB,wEAAmB,CAAA;IACnB,kFAAwB,CAAA;IACxB,kEAAgB,CAAA;IAChB,sEAAkB,CAAA;IAClB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;AACxB,CAAC,EApCW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAoCzB"} \ No newline at end of file diff --git a/dist/models/Ban.d.ts b/dist/models/Ban.d.ts 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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AY,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 +{"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,2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A;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,QAA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AAO,EAAE,IAAI;CACb,CAAC,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,OAAY,EAAE,GAAQ,EAAE,EAAE;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,SAAS,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAgB,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Interaction.d.ts b/dist/models/Interaction.d.ts 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,QAA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,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,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;IACj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;AAEH,qBAAa,CAAC,OAAO,CAAC,UAAU,EAAE;IACjC,GAAG,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 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":";;;;;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a;AACA,QAAA,SAAS,GAAG,kBAAE,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,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,OAAO;IAChB,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,MAAM,CAAC;IAChB,SAAS,EAAE;QACV,YAAY,EAAE,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM;QACZ,kBAAkB,EAAE,IAAI;QACxB,aAAa,EAAE;YACd;gBACC,EAAE,EAAE,MAAM;gBACV,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,MAAM;aACf;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;gBACtB,IAAI,EAAE,MAAM;gBACZ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AAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/VoiceState.d.ts b/dist/models/VoiceState.d.ts 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(); } /** From 35da56a905da28d8114225f2cec2b2c7a4166de6 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 18:03:37 +0200 Subject: [PATCH 14/35] :wrench: build --- dist/util/Snowflake.d.ts | 2 +- dist/util/Snowflake.js | 2 +- dist/util/Snowflake.js.map | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/util/Snowflake.d.ts b/dist/util/Snowflake.d.ts index bd8c05bb..06e98492 100644 --- a/dist/util/Snowflake.d.ts +++ b/dist/util/Snowflake.d.ts @@ -32,7 +32,7 @@ export declare class Snowflake { * @private */ static binaryToID(num: any): string; - static generate(): bigint; + static generate(): string; /** * A deconstructed snowflake. * @typedef {Object} DeconstructedSnowflake diff --git a/dist/util/Snowflake.js b/dist/util/Snowflake.js index 78373e95..1217b0c8 100644 --- a/dist/util/Snowflake.js +++ b/dist/util/Snowflake.js @@ -73,7 +73,7 @@ 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(); } /** * A deconstructed snowflake. diff --git a/dist/util/Snowflake.js.map b/dist/util/Snowflake.js.map index 9d4b3195..df2df3f6 100644 --- a/dist/util/Snowflake.js.map +++ b/dist/util/Snowflake.js.map @@ -1 +1 @@ -{"version":3,"file":"Snowflake.js","sourceRoot":"","sources":["../../src/util/Snowflake.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,4EAA4E;AAC5E,8DAA8D;AAC9D,YAAY,CAAC;;;AAEb,2CAA2C;AAE3C;;GAEG;AACH,MAAa,SAAS;IAMrB;QACC,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,iCAAiC,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;;;;;OAUG;IAEH;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG;QACpB,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,IAAI,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACnC,OAAO,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE;YAC3B,GAAG,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;YAC5B,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;YAC1B,IAAI,IAAI,GAAG,CAAC,EAAE;gBACb,GAAG,IAAI,UAAU,GAAG,CAAC,IAAI,GAAG,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mBAAS,GAAG,EAAE,CAAC,CAAC,SAAS;AACzB,kBAAQ,GAAG,EAAE,CAAC,CAAC,SAAS"} \ No newline at end of file From 3205dc6f6080422b8d2f727fe9e4573b493ffbb1 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 18:05:22 +0200 Subject: [PATCH 15/35] remove date_of_birth as discord only saves if someone is older than 18 years (nsfw_allowed) --- dist/models/User.d.ts | 1 - dist/models/User.js.map | 2 +- src/models/User.ts | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dist/models/User.d.ts b/dist/models/User.d.ts index ae101061..b5ecf123 100644 --- a/dist/models/User.d.ts +++ b/dist/models/User.d.ts @@ -12,7 +12,6 @@ export interface User { mobile: boolean; premium: boolean; premium_type: number; - date_of_birth: Date; bot: boolean; system: boolean; nsfw_allowed: boolean; diff --git a/dist/models/User.js.map b/dist/models/User.js.map index d57da8db..a13c6c39 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,EAAE,EAAE,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,OAAO;IAChB,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,M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gBACb,SAAS,EAAE,CAAC,MAAM,CAAC;gBACnB,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,MAAM;aACZ;SACD;QACD,eAAe,EAAE,CAAC,MAAM,CAAC;QACzB,uBAAuB,EAAE,OAAO;QAChC,kBAAkB,EAAE,OAAO;QAC3B,MAAM,EAAE,MAAM;QACd,uBAAuB,EAAE,OAAO;QAChC,gCAAgC,EAAE,OAAO;QACzC,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,CAAC,MAAM,CAAC;QAC3B,iBAAiB,EAAE,OAAO;QAC1B,MAAM,EAAE,MAAM;QACd,4BAA4B,EAAE,OAAO;QACrC,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;KACvB;IAED,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,CAAC,mBAAQ,CAAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AACtC,qCAAgD;AAChD,uCAAmD;AACnD,gEAAkC;AAoHrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,OAAO;IAChB,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,MAAM;IACpB,GAAG,EAAE,OAAO;IACZ,MAAM,EAAE,OAAO;IACf,YAAY,EAAE,OAAO;IACrB,WAAW,EAAE,OAAO;IACpB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;QACtB,6CAA6C;QAC7C,aAAa,EAAE;YACd;gBACC,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,CAAC,MAAM,CAAC;gBACnB,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,MAAM;aACZ;SACD;QACD,eAAe,EAAE,CAAC,MAAM,CAAC;QACzB,uBAAuB,EAAE,OAAO;QAChC,kBAAkB,EAAE,OAAO;QAC3B,MAAM,EAAE,MAAM;QACd,uBAAuB,EAAE,OAAO;QAChC,gCAAgC,EAAE,OAAO;QACzC,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,CAAC,MAAM,CAAC;QAC3B,iBAAiB,EAAE,OAAO;QAC1B,MAAM,EAAE,MAAM;QACd,4BAA4B,EAAE,OAAO;QACrC,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;KACvB;IAED,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,CAAC,mBAAQ,CAAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/src/models/User.ts b/src/models/User.ts index 7173e9a3..1ea55f6a 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -13,7 +13,6 @@ export interface User { mobile: boolean; // if the user has mobile app installed premium: boolean; // if user bought nitro premium_type: number; // nitro level - date_of_birth: Date; bot: boolean; // if user is bot system: boolean; // shouldn't be used, the api sents this field type true, if the genetaed message comes from a system generated author nsfw_allowed: boolean; // if the user is older than 18 (resp. Config) From 41e72689476c639aa686074c9bb22d1cb04a6fc4 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 20:24:58 +0200 Subject: [PATCH 16/35] :bug: fix Message Model --- dist/models/Message.js | 8 ++++---- dist/models/Message.js.map | 2 +- dist/models/User.js | 1 - dist/models/User.js.map | 2 +- src/models/Message.ts | 8 ++++---- src/models/User.ts | 1 - 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dist/models/Message.js b/dist/models/Message.js index 1adca30c..18bb509d 100644 --- a/dist/models/Message.js +++ b/dist/models/Message.js @@ -134,19 +134,19 @@ exports.MessageSchema.virtual("mentions", { ref: User_1.UserModel, localField: "mention_user_ids", foreignField: "id", - justOne: true, + justOne: false, }); exports.MessageSchema.virtual("mention_roles", { ref: Role_1.RoleModel, localField: "mention_role_ids", foreignField: "id", - justOne: true, + justOne: false, }); exports.MessageSchema.virtual("mention_channels", { ref: Role_1.RoleModel, - localField: "mention_role_ids", + localField: "mention_channel_ids", foreignField: "id", - justOne: true, + justOne: false, }); // TODO: missing Application Model // MessageSchema.virtual("application", { diff --git a/dist/models/Message.js.map b/dist/models/Message.js.map index e4387a0e..2e617b31 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,QAk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AE,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,QAkBtB;AAsEY,QAAA,UAAU,GAAG;IACzB,EAAE,EAAE,MAAM;IACV,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AAa,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/User.js b/dist/models/User.js index 3ba04503..e8caec6a 100644 --- a/dist/models/User.js +++ b/dist/models/User.js @@ -17,7 +17,6 @@ exports.UserSchema = new mongoose_1.Schema({ desktop: Boolean, mobile: Boolean, premium: Boolean, - date_of_birth: Date, premium_type: Number, bot: Boolean, system: Boolean, diff --git a/dist/models/User.js.map b/dist/models/User.js.map index a13c6c39..fa26f77a 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;AAoHrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,OAAO;IAChB,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE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AAM;QAC/B,mBAAmB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;QACrC,iBAAiB,EAAE,OAAO;QAC1B,aAAa,EAAE,OAAO;QACtB,6CAA6C;QAC7C,aAAa,EAAE;YACd;gBACC,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,CAAC,MAAM,CAAC;gBACnB,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,MAAM;aACZ;SACD;QACD,eAAe,EAAE,CAAC,MAAM,CAAC;QACzB,uBAAuB,EAAE,OAAO;QAChC,kBAAkB,EAAE,OAAO;QAC3B,MAAM,EAAE,MAAM;QACd,uBAAuB,EAAE,OAAO;QAChC,gCAAgC,EAAE,OAAO;QACzC,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,CAAC,MAAM,CAAC;QAC3B,iBAAiB,EAAE,OAAO;QAC1B,MAAM,EAAE,MAAM;QACd,4BAA4B,EAAE,OAAO;QACrC,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;KACvB;IAED,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,CAAC,mBAAQ,CAAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AACtC,qCAAgD;AAChD,uCAAmD;AACnD,gEAAkC;AAoHrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,OAAO;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AkB,EAAE,OAAO;QAC3B,uBAAuB,EAAE,MAAM;QAC/B,mBAAmB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;QACrC,iBAAiB,EAAE,OAAO;QAC1B,aAAa,EAAE,OAAO;QACtB,6CAA6C;QAC7C,aAAa,EAAE;YACd;gBACC,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,CAAC,MAAM,CAAC;gBACnB,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,MAAM;aACZ;SACD;QACD,eAAe,EAAE,CAAC,MAAM,CAAC;QACzB,uBAAuB,EAAE,OAAO;QAChC,kBAAkB,EAAE,OAAO;QAC3B,MAAM,EAAE,MAAM;QACd,uBAAuB,EAAE,OAAO;QAChC,gCAAgC,EAAE,OAAO;QACzC,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,CAAC,MAAM,CAAC;QAC3B,iBAAiB,EAAE,OAAO;QAC1B,MAAM,EAAE,MAAM;QACd,4BAA4B,EAAE,OAAO;QACrC,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;KACvB;IAED,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,CAAC,mBAAQ,CAAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/src/models/Message.ts b/src/models/Message.ts index 4adf8024..bb3c2d5b 100644 --- a/src/models/Message.ts +++ b/src/models/Message.ts @@ -242,21 +242,21 @@ MessageSchema.virtual("mentions", { ref: UserModel, localField: "mention_user_ids", foreignField: "id", - justOne: true, + justOne: false, }); MessageSchema.virtual("mention_roles", { ref: RoleModel, localField: "mention_role_ids", foreignField: "id", - justOne: true, + justOne: false, }); MessageSchema.virtual("mention_channels", { ref: RoleModel, - localField: "mention_role_ids", + localField: "mention_channel_ids", foreignField: "id", - justOne: true, + justOne: false, }); // TODO: missing Application Model diff --git a/src/models/User.ts b/src/models/User.ts index 1ea55f6a..76251e09 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -126,7 +126,6 @@ export const UserSchema = new Schema({ desktop: Boolean, mobile: Boolean, premium: Boolean, - date_of_birth: Date, premium_type: Number, bot: Boolean, system: Boolean, From 0e8356e9b1acd95be5b94f0e55bba9d749a36d12 Mon Sep 17 00:00:00 2001 From: afeuerstein <32029275+afeuerstein@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:32:44 +0200 Subject: [PATCH 17/35] remove compiled typescript code from repo --- .gitignore | 3 + dist/index.d.ts | 27 --- dist/index.js | 56 ----- dist/index.js.map | 1 - dist/models/Activity.d.ts | 87 ------- dist/models/Activity.js | 50 ---- dist/models/Activity.js.map | 1 - dist/models/Application.d.ts | 39 --- dist/models/Application.js | 15 -- dist/models/Application.js.map | 1 - dist/models/AuditLog.d.ts | 187 --------------- dist/models/AuditLog.js | 129 ---------- dist/models/AuditLog.js.map | 1 - dist/models/Ban.d.ts | 11 - dist/models/Ban.js | 18 -- dist/models/Ban.js.map | 1 - dist/models/Channel.d.ts | 55 ----- dist/models/Channel.js | 50 ---- dist/models/Channel.js.map | 1 - dist/models/Emoji.d.ts | 15 -- dist/models/Emoji.js | 22 -- dist/models/Emoji.js.map | 1 - dist/models/Event.d.ts | 417 --------------------------------- dist/models/Event.js | 63 ----- dist/models/Event.js.map | 1 - dist/models/Guild.d.ts | 44 ---- dist/models/Guild.js | 87 ------- dist/models/Guild.js.map | 1 - dist/models/Interaction.d.ts | 28 --- dist/models/Interaction.js | 17 -- dist/models/Interaction.js.map | 1 - dist/models/Invite.d.ts | 17 -- dist/models/Invite.js | 25 -- dist/models/Invite.js.map | 1 - dist/models/Member.d.ts | 43 ---- dist/models/Member.js | 50 ---- dist/models/Member.js.map | 1 - dist/models/Message.d.ts | 181 -------------- dist/models/Message.js | 160 ------------- dist/models/Message.js.map | 1 - dist/models/Role.d.ts | 21 -- dist/models/Role.js | 25 -- dist/models/Role.js.map | 1 - dist/models/Status.d.ts | 11 - dist/models/Status.js | 9 - dist/models/Status.js.map | 1 - dist/models/User.d.ts | 113 --------- dist/models/User.js | 111 --------- dist/models/User.js.map | 1 - dist/models/VoiceState.d.ts | 17 -- dist/models/VoiceState.js | 24 -- dist/models/VoiceState.js.map | 1 - dist/util/BitField.d.ts | 66 ------ dist/util/BitField.js | 133 ----------- dist/util/BitField.js.map | 1 - dist/util/Config.d.ts | 21 -- dist/util/Config.js | 50 ---- dist/util/Config.js.map | 1 - dist/util/Constants.d.ts | 2 - dist/util/Constants.js | 5 - dist/util/Constants.js.map | 1 - dist/util/Database.d.ts | 29 --- dist/util/Database.js | 81 ------- dist/util/Database.js.map | 1 - dist/util/Intents.d.ts | 20 -- dist/util/Intents.js | 25 -- dist/util/Intents.js.map | 1 - dist/util/MessageFlags.d.ts | 10 - dist/util/MessageFlags.js | 17 -- dist/util/MessageFlags.js.map | 1 - dist/util/MongoBigInt.d.ts | 34 --- dist/util/MongoBigInt.js | 76 ------ dist/util/MongoBigInt.js.map | 1 - dist/util/Permissions.d.ts | 66 ------ dist/util/Permissions.js | 120 ---------- dist/util/Permissions.js.map | 1 - dist/util/Snowflake.d.ts | 58 ----- dist/util/Snowflake.js | 116 --------- dist/util/Snowflake.js.map | 1 - dist/util/String.d.ts | 3 - dist/util/String.js | 10 - dist/util/String.js.map | 1 - dist/util/UserFlags.d.ts | 18 -- dist/util/UserFlags.js | 25 -- dist/util/UserFlags.js.map | 1 - dist/util/checkToken.d.ts | 1 - dist/util/checkToken.js | 20 -- dist/util/checkToken.js.map | 1 - 88 files changed, 3 insertions(+), 3259 deletions(-) delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 dist/models/Activity.d.ts delete mode 100644 dist/models/Activity.js delete mode 100644 dist/models/Activity.js.map delete mode 100644 dist/models/Application.d.ts delete mode 100644 dist/models/Application.js delete mode 100644 dist/models/Application.js.map delete mode 100644 dist/models/AuditLog.d.ts delete mode 100644 dist/models/AuditLog.js delete mode 100644 dist/models/AuditLog.js.map delete mode 100644 dist/models/Ban.d.ts delete mode 100644 dist/models/Ban.js delete mode 100644 dist/models/Ban.js.map delete mode 100644 dist/models/Channel.d.ts delete mode 100644 dist/models/Channel.js delete mode 100644 dist/models/Channel.js.map delete mode 100644 dist/models/Emoji.d.ts delete mode 100644 dist/models/Emoji.js delete mode 100644 dist/models/Emoji.js.map delete mode 100644 dist/models/Event.d.ts delete mode 100644 dist/models/Event.js delete mode 100644 dist/models/Event.js.map delete mode 100644 dist/models/Guild.d.ts delete mode 100644 dist/models/Guild.js delete mode 100644 dist/models/Guild.js.map delete mode 100644 dist/models/Interaction.d.ts delete mode 100644 dist/models/Interaction.js delete mode 100644 dist/models/Interaction.js.map delete mode 100644 dist/models/Invite.d.ts delete mode 100644 dist/models/Invite.js delete mode 100644 dist/models/Invite.js.map delete mode 100644 dist/models/Member.d.ts delete mode 100644 dist/models/Member.js delete mode 100644 dist/models/Member.js.map delete mode 100644 dist/models/Message.d.ts delete mode 100644 dist/models/Message.js delete mode 100644 dist/models/Message.js.map delete mode 100644 dist/models/Role.d.ts delete mode 100644 dist/models/Role.js delete mode 100644 dist/models/Role.js.map delete mode 100644 dist/models/Status.d.ts delete mode 100644 dist/models/Status.js delete mode 100644 dist/models/Status.js.map delete mode 100644 dist/models/User.d.ts delete mode 100644 dist/models/User.js delete mode 100644 dist/models/User.js.map delete mode 100644 dist/models/VoiceState.d.ts delete mode 100644 dist/models/VoiceState.js delete mode 100644 dist/models/VoiceState.js.map delete mode 100644 dist/util/BitField.d.ts delete mode 100644 dist/util/BitField.js delete mode 100644 dist/util/BitField.js.map delete mode 100644 dist/util/Config.d.ts delete mode 100644 dist/util/Config.js delete mode 100644 dist/util/Config.js.map delete mode 100644 dist/util/Constants.d.ts delete mode 100644 dist/util/Constants.js delete mode 100644 dist/util/Constants.js.map delete mode 100644 dist/util/Database.d.ts delete mode 100644 dist/util/Database.js delete mode 100644 dist/util/Database.js.map delete mode 100644 dist/util/Intents.d.ts delete mode 100644 dist/util/Intents.js delete mode 100644 dist/util/Intents.js.map delete mode 100644 dist/util/MessageFlags.d.ts delete mode 100644 dist/util/MessageFlags.js delete mode 100644 dist/util/MessageFlags.js.map delete mode 100644 dist/util/MongoBigInt.d.ts delete mode 100644 dist/util/MongoBigInt.js delete mode 100644 dist/util/MongoBigInt.js.map delete mode 100644 dist/util/Permissions.d.ts delete mode 100644 dist/util/Permissions.js delete mode 100644 dist/util/Permissions.js.map delete mode 100644 dist/util/Snowflake.d.ts delete mode 100644 dist/util/Snowflake.js delete mode 100644 dist/util/Snowflake.js.map delete mode 100644 dist/util/String.d.ts delete mode 100644 dist/util/String.js delete mode 100644 dist/util/String.js.map delete mode 100644 dist/util/UserFlags.d.ts delete mode 100644 dist/util/UserFlags.js delete mode 100644 dist/util/UserFlags.js.map delete mode 100644 dist/util/checkToken.d.ts delete mode 100644 dist/util/checkToken.js delete mode 100644 dist/util/checkToken.js.map diff --git a/.gitignore b/.gitignore index 92bc6247..d7fc3f74 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,6 @@ typings/ # TernJS port file .tern-port .DS_Store + +# Compiled TypeScript code +dist/ \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index df0761b1..00000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -export * from "./util/checkToken"; -export * as Constants from "./util/Constants"; -export * from "./models/Ban"; -export * from "./models/Channel"; -export * from "./models/Emoji"; -export * from "./models/Guild"; -export * from "./models/Invite"; -export * from "./models/Member"; -export * from "./models/Role"; -export * from "./models/User"; -export * from "./models/Activity"; -export * from "./models/Application"; -export * from "./models/Interaction"; -export * from "./models/Message"; -export * from "./models/Status"; -export * from "./models/VoiceState"; -export * from "./util/String"; -export * from "./util/BitField"; -export * from "./util/Intents"; -export * from "./util/MessageFlags"; -export * from "./util/Permissions"; -export * from "./util/Snowflake"; -export * from "./util/UserFlags"; -export * from "./models/Event"; -import Config, { DefaultOptions } from "./util/Config"; -import db, { MongooseCache } from "./util/Database"; -export { Config, db, DefaultOptions, MongooseCache }; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 99f66d3d..00000000 --- a/dist/index.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MongooseCache = exports.DefaultOptions = exports.db = exports.Config = exports.Constants = void 0; -__exportStar(require("./util/checkToken"), exports); -exports.Constants = __importStar(require("./util/Constants")); -__exportStar(require("./models/Ban"), exports); -__exportStar(require("./models/Channel"), exports); -__exportStar(require("./models/Emoji"), exports); -__exportStar(require("./models/Guild"), exports); -__exportStar(require("./models/Invite"), exports); -__exportStar(require("./models/Member"), exports); -__exportStar(require("./models/Role"), exports); -__exportStar(require("./models/User"), exports); -__exportStar(require("./models/Activity"), exports); -__exportStar(require("./models/Application"), exports); -__exportStar(require("./models/Interaction"), exports); -__exportStar(require("./models/Message"), exports); -__exportStar(require("./models/Status"), exports); -__exportStar(require("./models/VoiceState"), exports); -__exportStar(require("./util/String"), exports); -__exportStar(require("./util/BitField"), exports); -__exportStar(require("./util/Intents"), exports); -__exportStar(require("./util/MessageFlags"), exports); -__exportStar(require("./util/Permissions"), exports); -__exportStar(require("./util/Snowflake"), exports); -__exportStar(require("./util/UserFlags"), exports); -__exportStar(require("./models/Event"), exports); -const Config_1 = __importStar(require("./util/Config")); -exports.Config = Config_1.default; -Object.defineProperty(exports, "DefaultOptions", { enumerable: true, get: function () { return Config_1.DefaultOptions; } }); -const Database_1 = __importStar(require("./util/Database")); -exports.db = Database_1.default; -Object.defineProperty(exports, "MongooseCache", { enumerable: true, get: function () { return Database_1.MongooseCache; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 7db4514c..00000000 --- a/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAkC;AAElC,8DAA8C;AAC9C,+CAA6B;AAC7B,mDAAiC;AACjC,iDAA+B;AAC/B,iDAA+B;AAC/B,kDAAgC;AAChC,kDAAgC;AAChC,gDAA8B;AAC9B,gDAA8B;AAC9B,oDAAkC;AAClC,uDAAqC;AACrC,uDAAqC;AACrC,mDAAiC;AACjC,kDAAgC;AAChC,sDAAoC;AAEpC,gDAA8B;AAC9B,kDAAgC;AAChC,iDAA+B;AAC/B,sDAAoC;AACpC,qDAAmC;AACnC,mDAAiC;AACjC,mDAAiC;AACjC,iDAA+B;AAE/B,wDAAuD;AAG9C,iBAHF,gBAAM,CAGE;AAAM,+FAHJ,uBAAc,OAGI;AAFnC,4DAAoD;AAEnC,aAFV,kBAAE,CAEU;AAAkB,8FAFxB,wBAAa,OAEwB"} \ No newline at end of file diff --git a/dist/models/Activity.d.ts b/dist/models/Activity.d.ts deleted file mode 100644 index 57462d60..00000000 --- a/dist/models/Activity.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { User } from ".."; -import { ClientStatus, Status } from "./Status"; -import { Types } from "mongoose"; -export interface Presence { - user: User; - guild_id?: string; - status: Status; - activities: Activity[]; - client_status: ClientStatus; -} -export interface Activity { - name: string; - type: ActivityType; - url?: string; - created_at?: Date; - timestamps?: { - start?: number; - end?: number; - }[]; - application_id?: string; - details?: string; - state?: string; - emoji?: { - name: string; - id?: string; - amimated?: boolean; - }; - party?: { - id?: string; - size?: [number, number]; - }; - assets?: { - large_image?: string; - large_text?: string; - small_image?: string; - small_text?: string; - }; - secrets?: { - join?: string; - spectate?: string; - match?: string; - }; - instance?: boolean; - flags?: bigint; -} -export declare const Activity: { - name: StringConstructor; - type: NumberConstructor; - $url: StringConstructor; - $created_at: DateConstructor; - $timestamps: { - $start: NumberConstructor; - $end: NumberConstructor; - }[]; - $application_id: StringConstructor; - $details: StringConstructor; - $state: StringConstructor; - $emoji: { - $name: StringConstructor; - $id: StringConstructor; - $amimated: BooleanConstructor; - }; - $party: { - $id: StringConstructor; - $size: NumberConstructor[]; - }; - $assets: { - $large_image: StringConstructor; - $large_text: StringConstructor; - $small_image: StringConstructor; - $small_text: StringConstructor; - }; - $secrets: { - $join: StringConstructor; - $spectate: StringConstructor; - $match: StringConstructor; - }; - $instance: BooleanConstructor; - $flags: typeof Types.Long; -}; -export declare enum ActivityType { - GAME = 0, - STREAMING = 1, - LISTENING = 2, - CUSTOM = 4, - COMPETING = 5 -} diff --git a/dist/models/Activity.js b/dist/models/Activity.js deleted file mode 100644 index d9a19ead..00000000 --- a/dist/models/Activity.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ActivityType = exports.Activity = void 0; -const mongoose_1 = require("mongoose"); -exports.Activity = { - name: String, - type: Number, - $url: String, - $created_at: Date, - $timestamps: [ - { - $start: Number, - $end: Number, - }, - ], - $application_id: String, - $details: String, - $state: String, - $emoji: { - $name: String, - $id: String, - $amimated: Boolean, - }, - $party: { - $id: String, - $size: [Number, Number], - }, - $assets: { - $large_image: String, - $large_text: String, - $small_image: String, - $small_text: String, - }, - $secrets: { - $join: String, - $spectate: String, - $match: String, - }, - $instance: Boolean, - $flags: mongoose_1.Types.Long, -}; -var ActivityType; -(function (ActivityType) { - ActivityType[ActivityType["GAME"] = 0] = "GAME"; - ActivityType[ActivityType["STREAMING"] = 1] = "STREAMING"; - ActivityType[ActivityType["LISTENING"] = 2] = "LISTENING"; - ActivityType[ActivityType["CUSTOM"] = 4] = "CUSTOM"; - ActivityType[ActivityType["COMPETING"] = 5] = "COMPETING"; -})(ActivityType = exports.ActivityType || (exports.ActivityType = {})); -//# sourceMappingURL=Activity.js.map \ No newline at end of file diff --git a/dist/models/Activity.js.map b/dist/models/Activity.js.map deleted file mode 100644 index 8ce7d191..00000000 --- a/dist/models/Activity.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Activity.js","sourceRoot":"","sources":["../../src/models/Activity.ts"],"names":[],"mappings":";;;AAEA,uCAA0D;AA8C7C,QAAA,QAAQ,GAAG;IACvB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE;QACZ;YACC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM;SACZ;KACD;IACD,eAAe,EAAE,MAAM;IACvB,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE;QACP,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,MAAM;QACX,SAAS,EAAE,OAAO;KAClB;IACD,MAAM,EAAE;QACP,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;KACvB;IACD,OAAO,EAAE;QACR,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,MAAM;QACnB,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,MAAM;KACnB;IACD,QAAQ,EAAE;QACT,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,MAAM;QACjB,MAAM,EAAE,MAAM;KACd;IACD,SAAS,EAAE,OAAO;IAClB,MAAM,EAAE,gBAAK,CAAC,IAAI;CAClB,CAAC;AAEF,IAAY,YAMX;AAND,WAAY,YAAY;IACvB,+CAAQ,CAAA;IACR,yDAAa,CAAA;IACb,yDAAa,CAAA;IACb,mDAAU,CAAA;IACV,yDAAa,CAAA;AACd,CAAC,EANW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAMvB"} \ No newline at end of file diff --git a/dist/models/Application.d.ts b/dist/models/Application.d.ts deleted file mode 100644 index 68e026bb..00000000 --- a/dist/models/Application.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export interface ApplicationCommand { - id: string; - application_id: string; - name: string; - description: string; - options?: ApplicationCommandOption[]; -} -export interface ApplicationCommandOption { - type: ApplicationCommandOptionType; - name: string; - description: string; - required?: boolean; - choices?: ApplicationCommandOptionChoice[]; - options?: ApplicationCommandOption[]; -} -export interface ApplicationCommandOptionChoice { - name: string; - value: string | number; -} -export declare enum ApplicationCommandOptionType { - SUB_COMMAND = 1, - SUB_COMMAND_GROUP = 2, - STRING = 3, - INTEGER = 4, - BOOLEAN = 5, - USER = 6, - CHANNEL = 7, - ROLE = 8 -} -export interface ApplicationCommandInteractionData { - id: string; - name: string; - options?: ApplicationCommandInteractionDataOption[]; -} -export interface ApplicationCommandInteractionDataOption { - name: string; - value?: any; - options?: ApplicationCommandInteractionDataOption[]; -} diff --git a/dist/models/Application.js b/dist/models/Application.js deleted file mode 100644 index 6981f8a8..00000000 --- a/dist/models/Application.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ApplicationCommandOptionType = void 0; -var ApplicationCommandOptionType; -(function (ApplicationCommandOptionType) { - ApplicationCommandOptionType[ApplicationCommandOptionType["SUB_COMMAND"] = 1] = "SUB_COMMAND"; - ApplicationCommandOptionType[ApplicationCommandOptionType["SUB_COMMAND_GROUP"] = 2] = "SUB_COMMAND_GROUP"; - ApplicationCommandOptionType[ApplicationCommandOptionType["STRING"] = 3] = "STRING"; - ApplicationCommandOptionType[ApplicationCommandOptionType["INTEGER"] = 4] = "INTEGER"; - ApplicationCommandOptionType[ApplicationCommandOptionType["BOOLEAN"] = 5] = "BOOLEAN"; - ApplicationCommandOptionType[ApplicationCommandOptionType["USER"] = 6] = "USER"; - ApplicationCommandOptionType[ApplicationCommandOptionType["CHANNEL"] = 7] = "CHANNEL"; - ApplicationCommandOptionType[ApplicationCommandOptionType["ROLE"] = 8] = "ROLE"; -})(ApplicationCommandOptionType = exports.ApplicationCommandOptionType || (exports.ApplicationCommandOptionType = {})); -//# sourceMappingURL=Application.js.map \ No newline at end of file diff --git a/dist/models/Application.js.map b/dist/models/Application.js.map deleted file mode 100644 index 083b76f2..00000000 --- a/dist/models/Application.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Application.js","sourceRoot":"","sources":["../../src/models/Application.ts"],"names":[],"mappings":";;;AAsBA,IAAY,4BASX;AATD,WAAY,4BAA4B;IACvC,6FAAe,CAAA;IACf,yGAAqB,CAAA;IACrB,mFAAU,CAAA;IACV,qFAAW,CAAA;IACX,qFAAW,CAAA;IACX,+EAAQ,CAAA;IACR,qFAAW,CAAA;IACX,+EAAQ,CAAA;AACT,CAAC,EATW,4BAA4B,GAA5B,oCAA4B,KAA5B,oCAA4B,QASvC"} \ No newline at end of file diff --git a/dist/models/AuditLog.d.ts b/dist/models/AuditLog.d.ts deleted file mode 100644 index 76c21807..00000000 --- a/dist/models/AuditLog.d.ts +++ /dev/null @@ -1,187 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -import { ChannelPermissionOverwrite } from "./Channel"; -import { PublicUser } from "./User"; -export interface AuditLogResponse { - webhooks: []; - users: PublicUser[]; - audit_log_entries: AuditLogEntries[]; - integrations: []; -} -export interface AuditLogEntries { - target_id?: string; - user_id: string; - id: string; - action_type: AuditLogEvents; - options?: { - delete_member_days?: string; - members_removed?: string; - channel_id?: string; - messaged_id?: string; - count?: string; - id?: string; - type?: string; - role_name?: string; - }; - changes: AuditLogChange[]; - reason?: string; -} -export interface AuditLogChange { - new_value?: AuditLogChangeValue; - old_value?: AuditLogChangeValue; - key: string; -} -export interface AuditLogChangeValue { - name?: string; - description?: string; - icon_hash?: string; - splash_hash?: string; - discovery_splash_hash?: string; - banner_hash?: string; - owner_id?: string; - region?: string; - preferred_locale?: string; - afk_channel_id?: string; - afk_timeout?: number; - rules_channel_id?: string; - public_updates_channel_id?: string; - mfa_level?: number; - verification_level?: number; - explicit_content_filter?: number; - default_message_notifications?: number; - vanity_url_code?: string; - $add?: {}[]; - $remove?: {}[]; - prune_delete_days?: number; - widget_enabled?: boolean; - widget_channel_id?: string; - system_channel_id?: string; - position?: number; - topic?: string; - bitrate?: number; - permission_overwrites?: ChannelPermissionOverwrite[]; - nsfw?: boolean; - application_id?: string; - rate_limit_per_user?: number; - permissions?: string; - color?: number; - hoist?: boolean; - mentionable?: boolean; - allow?: string; - deny?: string; - code?: string; - channel_id?: string; - inviter_id?: string; - max_uses?: number; - uses?: number; - max_age?: number; - temporary?: boolean; - deaf?: boolean; - mute?: boolean; - nick?: string; - avatar_hash?: string; - id?: string; - type?: number; - enable_emoticons?: boolean; - expire_behavior?: number; - expire_grace_period?: number; - user_limit?: number; -} -export interface AuditLogEntriesDocument extends Document, AuditLogEntries { - id: string; -} -export declare const AuditLogChanges: { - name: StringConstructor; - description: StringConstructor; - icon_hash: StringConstructor; - splash_hash: StringConstructor; - discovery_splash_hash: StringConstructor; - banner_hash: StringConstructor; - owner_id: StringConstructor; - region: StringConstructor; - preferred_locale: StringConstructor; - afk_channel_id: StringConstructor; - afk_timeout: NumberConstructor; - rules_channel_id: StringConstructor; - public_updates_channel_id: StringConstructor; - mfa_level: NumberConstructor; - verification_level: NumberConstructor; - explicit_content_filter: NumberConstructor; - default_message_notifications: NumberConstructor; - vanity_url_code: StringConstructor; - $add: {}[]; - $remove: {}[]; - prune_delete_days: NumberConstructor; - widget_enabled: BooleanConstructor; - widget_channel_id: StringConstructor; - system_channel_id: StringConstructor; - position: NumberConstructor; - topic: StringConstructor; - bitrate: NumberConstructor; - permission_overwrites: {}[]; - nsfw: BooleanConstructor; - application_id: StringConstructor; - rate_limit_per_user: NumberConstructor; - permissions: StringConstructor; - color: NumberConstructor; - hoist: BooleanConstructor; - mentionable: BooleanConstructor; - allow: StringConstructor; - deny: StringConstructor; - code: StringConstructor; - channel_id: StringConstructor; - inviter_id: StringConstructor; - max_uses: NumberConstructor; - uses: NumberConstructor; - max_age: NumberConstructor; - temporary: BooleanConstructor; - deaf: BooleanConstructor; - mute: BooleanConstructor; - nick: StringConstructor; - avatar_hash: StringConstructor; - id: StringConstructor; - type: NumberConstructor; - enable_emoticons: BooleanConstructor; - expire_behavior: NumberConstructor; - expire_grace_period: NumberConstructor; - user_limit: NumberConstructor; -}; -export declare const AuditLogSchema: Schema, import("mongoose").Model>, undefined>; -export declare const AuditLogModel: import("mongoose").Model; -export declare enum AuditLogEvents { - GUILD_UPDATE = 1, - CHANNEL_CREATE = 10, - CHANNEL_UPDATE = 11, - CHANNEL_DELETE = 12, - CHANNEL_OVERWRITE_CREATE = 13, - CHANNEL_OVERWRITE_UPDATE = 14, - CHANNEL_OVERWRITE_DELETE = 15, - MEMBER_KICK = 20, - MEMBER_PRUNE = 21, - MEMBER_BAN_ADD = 22, - MEMBER_BAN_REMOVE = 23, - MEMBER_UPDATE = 24, - MEMBER_ROLE_UPDATE = 25, - MEMBER_MOVE = 26, - MEMBER_DISCONNECT = 27, - BOT_ADD = 28, - ROLE_CREATE = 30, - ROLE_UPDATE = 31, - ROLE_DELETE = 32, - INVITE_CREATE = 40, - INVITE_UPDATE = 41, - INVITE_DELETE = 42, - WEBHOOK_CREATE = 50, - WEBHOOK_UPDATE = 51, - WEBHOOK_DELETE = 52, - EMOJI_CREATE = 60, - EMOJI_UPDATE = 61, - EMOJI_DELETE = 62, - MESSAGE_DELETE = 72, - MESSAGE_BULK_DELETE = 73, - MESSAGE_PIN = 74, - MESSAGE_UNPIN = 75, - INTEGRATION_CREATE = 80, - INTEGRATION_UPDATE = 81, - INTEGRATION_DELETE = 82 -} diff --git a/dist/models/AuditLog.js b/dist/models/AuditLog.js deleted file mode 100644 index 2a76e5b7..00000000 --- a/dist/models/AuditLog.js +++ /dev/null @@ -1,129 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AuditLogEvents = exports.AuditLogModel = exports.AuditLogSchema = exports.AuditLogChanges = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.AuditLogChanges = { - name: String, - description: String, - icon_hash: String, - splash_hash: String, - discovery_splash_hash: String, - banner_hash: String, - owner_id: String, - region: String, - preferred_locale: String, - afk_channel_id: String, - afk_timeout: Number, - rules_channel_id: String, - public_updates_channel_id: String, - mfa_level: Number, - verification_level: Number, - explicit_content_filter: Number, - default_message_notifications: Number, - vanity_url_code: String, - $add: [{}], - $remove: [{}], - prune_delete_days: Number, - widget_enabled: Boolean, - widget_channel_id: String, - system_channel_id: String, - position: Number, - topic: String, - bitrate: Number, - permission_overwrites: [{}], - nsfw: Boolean, - application_id: String, - rate_limit_per_user: Number, - permissions: String, - color: Number, - hoist: Boolean, - mentionable: Boolean, - allow: String, - deny: String, - code: String, - channel_id: String, - inviter_id: String, - max_uses: Number, - uses: Number, - max_age: Number, - temporary: Boolean, - deaf: Boolean, - mute: Boolean, - nick: String, - avatar_hash: String, - id: String, - type: Number, - enable_emoticons: Boolean, - expire_behavior: Number, - expire_grace_period: Number, - user_limit: Number, -}; -exports.AuditLogSchema = new mongoose_1.Schema({ - target_id: String, - user_id: { type: String, required: true }, - id: { type: String, required: true }, - action_type: { type: Number, required: true }, - options: { - delete_member_days: String, - members_removed: String, - channel_id: String, - messaged_id: String, - count: String, - id: String, - type: String, - role_name: String, - }, - changes: [ - { - new_value: exports.AuditLogChanges, - old_value: exports.AuditLogChanges, - key: String, - }, - ], - reason: String, -}); -// @ts-ignore -exports.AuditLogModel = Database_1.default.model("AuditLog", exports.AuditLogSchema, "auditlogs"); -var AuditLogEvents; -(function (AuditLogEvents) { - AuditLogEvents[AuditLogEvents["GUILD_UPDATE"] = 1] = "GUILD_UPDATE"; - AuditLogEvents[AuditLogEvents["CHANNEL_CREATE"] = 10] = "CHANNEL_CREATE"; - AuditLogEvents[AuditLogEvents["CHANNEL_UPDATE"] = 11] = "CHANNEL_UPDATE"; - AuditLogEvents[AuditLogEvents["CHANNEL_DELETE"] = 12] = "CHANNEL_DELETE"; - AuditLogEvents[AuditLogEvents["CHANNEL_OVERWRITE_CREATE"] = 13] = "CHANNEL_OVERWRITE_CREATE"; - AuditLogEvents[AuditLogEvents["CHANNEL_OVERWRITE_UPDATE"] = 14] = "CHANNEL_OVERWRITE_UPDATE"; - AuditLogEvents[AuditLogEvents["CHANNEL_OVERWRITE_DELETE"] = 15] = "CHANNEL_OVERWRITE_DELETE"; - AuditLogEvents[AuditLogEvents["MEMBER_KICK"] = 20] = "MEMBER_KICK"; - AuditLogEvents[AuditLogEvents["MEMBER_PRUNE"] = 21] = "MEMBER_PRUNE"; - AuditLogEvents[AuditLogEvents["MEMBER_BAN_ADD"] = 22] = "MEMBER_BAN_ADD"; - AuditLogEvents[AuditLogEvents["MEMBER_BAN_REMOVE"] = 23] = "MEMBER_BAN_REMOVE"; - AuditLogEvents[AuditLogEvents["MEMBER_UPDATE"] = 24] = "MEMBER_UPDATE"; - AuditLogEvents[AuditLogEvents["MEMBER_ROLE_UPDATE"] = 25] = "MEMBER_ROLE_UPDATE"; - AuditLogEvents[AuditLogEvents["MEMBER_MOVE"] = 26] = "MEMBER_MOVE"; - AuditLogEvents[AuditLogEvents["MEMBER_DISCONNECT"] = 27] = "MEMBER_DISCONNECT"; - AuditLogEvents[AuditLogEvents["BOT_ADD"] = 28] = "BOT_ADD"; - AuditLogEvents[AuditLogEvents["ROLE_CREATE"] = 30] = "ROLE_CREATE"; - AuditLogEvents[AuditLogEvents["ROLE_UPDATE"] = 31] = "ROLE_UPDATE"; - AuditLogEvents[AuditLogEvents["ROLE_DELETE"] = 32] = "ROLE_DELETE"; - AuditLogEvents[AuditLogEvents["INVITE_CREATE"] = 40] = "INVITE_CREATE"; - AuditLogEvents[AuditLogEvents["INVITE_UPDATE"] = 41] = "INVITE_UPDATE"; - AuditLogEvents[AuditLogEvents["INVITE_DELETE"] = 42] = "INVITE_DELETE"; - AuditLogEvents[AuditLogEvents["WEBHOOK_CREATE"] = 50] = "WEBHOOK_CREATE"; - AuditLogEvents[AuditLogEvents["WEBHOOK_UPDATE"] = 51] = "WEBHOOK_UPDATE"; - AuditLogEvents[AuditLogEvents["WEBHOOK_DELETE"] = 52] = "WEBHOOK_DELETE"; - AuditLogEvents[AuditLogEvents["EMOJI_CREATE"] = 60] = "EMOJI_CREATE"; - AuditLogEvents[AuditLogEvents["EMOJI_UPDATE"] = 61] = "EMOJI_UPDATE"; - AuditLogEvents[AuditLogEvents["EMOJI_DELETE"] = 62] = "EMOJI_DELETE"; - AuditLogEvents[AuditLogEvents["MESSAGE_DELETE"] = 72] = "MESSAGE_DELETE"; - AuditLogEvents[AuditLogEvents["MESSAGE_BULK_DELETE"] = 73] = "MESSAGE_BULK_DELETE"; - AuditLogEvents[AuditLogEvents["MESSAGE_PIN"] = 74] = "MESSAGE_PIN"; - AuditLogEvents[AuditLogEvents["MESSAGE_UNPIN"] = 75] = "MESSAGE_UNPIN"; - AuditLogEvents[AuditLogEvents["INTEGRATION_CREATE"] = 80] = "INTEGRATION_CREATE"; - AuditLogEvents[AuditLogEvents["INTEGRATION_UPDATE"] = 81] = "INTEGRATION_UPDATE"; - AuditLogEvents[AuditLogEvents["INTEGRATION_DELETE"] = 82] = "INTEGRATION_DELETE"; -})(AuditLogEvents = exports.AuditLogEvents || (exports.AuditLogEvents = {})); -//# sourceMappingURL=AuditLog.js.map \ No newline at end of file diff --git a/dist/models/AuditLog.js.map b/dist/models/AuditLog.js.map deleted file mode 100644 index 6529c239..00000000 --- a/dist/models/AuditLog.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AuditLog.js","sourceRoot":"","sources":["../../src/models/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,MAAM;IACxB,yBAAyB,EAAE,MAAM;IACjC,SAAS,EAAE,MAAM;IACjB,kBAAkB,EAAE,MAAM;IAC1B,uBAAuB,EAAE,MAAM;IAC/B,6BAA6B,EAAE,MAAM;IACrC,eAAe,EAAE,MAAM;IACvB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,iBAAiB,EAAE,MAAM;IACzB,cAAc,EAAE,OAAO;IACvB,iBAAiB,EAAE,MAAM;IACzB,iBAAiB,EAAE,MAAM;IACzB,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,MAAM;IACf,qBAAqB,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAI,EAAE,OAAO;IACb,cAAc,EAAE,MAAM;IACtB,mBAAmB,EAAE,MAAM;IAC3B,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE,MAAM;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AU,EAAE,sBAAc,EAAE,WAAW,CAAC,CAAC;AAEhG,IAAY,cAoCX;AApCD,WAAY,cAAc;IACzB,mEAAgB,CAAA;IAChB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,4FAA6B,CAAA;IAC7B,4FAA6B,CAAA;IAC7B,4FAA6B,CAAA;IAC7B,kEAAgB,CAAA;IAChB,oEAAiB,CAAA;IACjB,wEAAmB,CAAA;IACnB,8EAAsB,CAAA;IACtB,sEAAkB,CAAA;IAClB,gFAAuB,CAAA;IACvB,kEAAgB,CAAA;IAChB,8EAAsB,CAAA;IACtB,0DAAY,CAAA;IACZ,kEAAgB,CAAA;IAChB,kEAAgB,CAAA;IAChB,kEAAgB,CAAA;IAChB,sEAAkB,CAAA;IAClB,sEAAkB,CAAA;IAClB,sEAAkB,CAAA;IAClB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,oEAAiB,CAAA;IACjB,oEAAiB,CAAA;IACjB,oEAAiB,CAAA;IACjB,wEAAmB,CAAA;IACnB,kFAAwB,CAAA;IACxB,kEAAgB,CAAA;IAChB,sEAAkB,CAAA;IAClB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;IACvB,gFAAuB,CAAA;AACxB,CAAC,EApCW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAoCzB"} \ No newline at end of file diff --git a/dist/models/Ban.d.ts b/dist/models/Ban.d.ts deleted file mode 100644 index ad3a39b7..00000000 --- a/dist/models/Ban.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface Ban extends Document { - user_id: string; - guild_id: string; - executor_id: string; - ip: string; - reason?: string; -} -export declare const BanSchema: Schema, import("mongoose").Model>, undefined>; -export declare const BanModel: import("mongoose").Model; diff --git a/dist/models/Ban.js b/dist/models/Ban.js deleted file mode 100644 index 0b7f30b5..00000000 --- a/dist/models/Ban.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BanModel = exports.BanSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.BanSchema = new mongoose_1.Schema({ - user_id: { type: String, required: true }, - guild_id: { type: String, required: true }, - executor_id: { type: String, required: true }, - reason: String, - ip: String, -}); -// @ts-ignore -exports.BanModel = Database_1.default.model("Ban", exports.BanSchema, "bans"); -//# sourceMappingURL=Ban.js.map \ No newline at end of file diff --git a/dist/models/Ban.js.map b/dist/models/Ban.js.map deleted file mode 100644 index 6a10fccb..00000000 --- a/dist/models/Ban.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Ban.js","sourceRoot":"","sources":["../../src/models/Ban.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAUrB,QAAA,SAAS,GAAG,IAAI,iBAAM,CAAC;IACnC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1C,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC7C,MAAM,EAAE,MAAM;IACd,EAAE,EAAE,MAAM;CACV,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,QAAQ,GAAG,kBAAE,CAAC,KAAK,CAAM,KAAK,EAAE,iBAAS,EAAE,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Channel.d.ts b/dist/models/Channel.d.ts deleted file mode 100644 index d3048622..00000000 --- a/dist/models/Channel.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel { -} -export interface ChannelDocument extends Document, AnyChannel { - id: string; -} -export declare const ChannelSchema: Schema, import("mongoose").Model>, undefined>; -export declare const ChannelModel: import("mongoose").Model; -export interface Channel { - id: string; - created_at: Date; - name: string; - type: number; -} -export interface TextBasedChannel { - last_message_id?: string; - last_pin_timestamp?: number; -} -export interface GuildChannel extends Channel { - guild_id: string; - position: number; - parent_id?: string; - permission_overwrites: ChannelPermissionOverwrite[]; -} -export interface ChannelPermissionOverwrite { - allow: bigint; - deny: bigint; - id: string; - type: ChannelPermissionOverwriteType; -} -export declare enum ChannelPermissionOverwriteType { - role = 0, - member = 1 -} -export interface VoiceChannel extends GuildChannel { -} -export interface TextChannel extends GuildChannel, TextBasedChannel { - nsfw: boolean; - rate_limit_per_user: number; - topic?: string; -} -export interface DMChannel extends Channel, TextBasedChannel { - owner_id: string; - recipients: string[]; -} -export declare enum ChannelType { - GUILD_TEXT = 0, - DM = 1, - GUILD_VOICE = 2, - GROUP_DM = 3, - GUILD_CATEGORY = 4, - GUILD_NEWS = 5, - GUILD_STORE = 6 -} diff --git a/dist/models/Channel.js b/dist/models/Channel.js deleted file mode 100644 index 956b1fc5..00000000 --- a/dist/models/Channel.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ChannelType = exports.ChannelPermissionOverwriteType = exports.ChannelModel = exports.ChannelSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.ChannelSchema = new mongoose_1.Schema({ - id: String, - created_at: { type: mongoose_1.Schema.Types.Date, required: true }, - name: { type: String, required: true }, - type: { type: Number, required: true }, - guild_id: String, - owner_id: String, - parent_id: String, - recipients: [String], - position: Number, - last_message_id: String, - last_pin_timestamp: Date, - nsfw: Boolean, - rate_limit_per_user: Number, - topic: String, - permission_overwrites: [ - { - allow: mongoose_1.Types.Long, - deny: mongoose_1.Types.Long, - id: String, - type: Number, - }, - ], -}); -// @ts-ignore -exports.ChannelModel = Database_1.default.model("Channel", exports.ChannelSchema, "channels"); -var ChannelPermissionOverwriteType; -(function (ChannelPermissionOverwriteType) { - ChannelPermissionOverwriteType[ChannelPermissionOverwriteType["role"] = 0] = "role"; - ChannelPermissionOverwriteType[ChannelPermissionOverwriteType["member"] = 1] = "member"; -})(ChannelPermissionOverwriteType = exports.ChannelPermissionOverwriteType || (exports.ChannelPermissionOverwriteType = {})); -var ChannelType; -(function (ChannelType) { - ChannelType[ChannelType["GUILD_TEXT"] = 0] = "GUILD_TEXT"; - ChannelType[ChannelType["DM"] = 1] = "DM"; - ChannelType[ChannelType["GUILD_VOICE"] = 2] = "GUILD_VOICE"; - ChannelType[ChannelType["GROUP_DM"] = 3] = "GROUP_DM"; - ChannelType[ChannelType["GUILD_CATEGORY"] = 4] = "GUILD_CATEGORY"; - ChannelType[ChannelType["GUILD_NEWS"] = 5] = "GUILD_NEWS"; - ChannelType[ChannelType["GUILD_STORE"] = 6] = "GUILD_STORE"; -})(ChannelType = exports.ChannelType || (exports.ChannelType = {})); -//# sourceMappingURL=Channel.js.map \ No newline at end of file diff --git a/dist/models/Channel.js.map b/dist/models/Channel.js.map deleted file mode 100644 index ff804845..00000000 --- a/dist/models/Channel.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Channel.js","sourceRoot":"","sources":["../../src/models/Channel.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAQrB,QAAA,aAAa,GAAG,IAAI,iBAAM,CAAC;IACvC,EAAE,EAAE,MAAM;IACV,UAAU,EAAE,EAAE,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM;IAChB,eAAe,EAAE,MAAM;IACvB,kBAAkB,EAAE,IAAI;IACxB,IAAI,EAAE,OAAO;IACb,mBAAmB,EAAE,MAAM;IAC3B,KAAK,EAAE,MAAM;IACb,qBAAqB,EAAE;QACtB;YACC,KAAK,EAAE,gBAAK,CAAC,IAAI;YACjB,IAAI,EAAE,gBAAK,CAAC,IAAI;YAChB,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,MAAM;SACZ;KACD;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,YAAY,GAAG,kBAAE,CAAC,KAAK,CAAkB,SAAS,EAAE,qBAAa,EAAE,UAAU,CAAC,CAAC;AA4B5F,IAAY,8BAGX;AAHD,WAAY,8BAA8B;IACzC,mFAAQ,CAAA;IACR,uFAAU,CAAA;AACX,CAAC,EAHW,8BAA8B,GAA9B,sCAA8B,KAA9B,sCAA8B,QAGzC;AAeD,IAAY,WAQX;AARD,WAAY,WAAW;IACtB,yDAAc,CAAA;IACd,yCAAM,CAAA;IACN,2DAAe,CAAA;IACf,qDAAY,CAAA;IACZ,iEAAkB,CAAA;IAClB,yDAAc,CAAA;IACd,2DAAe,CAAA;AAChB,CAAC,EARW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAQtB"} \ No newline at end of file diff --git a/dist/models/Emoji.d.ts b/dist/models/Emoji.d.ts deleted file mode 100644 index 9e53cc72..00000000 --- a/dist/models/Emoji.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface Emoji extends Document { - id: string; - animated: boolean; - available: boolean; - guild_id: string; - managed: boolean; - name: string; - require_colons: boolean; - url: string; - roles: string[]; -} -export declare const EmojiSchema: Schema, import("mongoose").Model>, undefined>; -export declare const EmojiModel: import("mongoose").Model; diff --git a/dist/models/Emoji.js b/dist/models/Emoji.js deleted file mode 100644 index 5f9fc56f..00000000 --- a/dist/models/Emoji.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EmojiModel = exports.EmojiSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.EmojiSchema = new mongoose_1.Schema({ - id: { type: String, required: true }, - animated: Boolean, - available: Boolean, - guild_id: String, - managed: Boolean, - name: String, - require_colons: Boolean, - url: String, - roles: [String], -}); -// @ts-ignore -exports.EmojiModel = Database_1.default.model("Emoji", exports.EmojiSchema, "emojis"); -//# sourceMappingURL=Emoji.js.map \ No newline at end of file diff --git a/dist/models/Emoji.js.map b/dist/models/Emoji.js.map deleted file mode 100644 index f66fe302..00000000 --- a/dist/models/Emoji.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Emoji.js","sourceRoot":"","sources":["../../src/models/Emoji.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAcrB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpC,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,OAAO;IACvB,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,CAAC,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAQ,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Event.d.ts b/dist/models/Event.d.ts deleted file mode 100644 index 00ca7cac..00000000 --- a/dist/models/Event.d.ts +++ /dev/null @@ -1,417 +0,0 @@ -/// -import { ConnectedAccount, PublicUser, User, UserSettings } from "./User"; -import { DMChannel, Channel } from "./Channel"; -import { Guild } from "./Guild"; -import { Member, PublicMember, UserGuildSettings } from "./Member"; -import { Emoji } from "./Emoji"; -import { Presence } from "./Activity"; -import { Role } from "./Role"; -import { Invite } from "./Invite"; -import { Message, PartialEmoji } from "./Message"; -import { VoiceState } from "./VoiceState"; -import { ApplicationCommand } from "./Application"; -import { Interaction } from "./Interaction"; -import { Schema, Document } from "mongoose"; -export interface Event { - guild_id?: string; - user_id?: string; - channel_id?: string; - created_at?: Date; - event: EVENT; - data?: any; -} -export interface EventDocument extends Event, Document { -} -export declare const EventSchema: Schema, import("mongoose").Model>, undefined>; -export declare const EventModel: import("mongoose").Model; -export interface InvalidatedEvent extends Event { - event: "INVALIDATED"; -} -export interface ReadyEventData { - v: number; - user: PublicUser & { - mobile: boolean; - desktop: boolean; - email: string; - flags: bigint; - mfa_enabled: boolean; - nsfw_allowed: boolean; - phone: string; - premium: boolean; - premium_type: number; - verified: boolean; - bot: boolean; - }; - private_channels: DMChannel[]; - session_id: string; - guilds: Guild[]; - analytics_token?: string; - connected_accounts?: ConnectedAccount[]; - consents?: { - personalization?: { - consented?: boolean; - }; - }; - country_code?: string; - friend_suggestion_count?: number; - geo_ordered_rtc_regions?: string[]; - experiments?: [number, number, number, number, number][]; - guild_experiments?: [ - number, - null, - number, - [ - [number, { - e: number; - s: number; - }[]] - ], - [ - number, - [[number, [number, number]]] - ], - { - b: number; - k: bigint[]; - }[] - ][]; - guild_join_requests?: []; - shard?: [number, number]; - user_settings?: UserSettings; - relationships?: []; - read_state: { - entries: []; - partial: boolean; - version: number; - }; - user_guild_settings?: { - entries: UserGuildSettings[]; - version: number; - partial: boolean; - }; - application?: { - id: string; - flags: bigint; - }; - merged_members?: Omit[][]; - users?: { - avatar?: string; - discriminator: string; - id: string; - username: string; - bot: boolean; - public_flags: bigint; - }[]; -} -export interface ReadyEvent extends Event { - event: "READY"; - data: ReadyEventData; -} -export interface ChannelCreateEvent extends Event { - event: "CHANNEL_CREATE"; - data: Channel; -} -export interface ChannelUpdateEvent extends Event { - event: "CHANNEL_UPDATE"; - data: Channel; -} -export interface ChannelDeleteEvent extends Event { - event: "CHANNEL_DELETE"; - data: Channel; -} -export interface ChannelPinsUpdateEvent extends Event { - event: "CHANNEL_PINS_UPDATE"; - data: { - guild_id?: string; - channel_id: string; - last_pin_timestamp: number; - }; -} -export interface GuildCreateEvent extends Event { - event: "GUILD_CREATE"; - data: Guild; -} -export interface GuildUpdateEvent extends Event { - event: "GUILD_UPDATE"; - data: Guild; -} -export interface GuildDeleteEvent extends Event { - event: "GUILD_DELETE"; - data: { - id: string; - unavailable?: boolean; - }; -} -export interface GuildBanAddEvent extends Event { - event: "GUILD_BAN_ADD"; - data: { - guild_id: string; - user: User; - }; -} -export interface GuildBanRemoveEvent extends Event { - event: "GUILD_BAN_REMOVE"; - data: { - guild_id: string; - user: User; - }; -} -export interface GuildEmojiUpdateEvent extends Event { - event: "GUILD_EMOJI_UPDATE"; - data: { - guild_id: string; - emojis: Emoji[]; - }; -} -export interface GuildIntegrationUpdateEvent extends Event { - event: "GUILD_INTEGRATIONS_UPDATE"; - data: { - guild_id: string; - }; -} -export interface GuildMemberAddEvent extends Event { - event: "GUILD_MEMBER_ADD"; - data: PublicMember & { - guild_id: string; - }; -} -export interface GuildMemberRemoveEvent extends Event { - event: "GUILD_MEMBER_REMOVE"; - data: { - guild_id: string; - user: User; - }; -} -export interface GuildMemberUpdateEvent extends Event { - event: "GUILD_MEMBER_UPDATE"; - data: { - guild_id: string; - roles: string[]; - user: User; - nick?: string; - joined_at: Date; - premium_since?: number; - pending?: boolean; - }; -} -export interface GuildMembersChunkEvent extends Event { - event: "GUILD_MEMBERS_CHUNK"; - data: { - guild_id: string; - members: PublicMember[]; - chunk_index: number; - chunk_count: number; - not_found: string[]; - presences: Presence[]; - nonce?: string; - }; -} -export interface GuildRoleCreateEvent extends Event { - event: "GUILD_ROLE_CREATE"; - data: { - guild_id: string; - role: Role; - }; -} -export interface GuildRoleUpdateEvent extends Event { - event: "GUILD_ROLE_UPDATE"; - data: { - guild_id: string; - role: Role; - }; -} -export interface GuildRoleDeleteEvent extends Event { - event: "GUILD_ROLE_DELETE"; - data: { - guild_id: string; - role_id: string; - }; -} -export interface InviteCreateEvent extends Event { - event: "INVITE_CREATE"; - data: Omit & { - channel_id: string; - guild_id?: string; - }; -} -export interface InviteDeleteEvent extends Event { - event: "INVITE_DELETE"; - data: { - channel_id: string; - guild_id?: string; - code: string; - }; -} -export declare type MessagePayload = Omit & { - channel_id: string; - guild_id?: string; - author: User; - member: PublicMember; - mentions: (User & { - member: PublicMember; - })[]; -}; -export interface MessageCreateEvent extends Event { - event: "MESSAGE_CREATE"; - data: MessagePayload; -} -export interface MessageUpdateEvent extends Event { - event: "MESSAGE_UPDATE"; - data: MessagePayload; -} -export interface MessageDeleteEvent extends Event { - event: "MESSAGE_DELETE"; - data: { - id: string; - channel_id: string; - guild_id?: string; - }; -} -export interface MessageDeleteBulkEvent extends Event { - event: "MESSAGE_DELETE_BULK"; - data: { - ids: string[]; - channel_id: string; - guild_id?: string; - }; -} -export interface MessageReactionAddEvent extends Event { - event: "MESSAGE_REACTION_ADD"; - data: { - user_id: string; - channel_id: string; - message_id: string; - guild_id?: string; - member?: PublicMember; - emoji: PartialEmoji; - }; -} -export interface MessageReactionRemoveEvent extends Event { - event: "MESSAGE_REACTION_REMOVE"; - data: { - user_id: string; - channel_id: string; - message_id: string; - guild_id?: string; - emoji: PartialEmoji; - }; -} -export interface MessageReactionRemoveAllEvent extends Event { - event: "MESSAGE_REACTION_REMOVE_ALL"; - data: { - channel_id: string; - message_id: string; - guild_id?: string; - }; -} -export interface MessageReactionRemoveEmojiEvent extends Event { - event: "MESSAGE_REACTION_REMOVE_EMOJI"; - data: { - channel_id: string; - message_id: string; - guild_id?: string; - emoji: PartialEmoji; - }; -} -export interface PresenceUpdateEvent extends Event { - event: "PRESENCE_UPDATE"; - data: Presence; -} -export interface TypingStartEvent extends Event { - event: "TYPING_START"; - data: { - channel_id: string; - user_id: string; - timestamp: number; - guild_id?: string; - member?: PublicMember; - }; -} -export interface UserUpdateEvent extends Event { - event: "USER_UPDATE"; - data: User; -} -export interface VoiceStateUpdateEvent extends Event { - event: "VOICE_STATE_UPDATE"; - data: VoiceState & { - member: PublicMember; - }; -} -export interface VoiceServerUpdateEvent extends Event { - event: "VOICE_SERVER_UPDATE"; - data: { - token: string; - guild_id: string; - endpoint: string; - }; -} -export interface WebhooksUpdateEvent extends Event { - event: "WEBHOOKS_UPDATE"; - data: { - guild_id: string; - channel_id: string; - }; -} -export declare type ApplicationCommandPayload = ApplicationCommand & { - guild_id: string; -}; -export interface ApplicationCommandCreateEvent extends Event { - event: "APPLICATION_COMMAND_CREATE"; - data: ApplicationCommandPayload; -} -export interface ApplicationCommandUpdateEvent extends Event { - event: "APPLICATION_COMMAND_UPDATE"; - data: ApplicationCommandPayload; -} -export interface ApplicationCommandDeleteEvent extends Event { - event: "APPLICATION_COMMAND_DELETE"; - data: ApplicationCommandPayload; -} -export interface InteractionCreateEvent extends Event { - event: "INTERACTION_CREATE"; - data: Interaction; -} -export declare enum EVENTEnum { - Ready = "READY", - ChannelCreate = "CHANNEL_CREATE", - ChannelUpdate = "CHANNEL_UPDATE", - ChannelDelete = "CHANNEL_DELETE", - ChannelPinsUpdate = "CHANNEL_PINS_UPDATE", - GuildCreate = "GUILD_CREATE", - GuildUpdate = "GUILD_UPDATE", - GuildDelete = "GUILD_DELETE", - GuildBanAdd = "GUILD_BAN_ADD", - GuildBanRemove = "GUILD_BAN_REMOVE", - GuildEmojUpdate = "GUILD_EMOJI_UPDATE", - GuildIntegrationsUpdate = "GUILD_INTEGRATIONS_UPDATE", - GuildMemberAdd = "GUILD_MEMBER_ADD", - GuildMemberRempve = "GUILD_MEMBER_REMOVE", - GuildMemberUpdate = "GUILD_MEMBER_UPDATE", - GuildMemberSpeaking = "GUILD_MEMBER_SPEAKING", - GuildMembersChunk = "GUILD_MEMBERS_CHUNK", - GuildRoleCreate = "GUILD_ROLE_CREATE", - GuildRoleDelete = "GUILD_ROLE_DELETE", - GuildRoleUpdate = "GUILD_ROLE_UPDATE", - InviteCreate = "INVITE_CREATE", - InviteDelete = "INVITE_DELETE", - MessageCreate = "MESSAGE_CREATE", - MessageUpdate = "MESSAGE_UPDATE", - MessageDelete = "MESSAGE_DELETE", - MessageDeleteBulk = "MESSAGE_DELETE_BULK", - MessageReactionAdd = "MESSAGE_REACTION_ADD", - MessageReactionRemove = "MESSAGE_REACTION_REMOVE", - MessageReactionRemoveAll = "MESSAGE_REACTION_REMOVE_ALL", - MessageReactionRemoveEmoji = "MESSAGE_REACTION_REMOVE_EMOJI", - PresenceUpdate = "PRESENCE_UPDATE", - TypingStart = "TYPING_START", - UserUpdate = "USER_UPDATE", - WebhooksUpdate = "WEBHOOKS_UPDATE", - InteractionCreate = "INTERACTION_CREATE", - VoiceStateUpdate = "VOICE_STATE_UPDATE", - VoiceServerUpdate = "VOICE_SERVER_UPDATE", - ApplicationCommandCreate = "APPLICATION_COMMAND_CREATE", - ApplicationCommandUpdate = "APPLICATION_COMMAND_UPDATE", - ApplicationCommandDelete = "APPLICATION_COMMAND_DELETE" -} -export declare type EVENT = "READY" | "CHANNEL_CREATE" | "CHANNEL_UPDATE" | "CHANNEL_DELETE" | "CHANNEL_PINS_UPDATE" | "GUILD_CREATE" | "GUILD_UPDATE" | "GUILD_DELETE" | "GUILD_BAN_ADD" | "GUILD_BAN_REMOVE" | "GUILD_EMOJI_UPDATE" | "GUILD_INTEGRATIONS_UPDATE" | "GUILD_MEMBER_ADD" | "GUILD_MEMBER_REMOVE" | "GUILD_MEMBER_UPDATE" | "GUILD_MEMBER_SPEAKING" | "GUILD_MEMBERS_CHUNK" | "GUILD_ROLE_CREATE" | "GUILD_ROLE_DELETE" | "GUILD_ROLE_UPDATE" | "INVITE_CREATE" | "INVITE_DELETE" | "MESSAGE_CREATE" | "MESSAGE_UPDATE" | "MESSAGE_DELETE" | "MESSAGE_DELETE_BULK" | "MESSAGE_REACTION_ADD" | "MESSAGE_REACTION_REMOVE" | "MESSAGE_REACTION_REMOVE_ALL" | "MESSAGE_REACTION_REMOVE_EMOJI" | "PRESENCE_UPDATE" | "TYPING_START" | "USER_UPDATE" | "WEBHOOKS_UPDATE" | "INTERACTION_CREATE" | "VOICE_STATE_UPDATE" | "VOICE_SERVER_UPDATE" | "APPLICATION_COMMAND_CREATE" | "APPLICATION_COMMAND_UPDATE" | "APPLICATION_COMMAND_DELETE" | CUSTOMEVENTS; -export declare type CUSTOMEVENTS = "INVALIDATED"; diff --git a/dist/models/Event.js b/dist/models/Event.js deleted file mode 100644 index 9d442aad..00000000 --- a/dist/models/Event.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EVENTEnum = exports.EventModel = exports.EventSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.EventSchema = new mongoose_1.Schema({ - guild_id: String, - user_id: String, - channel_id: String, - created_at: { type: Date, required: true }, - event: { type: String, required: true }, - data: Object, -}); -// @ts-ignore -exports.EventModel = Database_1.default.model("Event", exports.EventSchema, "events"); -// located in collection events -var EVENTEnum; -(function (EVENTEnum) { - EVENTEnum["Ready"] = "READY"; - EVENTEnum["ChannelCreate"] = "CHANNEL_CREATE"; - EVENTEnum["ChannelUpdate"] = "CHANNEL_UPDATE"; - EVENTEnum["ChannelDelete"] = "CHANNEL_DELETE"; - EVENTEnum["ChannelPinsUpdate"] = "CHANNEL_PINS_UPDATE"; - EVENTEnum["GuildCreate"] = "GUILD_CREATE"; - EVENTEnum["GuildUpdate"] = "GUILD_UPDATE"; - EVENTEnum["GuildDelete"] = "GUILD_DELETE"; - EVENTEnum["GuildBanAdd"] = "GUILD_BAN_ADD"; - EVENTEnum["GuildBanRemove"] = "GUILD_BAN_REMOVE"; - EVENTEnum["GuildEmojUpdate"] = "GUILD_EMOJI_UPDATE"; - EVENTEnum["GuildIntegrationsUpdate"] = "GUILD_INTEGRATIONS_UPDATE"; - EVENTEnum["GuildMemberAdd"] = "GUILD_MEMBER_ADD"; - EVENTEnum["GuildMemberRempve"] = "GUILD_MEMBER_REMOVE"; - EVENTEnum["GuildMemberUpdate"] = "GUILD_MEMBER_UPDATE"; - EVENTEnum["GuildMemberSpeaking"] = "GUILD_MEMBER_SPEAKING"; - EVENTEnum["GuildMembersChunk"] = "GUILD_MEMBERS_CHUNK"; - EVENTEnum["GuildRoleCreate"] = "GUILD_ROLE_CREATE"; - EVENTEnum["GuildRoleDelete"] = "GUILD_ROLE_DELETE"; - EVENTEnum["GuildRoleUpdate"] = "GUILD_ROLE_UPDATE"; - EVENTEnum["InviteCreate"] = "INVITE_CREATE"; - EVENTEnum["InviteDelete"] = "INVITE_DELETE"; - EVENTEnum["MessageCreate"] = "MESSAGE_CREATE"; - EVENTEnum["MessageUpdate"] = "MESSAGE_UPDATE"; - EVENTEnum["MessageDelete"] = "MESSAGE_DELETE"; - EVENTEnum["MessageDeleteBulk"] = "MESSAGE_DELETE_BULK"; - EVENTEnum["MessageReactionAdd"] = "MESSAGE_REACTION_ADD"; - EVENTEnum["MessageReactionRemove"] = "MESSAGE_REACTION_REMOVE"; - EVENTEnum["MessageReactionRemoveAll"] = "MESSAGE_REACTION_REMOVE_ALL"; - EVENTEnum["MessageReactionRemoveEmoji"] = "MESSAGE_REACTION_REMOVE_EMOJI"; - EVENTEnum["PresenceUpdate"] = "PRESENCE_UPDATE"; - EVENTEnum["TypingStart"] = "TYPING_START"; - EVENTEnum["UserUpdate"] = "USER_UPDATE"; - EVENTEnum["WebhooksUpdate"] = "WEBHOOKS_UPDATE"; - EVENTEnum["InteractionCreate"] = "INTERACTION_CREATE"; - EVENTEnum["VoiceStateUpdate"] = "VOICE_STATE_UPDATE"; - EVENTEnum["VoiceServerUpdate"] = "VOICE_SERVER_UPDATE"; - EVENTEnum["ApplicationCommandCreate"] = "APPLICATION_COMMAND_CREATE"; - EVENTEnum["ApplicationCommandUpdate"] = "APPLICATION_COMMAND_UPDATE"; - EVENTEnum["ApplicationCommandDelete"] = "APPLICATION_COMMAND_DELETE"; -})(EVENTEnum = exports.EVENTEnum || (exports.EVENTEnum = {})); -//# sourceMappingURL=Event.js.map \ No newline at end of file diff --git a/dist/models/Event.js.map b/dist/models/Event.js.map deleted file mode 100644 index bd27fa9e..00000000 --- a/dist/models/Event.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../src/models/Event.ts"],"names":[],"mappings":";;;;;;AAYA,uCAA0D;AAC1D,gEAAkC;AAarB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1C,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvC,IAAI,EAAE,MAAM;CACZ,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAgB,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC;AAkYlF,+BAA+B;AAE/B,IAAY,SAyCX;AAzCD,WAAY,SAAS;IACpB,4BAAe,CAAA;IACf,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,yCAA4B,CAAA;IAC5B,yCAA4B,CAAA;IAC5B,0CAA6B,CAAA;IAC7B,gDAAmC,CAAA;IACnC,mDAAsC,CAAA;IACtC,kEAAqD,CAAA;IACrD,gDAAmC,CAAA;IACnC,sDAAyC,CAAA;IACzC,sDAAyC,CAAA;IACzC,0DAA6C,CAAA;IAC7C,sDAAyC,CAAA;IACzC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,2CAA8B,CAAA;IAC9B,2CAA8B,CAAA;IAC9B,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,6CAAgC,CAAA;IAChC,sDAAyC,CAAA;IACzC,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;IACjD,qEAAwD,CAAA;IACxD,yEAA4D,CAAA;IAC5D,+CAAkC,CAAA;IAClC,yCAA4B,CAAA;IAC5B,uCAA0B,CAAA;IAC1B,+CAAkC,CAAA;IAClC,qDAAwC,CAAA;IACxC,oDAAuC,CAAA;IACvC,sDAAyC,CAAA;IACzC,oEAAuD,CAAA;IACvD,oEAAuD,CAAA;IACvD,oEAAuD,CAAA;AACxD,CAAC,EAzCW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAyCpB"} \ No newline at end of file diff --git a/dist/models/Guild.d.ts b/dist/models/Guild.d.ts deleted file mode 100644 index d7d94cb2..00000000 --- a/dist/models/Guild.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface GuildDocument extends Document, Guild { - id: string; -} -export interface Guild { - id: string; - afk_channel_id?: string; - afk_timeout?: number; - application_id?: string; - banner?: string; - default_message_notifications?: number; - description?: string; - discovery_splash?: string; - explicit_content_filter?: number; - features: string[]; - icon?: string; - large?: boolean; - max_members?: number; - max_presences?: number; - max_video_channel_users?: number; - member_count?: number; - presence_count?: number; - mfa_level?: number; - name: string; - owner_id: string; - preferred_locale?: string; - premium_subscription_count?: number; - premium_tier?: number; - public_updates_channel_id?: string; - region?: string; - rules_channel_id?: string; - splash?: string; - system_channel_flags?: number; - system_channel_id?: string; - unavailable?: boolean; - vanity_url_code?: string; - verification_level?: number; - welcome_screen: []; - widget_channel_id?: string; - widget_enabled?: boolean; -} -export declare const GuildSchema: Schema, import("mongoose").Model>, undefined>; -export declare const GuildModel: import("mongoose").Model; diff --git a/dist/models/Guild.js b/dist/models/Guild.js deleted file mode 100644 index fa87d542..00000000 --- a/dist/models/Guild.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GuildModel = exports.GuildSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -const Channel_1 = require("./Channel"); -const Emoji_1 = require("./Emoji"); -const Member_1 = require("./Member"); -const Role_1 = require("./Role"); -exports.GuildSchema = new mongoose_1.Schema({ - id: { type: String, required: true }, - afk_channel_id: String, - afk_timeout: Number, - application_id: String, - banner: String, - default_message_notifications: Number, - description: String, - discovery_splash: String, - explicit_content_filter: Number, - features: { type: [String], default: [] }, - icon: String, - large: Boolean, - max_members: { type: Number, default: 100000 }, - max_presences: Number, - max_video_channel_users: { type: Number, default: 25 }, - member_count: Number, - presence_count: Number, - mfa_level: Number, - name: { type: String, required: true }, - owner_id: { type: String, required: true }, - preferred_locale: String, - premium_subscription_count: Number, - premium_tier: Number, - public_updates_channel_id: String, - region: String, - rules_channel_id: String, - splash: String, - system_channel_flags: Number, - system_channel_id: String, - unavailable: Boolean, - vanity_url_code: String, - verification_level: Number, - voice_states: { type: [Object], default: [] }, - welcome_screen: { type: [Object], default: [] }, - widget_channel_id: String, - widget_enabled: Boolean, -}); -exports.GuildSchema.virtual("channels", { - ref: Channel_1.ChannelModel, - localField: "id", - foreignField: "guild_id", - justOne: false, -}); -exports.GuildSchema.virtual("roles", { - ref: Role_1.RoleModel, - localField: "id", - foreignField: "guild_id", - justOne: false, -}); -// nested populate is needed for member users: https://gist.github.com/yangsu/5312204 -exports.GuildSchema.virtual("members", { - ref: Member_1.MemberModel, - localField: "id", - foreignField: "member_id", - justOne: false, -}); -exports.GuildSchema.virtual("emojis", { - ref: Emoji_1.EmojiModel, - localField: "id", - foreignField: "guild_id", - justOne: false, -}); -exports.GuildSchema.virtual("joined_at", { - ref: Member_1.MemberModel, - localField: "id", - foreignField: "guild_id", - justOne: true, -}).get((member, virtual, doc) => { - console.log("get", member, this); - return member.joined_at; -}); -// @ts-ignore -exports.GuildModel = Database_1.default.model("Guild", exports.GuildSchema, "guilds"); -//# sourceMappingURL=Guild.js.map \ No newline at end of file diff --git a/dist/models/Guild.js.map b/dist/models/Guild.js.map deleted file mode 100644 index aaa3951b..00000000 --- a/dist/models/Guild.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Guild.js","sourceRoot":"","sources":["../../src/models/Guild.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAClC,uCAAyC;AACzC,mCAAqC;AACrC,qCAAuC;AACvC,iCAAmC;AAiDtB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpC,cAAc,EAAE,MAAM;IACtB,WAAW,EAAE,MAAM;IACnB,cAAc,EAAE,MAAM;IACtB,MAAM,EAAE,MAAM;IACd,6BAA6B,EAAE,MAAM;IACrC,WAAW,EAAE,MAAM;IACnB,gBAAgB,EAAE,MAAM;IACxB,uBAAuB,EAAE,MAAM;IAC/B,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACzC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE;IAC9C,aAAa,EAAE,MAAM;IACrB,uBAAuB,EAAE,EAAE,IAAI,EAAE,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YAAY,EAAE,WAAW;IACzB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,mBAAW,CAAC,OAAO,CAAC,QAAQ,EAAE;IAC7B,GAAG,EAAE,kBAAU;IACf,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,UAAU;IACxB,OAAO,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,mBAAW,CAAC,OAAO,CAAC,WAAW,EAAE;IAChC,GAAG,EAAE,oBAAW;IAChB,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,UAAU;IACxB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,OAAY,EAAE,GAAQ,EAAE,EAAE;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,SAAS,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAgB,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Interaction.d.ts b/dist/models/Interaction.d.ts deleted file mode 100644 index 53836981..00000000 --- a/dist/models/Interaction.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { AllowedMentions, Embed } from "./Message"; -export interface Interaction { - id: string; - type: InteractionType; - data?: {}; - guild_id: string; - channel_id: string; - member_id: string; - token: string; - version: number; -} -export declare enum InteractionType { - Ping = 1, - ApplicationCommand = 2 -} -export declare enum InteractionResponseType { - Pong = 1, - Acknowledge = 2, - ChannelMessage = 3, - ChannelMessageWithSource = 4, - AcknowledgeWithSource = 5 -} -export interface InteractionApplicationCommandCallbackData { - tts?: boolean; - content: string; - embeds?: Embed[]; - allowed_mentions?: AllowedMentions; -} diff --git a/dist/models/Interaction.js b/dist/models/Interaction.js deleted file mode 100644 index 6985e399..00000000 --- a/dist/models/Interaction.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.InteractionResponseType = exports.InteractionType = void 0; -var InteractionType; -(function (InteractionType) { - InteractionType[InteractionType["Ping"] = 1] = "Ping"; - InteractionType[InteractionType["ApplicationCommand"] = 2] = "ApplicationCommand"; -})(InteractionType = exports.InteractionType || (exports.InteractionType = {})); -var InteractionResponseType; -(function (InteractionResponseType) { - InteractionResponseType[InteractionResponseType["Pong"] = 1] = "Pong"; - InteractionResponseType[InteractionResponseType["Acknowledge"] = 2] = "Acknowledge"; - InteractionResponseType[InteractionResponseType["ChannelMessage"] = 3] = "ChannelMessage"; - InteractionResponseType[InteractionResponseType["ChannelMessageWithSource"] = 4] = "ChannelMessageWithSource"; - InteractionResponseType[InteractionResponseType["AcknowledgeWithSource"] = 5] = "AcknowledgeWithSource"; -})(InteractionResponseType = exports.InteractionResponseType || (exports.InteractionResponseType = {})); -//# sourceMappingURL=Interaction.js.map \ No newline at end of file diff --git a/dist/models/Interaction.js.map b/dist/models/Interaction.js.map deleted file mode 100644 index afdf9f9d..00000000 --- a/dist/models/Interaction.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Interaction.js","sourceRoot":"","sources":["../../src/models/Interaction.ts"],"names":[],"mappings":";;;AAaA,IAAY,eAGX;AAHD,WAAY,eAAe;IAC1B,qDAAQ,CAAA;IACR,iFAAsB,CAAA;AACvB,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AAED,IAAY,uBAMX;AAND,WAAY,uBAAuB;IAClC,qEAAQ,CAAA;IACR,mFAAe,CAAA;IACf,yFAAkB,CAAA;IAClB,6GAA4B,CAAA;IAC5B,uGAAyB,CAAA;AAC1B,CAAC,EANW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAMlC"} \ No newline at end of file diff --git a/dist/models/Invite.d.ts b/dist/models/Invite.d.ts deleted file mode 100644 index e6de64d3..00000000 --- a/dist/models/Invite.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface Invite extends Document { - code: string; - temporary: boolean; - uses: number; - max_uses: number; - max_age: number; - created_at: Date; - guild_id: string; - channel_id: string; - inviter_id: string; - target_user_id?: string; - target_user_type?: number; -} -export declare const InviteSchema: Schema, import("mongoose").Model>, undefined>; -export declare const InviteModel: import("mongoose").Model; diff --git a/dist/models/Invite.js b/dist/models/Invite.js deleted file mode 100644 index 9113abcc..00000000 --- a/dist/models/Invite.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.InviteModel = exports.InviteSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.InviteSchema = new mongoose_1.Schema({ - code: String, - temporary: Boolean, - uses: Number, - max_uses: Number, - max_age: Number, - created_at: Date, - guild_id: String, - channel_id: String, - inviter_id: String, - // ? What the fucking shit is this - target_user_id: String, - target_user_type: Number, -}); -// @ts-ignore -exports.InviteModel = Database_1.default.model("Invite", exports.InviteSchema, "invites"); -//# sourceMappingURL=Invite.js.map \ No newline at end of file diff --git a/dist/models/Invite.js.map b/dist/models/Invite.js.map deleted file mode 100644 index 3e69e1d1..00000000 --- a/dist/models/Invite.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Invite.js","sourceRoot":"","sources":["../../src/models/Invite.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAkBrB,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAElB,kCAAkC;IAClC,cAAc,EAAE,MAAM;IACtB,gBAAgB,EAAE,MAAM;CACxB,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,WAAW,GAAG,kBAAE,CAAC,KAAK,CAAS,QAAQ,EAAE,oBAAY,EAAE,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Member.d.ts b/dist/models/Member.d.ts deleted file mode 100644 index 26079e7c..00000000 --- a/dist/models/Member.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// -import { PublicUser, User } from "./User"; -import { Schema, Document } from "mongoose"; -export interface Member { - id: string; - guild_id: string; - nick?: string; - roles: string[]; - joined_at: Date; - premium_since?: number; - deaf: boolean; - mute: boolean; - pending: boolean; - settings: UserGuildSettings; - user?: User; -} -export interface MemberDocument extends Member, Document { - id: string; -} -export interface UserGuildSettings { - channel_overrides: { - channel_id: string; - message_notifications: number; - mute_config: MuteConfig; - muted: boolean; - }[]; - message_notifications: number; - mobile_push: boolean; - mute_config: MuteConfig; - muted: boolean; - suppress_everyone: boolean; - suppress_roles: boolean; - version: number; -} -export interface MuteConfig { - end_time: number; - selected_time_window: number; -} -export declare const MemberSchema: Schema, import("mongoose").Model>, undefined>; -export declare const MemberModel: import("mongoose").Model; -export interface PublicMember extends Omit { - user: PublicUser; -} diff --git a/dist/models/Member.js b/dist/models/Member.js deleted file mode 100644 index c7717dd2..00000000 --- a/dist/models/Member.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MemberModel = exports.MemberSchema = void 0; -const User_1 = require("./User"); -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -const MuteConfig = { - end_time: Number, - selected_time_window: Number, -}; -exports.MemberSchema = new mongoose_1.Schema({ - id: { type: String, required: true }, - guild_id: String, - nick: String, - roles: [String], - joined_at: Date, - premium_since: Number, - deaf: Boolean, - mute: Boolean, - pending: Boolean, - settings: { - channel_overrides: [ - { - channel_id: String, - message_notifications: Number, - mute_config: MuteConfig, - muted: Boolean, - }, - ], - message_notifications: Number, - mobile_push: Boolean, - mute_config: MuteConfig, - muted: Boolean, - suppress_everyone: Boolean, - suppress_roles: Boolean, - version: Number, - }, -}); -exports.MemberSchema.virtual("user", { - ref: User_1.UserModel, - localField: "id", - foreignField: "id", - justOne: true, -}); -// @ts-ignore -exports.MemberModel = Database_1.default.model("Member", exports.MemberSchema, "members"); -//# sourceMappingURL=Member.js.map \ No newline at end of file diff --git a/dist/models/Member.js.map b/dist/models/Member.js.map deleted file mode 100644 index c39e4bd1..00000000 --- a/dist/models/Member.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Member.js","sourceRoot":"","sources":["../../src/models/Member.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAqD;AACrD,uCAAmD;AACnD,gEAAkC;AAyClC,MAAM,UAAU,GAAG;IAClB,QAAQ,EAAE,MAAM;IAChB,oBAAoB,EAAE,MAAM;CAC5B,CAAC;AAEW,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpC,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,CAAC,MAAM,CAAC;IACf,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,MAAM;IACrB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE;QACT,iBAAiB,EAAE;YAClB;gBACC,UAAU,EAAE,MAAM;gBAClB,qBAAqB,EAAE,MAAM;gBAC7B,WAAW,EAAE,UAAU;gBACvB,KAAK,EAAE,OAAO;aACd;SACD;QACD,qBAAqB,EAAE,MAAM;QAC7B,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE,OAAO;QACd,iBAAiB,EAAE,OAAO;QAC1B,cAAc,EAAE,OAAO;QACvB,OAAO,EAAE,MAAM;KACf;CACD,CAAC,CAAC;AAEH,oBAAY,CAAC,OAAO,CAAC,MAAM,EAAE;IAC5B,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,WAAW,GAAG,kBAAE,CAAC,KAAK,CAAiB,QAAQ,EAAE,oBAAY,EAAE,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Message.d.ts b/dist/models/Message.d.ts deleted file mode 100644 index a629f7ee..00000000 --- a/dist/models/Message.d.ts +++ /dev/null @@ -1,181 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface Message { - id: string; - channel_id: string; - guild_id?: string; - author_id?: string; - webhook_id?: string; - application_id?: string; - content?: string; - timestamp: Date; - edited_timestamp?: Date; - tts?: boolean; - mention_everyone?: boolean; - mention_user_ids: string[]; - mention_role_ids: string[]; - mention_channels_ids: string[]; - attachments: Attachment[]; - embeds: Embed[]; - reactions: Reaction[]; - nonce?: string | number; - pinned?: boolean; - type: MessageType; - activity?: { - type: number; - party_id: string; - }; - flags?: bigint; - stickers?: []; - message_reference?: { - message_id: string; - channel_id?: string; - guild_id?: string; - }; -} -export interface MessageDocument extends Document, Message { - id: string; -} -export declare enum MessageType { - DEFAULT = 0, - RECIPIENT_ADD = 1, - RECIPIENT_REMOVE = 2, - CALL = 3, - CHANNEL_NAME_CHANGE = 4, - CHANNEL_ICON_CHANGE = 5, - CHANNEL_PINNED_MESSAGE = 6, - GUILD_MEMBER_JOIN = 7, - USER_PREMIUM_GUILD_SUBSCRIPTION = 8, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10, - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11, - CHANNEL_FOLLOW_ADD = 12, - GUILD_DISCOVERY_DISQUALIFIED = 14, - GUILD_DISCOVERY_REQUALIFIED = 15, - REPLY = 19, - APPLICATION_COMMAND = 20 -} -export interface Attachment { - id: string; - filename: string; - size: number; - url: string; - proxy_url: string; - height: number; - width: number; -} -export interface Embed { - title?: string; - type?: string; - description?: string; - url?: string; - timestamp?: Date; - color?: number; - footer?: { - text: string; - icon_url?: string; - proxy_icon_url?: string; - }; - image?: EmbedImage; - thumbnail?: EmbedImage; - video?: EmbedImage; - provider?: { - name?: string; - url?: string; - }; - author?: { - name?: string; - url?: string; - icon_url?: string; - proxy_icon_url?: string; - }; - fields?: { - name: string; - value: string; - inline?: boolean; - }[]; -} -export interface EmbedImage { - url?: string; - proxy_url?: string; - height?: number; - width?: number; -} -export interface Reaction { - count: number; - emoji: PartialEmoji; -} -export interface PartialEmoji { - id?: string; - name: string; - animated?: boolean; -} -export interface AllowedMentions { - parse?: ("users" | "roles" | "everyone")[]; - roles?: string[]; - users?: string[]; - replied_user?: boolean; -} -export declare const Attachment: { - id: StringConstructor; - filename: StringConstructor; - size: NumberConstructor; - url: StringConstructor; - proxy_url: StringConstructor; - height: NumberConstructor; - width: NumberConstructor; -}; -export declare const EmbedImage: { - url: StringConstructor; - proxy_url: StringConstructor; - height: NumberConstructor; - width: NumberConstructor; -}; -export declare const Embed: { - title: StringConstructor; - type: StringConstructor; - description: StringConstructor; - url: StringConstructor; - timestamp: DateConstructor; - color: NumberConstructor; - footer: { - text: StringConstructor; - icon_url: StringConstructor; - proxy_icon_url: StringConstructor; - }; - image: { - url: StringConstructor; - proxy_url: StringConstructor; - height: NumberConstructor; - width: NumberConstructor; - }; - thumbnail: { - url: StringConstructor; - proxy_url: StringConstructor; - height: NumberConstructor; - width: NumberConstructor; - }; - video: { - url: StringConstructor; - proxy_url: StringConstructor; - height: NumberConstructor; - width: NumberConstructor; - }; - provider: { - name: StringConstructor; - url: StringConstructor; - }; - author: { - name: StringConstructor; - url: StringConstructor; - icon_url: StringConstructor; - proxy_icon_url: StringConstructor; - }; - fields: { - name: StringConstructor; - value: StringConstructor; - inline: BooleanConstructor; - }[]; -}; -export declare const MessageSchema: Schema, import("mongoose").Model>, undefined>; -export declare const MessageModel: import("mongoose").Model; diff --git a/dist/models/Message.js b/dist/models/Message.js deleted file mode 100644 index 18bb509d..00000000 --- a/dist/models/Message.js +++ /dev/null @@ -1,160 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MessageModel = exports.MessageSchema = exports.Embed = exports.EmbedImage = exports.Attachment = exports.MessageType = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -const User_1 = require("./User"); -const Member_1 = require("./Member"); -const Role_1 = require("./Role"); -var MessageType; -(function (MessageType) { - MessageType[MessageType["DEFAULT"] = 0] = "DEFAULT"; - MessageType[MessageType["RECIPIENT_ADD"] = 1] = "RECIPIENT_ADD"; - MessageType[MessageType["RECIPIENT_REMOVE"] = 2] = "RECIPIENT_REMOVE"; - MessageType[MessageType["CALL"] = 3] = "CALL"; - MessageType[MessageType["CHANNEL_NAME_CHANGE"] = 4] = "CHANNEL_NAME_CHANGE"; - MessageType[MessageType["CHANNEL_ICON_CHANGE"] = 5] = "CHANNEL_ICON_CHANGE"; - MessageType[MessageType["CHANNEL_PINNED_MESSAGE"] = 6] = "CHANNEL_PINNED_MESSAGE"; - MessageType[MessageType["GUILD_MEMBER_JOIN"] = 7] = "GUILD_MEMBER_JOIN"; - MessageType[MessageType["USER_PREMIUM_GUILD_SUBSCRIPTION"] = 8] = "USER_PREMIUM_GUILD_SUBSCRIPTION"; - MessageType[MessageType["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1"] = 9] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1"; - MessageType[MessageType["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2"] = 10] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2"; - MessageType[MessageType["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3"] = 11] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3"; - MessageType[MessageType["CHANNEL_FOLLOW_ADD"] = 12] = "CHANNEL_FOLLOW_ADD"; - MessageType[MessageType["GUILD_DISCOVERY_DISQUALIFIED"] = 14] = "GUILD_DISCOVERY_DISQUALIFIED"; - MessageType[MessageType["GUILD_DISCOVERY_REQUALIFIED"] = 15] = "GUILD_DISCOVERY_REQUALIFIED"; - MessageType[MessageType["REPLY"] = 19] = "REPLY"; - MessageType[MessageType["APPLICATION_COMMAND"] = 20] = "APPLICATION_COMMAND"; -})(MessageType = exports.MessageType || (exports.MessageType = {})); -exports.Attachment = { - id: String, - filename: String, - size: Number, - url: String, - proxy_url: String, - height: Number, - width: Number, -}; -exports.EmbedImage = { - url: String, - proxy_url: String, - height: Number, - width: Number, -}; -const Reaction = { - count: Number, - emoji: { - id: String, - name: String, - animated: Boolean, - }, -}; -exports.Embed = { - title: String, - type: String, - description: String, - url: String, - timestamp: Date, - color: Number, - footer: { - text: String, - icon_url: String, - proxy_icon_url: String, - }, - image: exports.EmbedImage, - thumbnail: exports.EmbedImage, - video: exports.EmbedImage, - provider: { - name: String, - url: String, - }, - author: { - name: String, - url: String, - icon_url: String, - proxy_icon_url: String, - }, - fields: [ - { - name: String, - value: String, - inline: Boolean, - }, - ], -}; -exports.MessageSchema = new mongoose_1.Schema({ - id: String, - channel_id: String, - author_id: String, - webhook_id: String, - guild_id: String, - application_id: String, - content: String, - timestamp: Date, - edited_timestamp: Date, - tts: Boolean, - mention_everyone: Boolean, - mention_user_ids: [String], - mention_role_ids: [String], - mention_channel_ids: [String], - attachments: [exports.Attachment], - embeds: [exports.Embed], - reactions: [Reaction], - nonce: mongoose_1.Schema.Types.Mixed, - pinned: Boolean, - type: { type: Number }, - activity: { - type: Number, - party_id: String, - }, - flags: mongoose_1.Types.Long, - stickers: [], - message_reference: { - message_id: String, - channel_id: String, - guild_id: String, - }, -}); -exports.MessageSchema.virtual("author", { - ref: User_1.UserModel, - localField: "author_id", - foreignField: "id", - justOne: true, -}); -exports.MessageSchema.virtual("member", { - ref: Member_1.MemberModel, - localField: "author_id", - foreignField: "id", - justOne: true, -}); -exports.MessageSchema.virtual("mentions", { - ref: User_1.UserModel, - localField: "mention_user_ids", - foreignField: "id", - justOne: false, -}); -exports.MessageSchema.virtual("mention_roles", { - ref: Role_1.RoleModel, - localField: "mention_role_ids", - foreignField: "id", - justOne: false, -}); -exports.MessageSchema.virtual("mention_channels", { - ref: Role_1.RoleModel, - localField: "mention_channel_ids", - foreignField: "id", - justOne: false, -}); -// TODO: missing Application Model -// MessageSchema.virtual("application", { -// ref: Application, -// localField: "mention_role_ids", -// foreignField: "id", -// justOne: true, -// }); -// @ts-ignore -exports.MessageModel = Database_1.default.model("Message", exports.MessageSchema, "messages"); -//# sourceMappingURL=Message.js.map \ No newline at end of file diff --git a/dist/models/Message.js.map b/dist/models/Message.js.map deleted file mode 100644 index 2e617b31..00000000 --- a/dist/models/Message.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../src/models/Message.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmD;AACnD,gEAAkC;AAClC,iCAAmC;AACnC,qCAAuC;AACvC,iCAAmC;AAwCnC,IAAY,WAkBX;AAlBD,WAAY,WAAW;IACtB,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,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I;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/Role.d.ts b/dist/models/Role.d.ts deleted file mode 100644 index d6765283..00000000 --- a/dist/models/Role.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface Role { - id: string; - guild_id: string; - color: number; - hoist: boolean; - managed: boolean; - mentionable: boolean; - name: string; - permissions: bigint; - position: number; - tags?: { - bot_id?: string; - }; -} -export interface RoleDocument extends Document, Role { - id: string; -} -export declare const RoleSchema: Schema, import("mongoose").Model>, undefined>; -export declare const RoleModel: import("mongoose").Model; diff --git a/dist/models/Role.js b/dist/models/Role.js deleted file mode 100644 index 86c06db9..00000000 --- a/dist/models/Role.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.RoleModel = exports.RoleSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.RoleSchema = new mongoose_1.Schema({ - id: String, - guild_id: String, - color: Number, - hoist: Boolean, - managed: Boolean, - mentionable: Boolean, - name: String, - permissions: mongoose_1.Types.Long, - position: Number, - tags: { - bot_id: String, - }, -}); -// @ts-ignore -exports.RoleModel = Database_1.default.model("Role", exports.RoleSchema, "roles"); -//# sourceMappingURL=Role.js.map \ No newline at end of file diff --git a/dist/models/Role.js.map b/dist/models/Role.js.map deleted file mode 100644 index 87872154..00000000 --- a/dist/models/Role.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Role.js","sourceRoot":"","sources":["../../src/models/Role.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAqBrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,gBAAK,CAAC,IAAI;IACvB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE;QACL,MAAM,EAAE,MAAM;KACd;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/Status.d.ts b/dist/models/Status.d.ts deleted file mode 100644 index 424a16b2..00000000 --- a/dist/models/Status.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export declare type Status = "idle" | "dnd" | "online" | "offline"; -export interface ClientStatus { - desktop?: string; - mobile?: string; - web?: string; -} -export declare const ClientStatus: { - desktop: StringConstructor; - mobile: StringConstructor; - web: StringConstructor; -}; diff --git a/dist/models/Status.js b/dist/models/Status.js deleted file mode 100644 index 992d9cae..00000000 --- a/dist/models/Status.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClientStatus = void 0; -exports.ClientStatus = { - desktop: String, - mobile: String, - web: String, -}; -//# sourceMappingURL=Status.js.map \ No newline at end of file diff --git a/dist/models/Status.js.map b/dist/models/Status.js.map deleted file mode 100644 index 1d5d65f7..00000000 --- a/dist/models/Status.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Status.js","sourceRoot":"","sources":["../../src/models/Status.ts"],"names":[],"mappings":";;;AAQa,QAAA,YAAY,GAAG;IAC3B,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,MAAM;IACd,GAAG,EAAE,MAAM;CACX,CAAC"} \ No newline at end of file diff --git a/dist/models/User.d.ts b/dist/models/User.d.ts deleted file mode 100644 index b5ecf123..00000000 --- a/dist/models/User.d.ts +++ /dev/null @@ -1,113 +0,0 @@ -/// -import { Activity } from "./Activity"; -import { ClientStatus, Status } from "./Status"; -import { Schema, Document } from "mongoose"; -export interface User { - id: string; - username: string; - discriminator: string; - avatar: string | null; - phone?: string; - desktop: boolean; - mobile: boolean; - premium: boolean; - premium_type: number; - bot: boolean; - system: boolean; - nsfw_allowed: boolean; - mfa_enabled: boolean; - created_at: Date; - verified: boolean; - email?: string; - flags: bigint; - public_flags: bigint; - user_settings: UserSettings; - guilds: string[]; - user_data: UserData; - presence: { - status: Status; - activities: Activity[]; - client_status: ClientStatus; - }; -} -export interface UserData { - valid_tokens_since: Date; - relationships: Relationship[]; - connected_accounts: ConnectedAccount[]; - hash: string; - fingerprints: string[]; -} -export interface UserDocument extends User, Document { - id: string; -} -export interface PublicUser { - id: string; - discriminator: string; - username: string; - avatar?: string; - public_flags: bigint; -} -export interface ConnectedAccount { - access_token: string; - friend_sync: boolean; - id: string; - name: string; - revoked: boolean; - show_activity: boolean; - type: string; - verifie: boolean; - visibility: number; -} -export interface Relationship { - id: string; - nickname?: string; - type: number; - user_id: string; -} -export interface UserSettings { - afk_timeout: number; - allow_accessibility_detection: boolean; - animate_emoji: boolean; - animate_stickers: number; - contact_sync_enabled: boolean; - convert_emoticons: boolean; - custom_status: { - emoji_id: string | null; - emoji_name: string | null; - expires_at: number | null; - text: string | null; - }; - default_guilds_restricted: boolean; - detect_platform_accounts: boolean; - developer_mode: boolean; - disable_games_tab: boolean; - enable_tts_command: boolean; - explicit_content_filter: number; - friend_source_flags: { - all: boolean; - }; - gateway_connected: boolean; - gif_auto_play: boolean; - guild_folders: { - color: number; - guild_ids: string[]; - id: number; - name: string; - }[]; - guild_positions: string[]; - inline_attachment_media: boolean; - inline_embed_media: boolean; - locale: string; - message_display_compact: boolean; - native_phone_integration_enabled: boolean; - render_embeds: boolean; - render_reactions: boolean; - restricted_guilds: string[]; - show_current_game: boolean; - status: "online" | "offline" | "dnd" | "idle"; - stream_notifications_enabled: boolean; - theme: "dark" | "white"; - timezone_offset: number; -} -export declare const UserSchema: Schema, import("mongoose").Model>, undefined>; -export declare const UserModel: import("mongoose").Model; diff --git a/dist/models/User.js b/dist/models/User.js deleted file mode 100644 index e8caec6a..00000000 --- a/dist/models/User.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.UserModel = exports.UserSchema = void 0; -const Activity_1 = require("./Activity"); -const Status_1 = require("./Status"); -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.UserSchema = new mongoose_1.Schema({ - id: String, - username: String, - discriminator: String, - avatar: String, - phone: String, - desktop: Boolean, - mobile: Boolean, - premium: Boolean, - premium_type: Number, - bot: Boolean, - system: Boolean, - nsfw_allowed: Boolean, - mfa_enabled: Boolean, - created_at: Date, - verified: Boolean, - email: String, - flags: mongoose_1.Types.Long, - public_flags: mongoose_1.Types.Long, - guilds: [String], - user_data: { - fingerprints: [String], - hash: String, - valid_tokens_since: Date, - relationships: [ - { - id: String, - nickname: String, - type: Number, - user_id: String, - }, - ], - connected_accounts: [ - { - access_token: String, - friend_sync: Boolean, - id: String, - name: String, - revoked: Boolean, - show_activity: Boolean, - type: String, - verifie: Boolean, - visibility: Number, - }, - ], - }, - user_settings: { - afk_timeout: Number, - allow_accessibility_detection: Boolean, - animate_emoji: Boolean, - animate_stickers: Number, - contact_sync_enabled: Boolean, - convert_emoticons: Boolean, - custom_status: { - emoji_id: String, - emoji_name: String, - expires_at: Number, - text: String, - }, - default_guilds_restricted: Boolean, - detect_platform_accounts: Boolean, - developer_mode: Boolean, - disable_games_tab: Boolean, - enable_tts_command: Boolean, - explicit_content_filter: Number, - friend_source_flags: { all: Boolean }, - gateway_connected: Boolean, - gif_auto_play: Boolean, - // every top guild is displayed as a "folder" - guild_folders: [ - { - color: Number, - guild_ids: [String], - id: Number, - name: String, - }, - ], - guild_positions: [String], - inline_attachment_media: Boolean, - inline_embed_media: Boolean, - locale: String, - message_display_compact: Boolean, - native_phone_integration_enabled: Boolean, - render_embeds: Boolean, - render_reactions: Boolean, - restricted_guilds: [String], - show_current_game: Boolean, - status: String, - stream_notifications_enabled: Boolean, - theme: String, - timezone_offset: Number, - }, - presence: { - status: String, - activities: [Activity_1.Activity], - client_status: Status_1.ClientStatus, - }, -}); -// @ts-ignore -exports.UserModel = Database_1.default.model("User", exports.UserSchema, "users"); -//# sourceMappingURL=User.js.map \ No newline at end of file diff --git a/dist/models/User.js.map b/dist/models/User.js.map deleted file mode 100644 index fa26f77a..00000000 --- a/dist/models/User.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AACtC,qCAAgD;AAChD,uCAAmD;AACnD,gEAAkC;AAoHrB,QAAA,UAAU,GAAG,IAAI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,EAAE,MAAM;YAClB,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,MAAM;SACZ;QACD,yBAAyB,EAAE,OAAO;QAClC,wBAAwB,EAAE,OAAO;QACjC,cAAc,EAAE,OAAO;QACvB,iBAAiB,EAAE,OAAO;QAC1B,kBAAkB,EAAE,OAAO;QAC3B,uBAAuB,EAAE,MAAM;QAC/B,mBAAmB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;QACrC,iBAAiB,EAAE,OAAO;QAC1B,aAAa,EAAE,OAAO;QACtB,6CAA6C;QAC7C,aAAa,EAAE;YACd;gBACC,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,CAAC,MAAM,CAAC;gBACnB,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,MAAM;aACZ;SACD;QACD,eAAe,EAAE,CAAC,MAAM,CAAC;QACzB,uBAAuB,EAAE,OAAO;QAChC,kBAAkB,EAAE,OAAO;QAC3B,MAAM,EAAE,MAAM;QACd,uBAAuB,EAAE,OAAO;QAChC,gCAAgC,EAAE,OAAO;QACzC,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,CAAC,MAAM,CAAC;QAC3B,iBAAiB,EAAE,OAAO;QAC1B,MAAM,EAAE,MAAM;QACd,4BAA4B,EAAE,OAAO;QACrC,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;KACvB;IAED,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,CAAC,mBAAQ,CAAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/VoiceState.d.ts b/dist/models/VoiceState.d.ts deleted file mode 100644 index cf0fa523..00000000 --- a/dist/models/VoiceState.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -export interface VoiceState extends Document { - guild_id?: string; - channel_id: string; - user_id: string; - session_id: string; - deaf: boolean; - mute: boolean; - self_deaf: boolean; - self_mute: boolean; - self_stream?: boolean; - self_video: boolean; - suppress: boolean; -} -export declare const VoiceSateSchema: Schema, import("mongoose").Model>, undefined>; -export declare const VoiceStateModel: import("mongoose").Model; diff --git a/dist/models/VoiceState.js b/dist/models/VoiceState.js deleted file mode 100644 index d96a5ad4..00000000 --- a/dist/models/VoiceState.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VoiceStateModel = exports.VoiceSateSchema = void 0; -const mongoose_1 = require("mongoose"); -const Database_1 = __importDefault(require("../util/Database")); -exports.VoiceSateSchema = new mongoose_1.Schema({ - guild_id: String, - channel_id: String, - user_id: String, - session_id: String, - deaf: Boolean, - mute: Boolean, - self_deaf: Boolean, - self_mute: Boolean, - self_stream: Boolean, - self_video: Boolean, - suppress: Boolean, -}); -// @ts-ignore -exports.VoiceStateModel = Database_1.default.model("VoiceState", exports.VoiceSateSchema, "voicestates"); -//# sourceMappingURL=VoiceState.js.map \ No newline at end of file diff --git a/dist/models/VoiceState.js.map b/dist/models/VoiceState.js.map deleted file mode 100644 index 1e7905d8..00000000 --- a/dist/models/VoiceState.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"VoiceState.js","sourceRoot":"","sources":["../../src/models/VoiceState.ts"],"names":[],"mappings":";;;;;;AACA,uCAA0D;AAC1D,gEAAkC;AAgBrB,QAAA,eAAe,GAAG,IAAI,iBAAM,CAAC;IACzC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,OAAO;IAClB,SAAS,EAAE,OAAO;IAClB,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE,OAAO;IACnB,QAAQ,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,eAAe,GAAG,kBAAE,CAAC,KAAK,CAAa,YAAY,EAAE,uBAAe,EAAE,aAAa,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/util/BitField.d.ts b/dist/util/BitField.d.ts deleted file mode 100644 index 1b08c1f8..00000000 --- a/dist/util/BitField.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -export declare type BitFieldResolvable = number | BigInt | BitField | string | BitFieldResolvable[]; -/** - * Data structure that makes it easy to interact with a bitfield. - */ -export declare class BitField { - bitfield: bigint; - static FLAGS: Record; - constructor(bits?: BitFieldResolvable); - /** - * Checks whether the bitfield has a bit, or any of multiple bits. - */ - any(bit: BitFieldResolvable): boolean; - /** - * Checks if this bitfield equals another - */ - equals(bit: BitFieldResolvable): boolean; - /** - * Checks whether the bitfield has a bit, or multiple bits. - */ - has(bit: BitFieldResolvable): boolean; - /** - * Gets all given bits that are missing from the bitfield. - */ - missing(bits: BitFieldResolvable): BitFieldResolvable[]; - /** - * Freezes these bits, making them immutable. - */ - freeze(): Readonly; - /** - * Adds bits to these ones. - * @param {...BitFieldResolvable} [bits] Bits to add - * @returns {BitField} These bits or new BitField if the instance is frozen. - */ - add(...bits: BitFieldResolvable[]): BitField; - /** - * Removes bits from these. - * @param {...BitFieldResolvable} [bits] Bits to remove - */ - remove(...bits: BitFieldResolvable[]): BitField; - /** - * Gets an object mapping field names to a {@link boolean} indicating whether the - * bit is available. - * @param {...*} hasParams Additional parameters for the has method, if any - */ - serialize(): Record; - /** - * Gets an {@link Array} of bitfield names based on the bits available. - */ - toArray(): string[]; - toJSON(): bigint; - valueOf(): bigint; - [Symbol.iterator](): Generator; - /** - * Data that can be resolved to give a bitfield. This can be: - * * A bit number (this can be a number literal or a value taken from {@link BitField.FLAGS}) - * * An instance of BitField - * * An Array of BitFieldResolvable - * @typedef {number|BitField|BitFieldResolvable[]} BitFieldResolvable - */ - /** - * Resolves bitfields to their numeric form. - * @param {BitFieldResolvable} [bit=0] - bit(s) to resolve - * @returns {number} - */ - static resolve(bit?: BitFieldResolvable): bigint; -} diff --git a/dist/util/BitField.js b/dist/util/BitField.js deleted file mode 100644 index 46b101ef..00000000 --- a/dist/util/BitField.js +++ /dev/null @@ -1,133 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BitField = void 0; -/** - * Data structure that makes it easy to interact with a bitfield. - */ -class BitField { - constructor(bits = 0) { - this.bitfield = BigInt(0); - this.bitfield = BitField.resolve.call(this, bits); - } - /** - * Checks whether the bitfield has a bit, or any of multiple bits. - */ - any(bit) { - return (this.bitfield & BitField.resolve.call(this, bit)) !== 0n; - } - /** - * Checks if this bitfield equals another - */ - equals(bit) { - return this.bitfield === BitField.resolve.call(this, bit); - } - /** - * Checks whether the bitfield has a bit, or multiple bits. - */ - has(bit) { - if (Array.isArray(bit)) - return bit.every((p) => this.has(p)); - const BIT = BitField.resolve.call(this, bit); - return (this.bitfield & BIT) === BIT; - } - /** - * Gets all given bits that are missing from the bitfield. - */ - missing(bits) { - if (!Array.isArray(bits)) - bits = new BitField(bits).toArray(); - return bits.filter((p) => !this.has(p)); - } - /** - * Freezes these bits, making them immutable. - */ - freeze() { - return Object.freeze(this); - } - /** - * Adds bits to these ones. - * @param {...BitFieldResolvable} [bits] Bits to add - * @returns {BitField} These bits or new BitField if the instance is frozen. - */ - add(...bits) { - let total = 0n; - for (const bit of bits) { - total |= BitField.resolve.call(this, bit); - } - if (Object.isFrozen(this)) - return new BitField(this.bitfield | total); - this.bitfield |= total; - return this; - } - /** - * Removes bits from these. - * @param {...BitFieldResolvable} [bits] Bits to remove - */ - remove(...bits) { - let total = 0n; - for (const bit of bits) { - total |= BitField.resolve.call(this, bit); - } - if (Object.isFrozen(this)) - return new BitField(this.bitfield & ~total); - this.bitfield &= ~total; - return this; - } - /** - * Gets an object mapping field names to a {@link boolean} indicating whether the - * bit is available. - * @param {...*} hasParams Additional parameters for the has method, if any - */ - serialize() { - const serialized = {}; - for (const [flag, bit] of Object.entries(BitField.FLAGS)) - serialized[flag] = this.has(bit); - return serialized; - } - /** - * Gets an {@link Array} of bitfield names based on the bits available. - */ - toArray() { - return Object.keys(BitField.FLAGS).filter((bit) => this.has(bit)); - } - toJSON() { - return this.bitfield; - } - valueOf() { - return this.bitfield; - } - *[Symbol.iterator]() { - yield* this.toArray(); - } - /** - * Data that can be resolved to give a bitfield. This can be: - * * A bit number (this can be a number literal or a value taken from {@link BitField.FLAGS}) - * * An instance of BitField - * * An Array of BitFieldResolvable - * @typedef {number|BitField|BitFieldResolvable[]} BitFieldResolvable - */ - /** - * Resolves bitfields to their numeric form. - * @param {BitFieldResolvable} [bit=0] - bit(s) to resolve - * @returns {number} - */ - static resolve(bit = 0n) { - // @ts-ignore - const FLAGS = this.FLAGS || this.constructor?.FLAGS; - if ((typeof bit === "number" || typeof bit === "bigint") && bit >= 0n) - return BigInt(bit); - if (bit instanceof BitField) - return bit.bitfield; - if (Array.isArray(bit)) { - // @ts-ignore - const resolve = this.constructor?.resolve || this.resolve; - return bit.map((p) => resolve(p)).reduce((prev, p) => BigInt(prev) | BigInt(p), 0n); - } - if (typeof bit === "string" && typeof FLAGS[bit] !== "undefined") - return FLAGS[bit]; - throw new RangeError("BITFIELD_INVALID: " + bit); - } -} -exports.BitField = BitField; -BitField.FLAGS = {}; -//# sourceMappingURL=BitField.js.map \ No newline at end of file diff --git a/dist/util/BitField.js.map b/dist/util/BitField.js.map deleted file mode 100644 index 7a783db7..00000000 --- a/dist/util/BitField.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"BitField.js","sourceRoot":"","sources":["../../src/util/BitField.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAOb;;GAEG;AACH,MAAa,QAAQ;IAKpB,YAAY,OAA2B,CA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G,CAAC,CAAC;QACpF,MAAM,IAAI,UAAU,CAAC,oBAAoB,GAAG,GAAG,CAAC,CAAC;IAClD,CAAC;;AAnIF,4BAoIC;AAjIc,cAAK,GAA2B,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/util/Config.d.ts b/dist/util/Config.d.ts deleted file mode 100644 index efab99c2..00000000 --- a/dist/util/Config.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// -import { Schema, Document } from "mongoose"; -import "missing-native-js-functions"; -declare const _default: { - init: (defaultOpts?: any) => Promise; - getAll: () => DefaultOptions; - setAll: (val: any) => Promise; -}; -export default _default; -export declare const DefaultOptions: { - api: {}; - gateway: {}; - voice: {}; -}; -export interface DefaultOptions extends Document { - api?: any; - gateway?: any; - voice?: any; -} -export declare const ConfigSchema: Schema, import("mongoose").Model>, undefined>; -export declare const ConfigModel: import("mongoose").Model; diff --git a/dist/util/Config.js b/dist/util/Config.js deleted file mode 100644 index e2aaa7be..00000000 --- a/dist/util/Config.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConfigModel = exports.ConfigSchema = exports.DefaultOptions = void 0; -const mongoose_1 = require("mongoose"); -require("missing-native-js-functions"); -const Database_1 = __importStar(require("./Database")); -var Config = new Database_1.MongooseCache(Database_1.default.collection("config"), [], { onlyEvents: false }); -exports.default = { - init: async function init(defaultOpts = exports.DefaultOptions) { - await Config.init(); - return this.setAll(Config.data.merge(defaultOpts)); - }, - getAll: function get() { - return Config.data; - }, - setAll: function set(val) { - return Database_1.default.collection("config").updateOne({}, { $set: val }, { upsert: true }); - }, -}; -exports.DefaultOptions = { - api: {}, - gateway: {}, - voice: {}, -}; -exports.ConfigSchema = new mongoose_1.Schema({ - api: Object, - gateway: Object, - voice: Object, -}); -exports.ConfigModel = mongoose_1.model("Config", exports.ConfigSchema, "config"); -//# sourceMappingURL=Config.js.map \ No newline at end of file diff --git a/dist/util/Config.js.map b/dist/util/Config.js.map deleted file mode 100644 index 71297a97..00000000 --- a/dist/util/Config.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/util/Config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA0D;AAC1D,uCAAqC;AACrC,uDAA+C;AAE/C,IAAI,MAAM,GAAG,IAAI,wBAAa,CAAC,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AAEnF,kBAAe;IACd,IAAI,EAAE,KAAK,UAAU,IAAI,CAAC,cAAmB,sBAAc;QAC1D,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,EAAE,SAAS,GAAG;QACnB,OAAuB,MAAM,CAAC,IAAI,CAAC;IACpC,CAAC;IACD,MAAM,EAAE,SAAS,GAAG,CAAC,GAAQ;QAC5B,OAAO,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;CACD,CAAC;AAEW,QAAA,cAAc,GAAG;IAC7B,GAAG,EAAE,EAAE;IACP,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE;CACT,CAAC;AAQW,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,MAAM;CACb,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,gBAAK,CAAiB,QAAQ,EAAE,oBAAY,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/util/Constants.d.ts b/dist/util/Constants.d.ts deleted file mode 100644 index ecceb4e6..00000000 --- a/dist/util/Constants.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { VerifyOptions } from "jsonwebtoken"; -export declare const JWTOptions: VerifyOptions; diff --git a/dist/util/Constants.js b/dist/util/Constants.js deleted file mode 100644 index d65f8185..00000000 --- a/dist/util/Constants.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.JWTOptions = void 0; -exports.JWTOptions = { algorithms: ["HS256"] }; -//# sourceMappingURL=Constants.js.map \ No newline at end of file diff --git a/dist/util/Constants.js.map b/dist/util/Constants.js.map deleted file mode 100644 index cf06fd23..00000000 --- a/dist/util/Constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/util/Constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAkB,EAAE,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/util/Database.d.ts b/dist/util/Database.d.ts deleted file mode 100644 index 766efaef..00000000 --- a/dist/util/Database.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// -import "./MongoBigInt"; -import mongoose, { Collection } from "mongoose"; -import { ChangeStream, ChangeEvent } from "mongodb"; -import EventEmitter from "events"; -declare const _default: mongoose.Connection; -export default _default; -export interface MongooseCache { - on(event: "delete", listener: (id: string) => void): this; - on(event: "change", listener: (data: any) => void): this; - on(event: "insert", listener: (data: any) => void): this; - on(event: "close", listener: () => void): this; -} -export declare class MongooseCache extends EventEmitter { - collection: Collection; - pipeline: Array>; - opts: { - onlyEvents: boolean; - }; - stream: ChangeStream; - data: any; - constructor(collection: Collection, pipeline: Array>, opts: { - onlyEvents: boolean; - }); - init: () => Promise; - convertResult: (obj: any) => any; - change: (doc: ChangeEvent) => boolean | Promise | undefined; - destroy: () => Promise | undefined; -} diff --git a/dist/util/Database.js b/dist/util/Database.js deleted file mode 100644 index b80fd835..00000000 --- a/dist/util/Database.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MongooseCache = void 0; -require("./MongoBigInt"); -const mongoose_1 = __importDefault(require("mongoose")); -const mongodb_1 = require("mongodb"); -const events_1 = __importDefault(require("events")); -const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPreference=secondaryPreferred"; -console.log(`[DB] connect: ${uri}`); -const connection = mongoose_1.default.createConnection(uri, { autoIndex: true }); -exports.default = connection; -class MongooseCache extends events_1.default { - constructor(collection, pipeline, opts) { - super(); - this.collection = collection; - this.pipeline = pipeline; - this.opts = opts; - this.init = async () => { - this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" }); - this.stream.on("change", this.change); - this.stream.on("close", this.destroy); - this.stream.on("error", console.error); - if (!this.opts.onlyEvents) { - const arr = await this.collection.aggregate(this.pipeline).toArray(); - this.data = arr.length ? arr[0] : arr; - } - }; - this.convertResult = (obj) => { - if (obj instanceof mongodb_1.Long) - return BigInt(obj.toString()); - if (typeof obj === "object") { - Object.keys(obj).forEach((key) => { - obj[key] = this.convertResult(obj[key]); - }); - } - return obj; - }; - this.change = (doc) => { - try { - // @ts-ignore - if (doc.fullDocument) { - // @ts-ignore - if (!this.opts.onlyEvents) - this.data = doc.fullDocument; - } - switch (doc.operationType) { - case "dropDatabase": - return this.destroy(); - case "drop": - return this.destroy(); - case "delete": - return this.emit("delete", doc.documentKey._id.toHexString()); - case "insert": - return this.emit("insert", doc.fullDocument); - case "update": - case "replace": - return this.emit("change", doc.fullDocument); - case "invalidate": - return this.destroy(); - default: - return; - } - } - catch (error) { - this.emit("error", error); - } - }; - this.destroy = () => { - this.stream?.off("change", this.change); - this.emit("close"); - if (this.stream.isClosed()) - return; - return this.stream.close(); - }; - } -} -exports.MongooseCache = MongooseCache; -//# sourceMappingURL=Database.js.map \ No newline at end of file diff --git a/dist/util/Database.js.map b/dist/util/Database.js.map deleted file mode 100644 index 348182a0..00000000 --- a/dist/util/Database.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../src/util/Database.ts"],"names":[],"mappings":";;;;;;AAAA,yBAAuB;AACvB,wDAA4D;AAC5D,qCAA0D;AAC1D,oDAAkC;AAClC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,sEAAsE,CAAC;AAE5G,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC;AAEpC,MAAM,UAAU,GAAG,kBAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvE,kBAA2B,UAAU,CAAC;AAStC,MAAa,aAAc,SAAQ,gBAAY;IAI9C,YACQ,UAAsB,EACtB,QAAwC,EACxC,IAEN;QAED,KAAK,EAAE,CAAC;QAND,eAAU,GAAV,UAAU,CAAY;QACtB,aAAQ,GAAR,QAAQ,CAAgC;QACxC,SAAI,GAAJ,IAAI,CAEV;QAKF,SAAI,GAAG,KAAK,IAAI,EAAE;YACjB,IAAI,CAAC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ts deleted file mode 100644 index bf8bac90..00000000 --- a/dist/util/Intents.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { BitField } from "./BitField"; -export declare class Intents extends BitField { - static FLAGS: { - GUILDS: bigint; - GUILD_MEMBERS: bigint; - GUILD_BANS: bigint; - GUILD_EMOJIS: bigint; - GUILD_INTEGRATIONS: bigint; - GUILD_WEBHOOKS: bigint; - GUILD_INVITES: bigint; - GUILD_VOICE_STATES: bigint; - GUILD_PRESENCES: bigint; - GUILD_MESSAGES: bigint; - GUILD_MESSAGE_REACTIONS: bigint; - GUILD_MESSAGE_TYPING: bigint; - DIRECT_MESSAGES: bigint; - DIRECT_MESSAGE_REACTIONS: bigint; - DIRECT_MESSAGE_TYPING: bigint; - }; -} diff --git a/dist/util/Intents.js b/dist/util/Intents.js deleted file mode 100644 index 5a7baa8c..00000000 --- a/dist/util/Intents.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Intents = void 0; -const BitField_1 = require("./BitField"); -class Intents extends BitField_1.BitField { -} -exports.Intents = Intents; -Intents.FLAGS = { - GUILDS: 1n << 0n, - GUILD_MEMBERS: 1n << 1n, - GUILD_BANS: 1n << 2n, - GUILD_EMOJIS: 1n << 3n, - GUILD_INTEGRATIONS: 1n << 4n, - GUILD_WEBHOOKS: 1n << 5n, - GUILD_INVITES: 1n << 6n, - GUILD_VOICE_STATES: 1n << 7n, - GUILD_PRESENCES: 1n << 8n, - GUILD_MESSAGES: 1n << 9n, - GUILD_MESSAGE_REACTIONS: 1n << 10n, - GUILD_MESSAGE_TYPING: 1n << 11n, - DIRECT_MESSAGES: 1n << 12n, - DIRECT_MESSAGE_REACTIONS: 1n << 13n, - DIRECT_MESSAGE_TYPING: 1n << 14n, -}; -//# sourceMappingURL=Intents.js.map \ No newline at end of file diff --git a/dist/util/Intents.js.map b/dist/util/Intents.js.map deleted file mode 100644 index 7250c839..00000000 --- a/dist/util/Intents.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Intents.js","sourceRoot":"","sources":["../../src/util/Intents.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAEtC,MAAa,OAAQ,SAAQ,mBAAQ;;AAArC,0BAkBC;AAjBO,aAAK,GAAG;IACd,MAAM,EAAE,EAAE,IAAI,EAAE;IAChB,aAAa,EAAE,EAAE,IAAI,EAAE;IACvB,UAAU,EAAE,EAAE,IAAI,EAAE;IACpB,YAAY,EAAE,EAAE,IAAI,EAAE;IACtB,kBAAkB,EAAE,EAAE,IAAI,EAAE;IAC5B,cAAc,EAAE,EAAE,IAAI,EAAE;IACxB,aAAa,EAAE,EAAE,IAAI,EAAE;IACvB,kBAAkB,EAAE,EAAE,IAAI,EAAE;IAC5B,eAAe,EAAE,EAAE,IAAI,EAAE;IACzB,cAAc,EAAE,EAAE,IAAI,EAAE;IACxB,uBAAuB,EAAE,EAAE,IAAI,GAAG;IAClC,oBAAoB,EAAE,EAAE,IAAI,GAAG;IAC/B,eAAe,EAAE,EAAE,IAAI,GAAG;IAC1B,wBAAwB,EAAE,EAAE,IAAI,GAAG;IACnC,qBAAqB,EAAE,EAAE,IAAI,GAAG;CAChC,CAAC"} \ No newline at end of file diff --git a/dist/util/MessageFlags.d.ts b/dist/util/MessageFlags.d.ts deleted file mode 100644 index 9a0a8e40..00000000 --- a/dist/util/MessageFlags.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { BitField } from "./BitField"; -export declare class MessageFlags extends BitField { - static FLAGS: { - CROSSPOSTED: bigint; - IS_CROSSPOST: bigint; - SUPPRESS_EMBEDS: bigint; - SOURCE_MESSAGE_DELETED: bigint; - URGENT: bigint; - }; -} diff --git a/dist/util/MessageFlags.js b/dist/util/MessageFlags.js deleted file mode 100644 index bdfed0fe..00000000 --- a/dist/util/MessageFlags.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -// https://github.com/discordjs/discord.js/blob/master/src/util/MessageFlags.js -// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MessageFlags = void 0; -const BitField_1 = require("./BitField"); -class MessageFlags extends BitField_1.BitField { -} -exports.MessageFlags = MessageFlags; -MessageFlags.FLAGS = { - CROSSPOSTED: 1n << 0n, - IS_CROSSPOST: 1n << 1n, - SUPPRESS_EMBEDS: 1n << 2n, - SOURCE_MESSAGE_DELETED: 1n << 3n, - URGENT: 1n << 4n, -}; -//# sourceMappingURL=MessageFlags.js.map \ No newline at end of file diff --git a/dist/util/MessageFlags.js.map b/dist/util/MessageFlags.js.map deleted file mode 100644 index 3aad5ea1..00000000 --- a/dist/util/MessageFlags.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MessageFlags.js","sourceRoot":"","sources":["../../src/util/MessageFlags.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,8DAA8D;;;AAE9D,yCAAsC;AAEtC,MAAa,YAAa,SAAQ,mBAAQ;;AAA1C,oCAQC;AAPO,kBAAK,GAAG;IACd,WAAW,EAAE,EAAE,IAAI,EAAE;IACrB,YAAY,EAAE,EAAE,IAAI,EAAE;IACtB,eAAe,EAAE,EAAE,IAAI,EAAE;IACzB,sBAAsB,EAAE,EAAE,IAAI,EAAE;IAChC,MAAM,EAAE,EAAE,IAAI,EAAE;CAChB,CAAC"} \ No newline at end of file diff --git a/dist/util/MongoBigInt.d.ts b/dist/util/MongoBigInt.d.ts deleted file mode 100644 index a809f8c4..00000000 --- a/dist/util/MongoBigInt.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import mongoose from "mongoose"; -declare class LongSchema extends mongoose.SchemaType { - $conditionalHandlers: { - $lt: (val: any) => any; - $lte: (val: any) => any; - $gt: (val: any) => any; - $gte: (val: any) => any; - $ne: (val: any) => any; - $in: (val: any) => any; - $nin: (val: any) => any; - $mod: (val: any) => any; - $all: (val: any) => any; - $bitsAnySet: (val: any) => any; - $bitsAllSet: (val: any) => any; - }; - handleSingle(val: any): any; - handleArray(val: any): any; - checkRequired(val: any): boolean; - cast(val: any, scope?: any, init?: any, type?: string): any; - castForQuery($conditional: string, value: any): any; -} -declare module "mongoose" { - namespace Types { - class Long extends mongoose.mongo.Long { - } - } - namespace Schema { - namespace Types { - class Long extends LongSchema { - } - } - } -} -export {}; diff --git a/dist/util/MongoBigInt.js b/dist/util/MongoBigInt.js deleted file mode 100644 index 3e04fac4..00000000 --- a/dist/util/MongoBigInt.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const mongoose_1 = __importDefault(require("mongoose")); -class LongSchema extends mongoose_1.default.SchemaType { - constructor() { - super(...arguments); - this.$conditionalHandlers = { - $lt: this.handleSingle, - $lte: this.handleSingle, - $gt: this.handleSingle, - $gte: this.handleSingle, - $ne: this.handleSingle, - $in: this.handleArray, - $nin: this.handleArray, - $mod: this.handleArray, - $all: this.handleArray, - $bitsAnySet: this.handleArray, - $bitsAllSet: this.handleArray, - }; - } - handleSingle(val) { - return this.cast(val, null, null, "handle"); - } - handleArray(val) { - var self = this; - return val.map(function (m) { - return self.cast(m, null, null, "handle"); - }); - } - checkRequired(val) { - return null != val; - } - cast(val, scope, init, type) { - if (null === val) - return val; - if ("" === val) - return null; - if (typeof val === "bigint") { - return mongoose_1.default.mongo.Long.fromString(val.toString()); - } - if (val instanceof mongoose_1.default.mongo.Long) { - if (type === "handle" || init == false) - return val; - return BigInt(val.toString()); - } - if (val instanceof Number || "number" == typeof val) - return BigInt(val); - if (!Array.isArray(val) && val.toString) - return BigInt(val.toString()); - // @ts-ignore - throw new SchemaType.CastError("Long", val); - } - castForQuery($conditional, value) { - var handler; - if (2 === arguments.length) { - // @ts-ignore - handler = this.$conditionalHandlers[$conditional]; - if (!handler) { - throw new Error("Can't use " + $conditional + " with Long."); - } - return handler.call(this, value); - } - else { - return this.cast($conditional, null, null, "query"); - } - } -} -LongSchema.cast = mongoose_1.default.SchemaType.cast; -LongSchema.set = mongoose_1.default.SchemaType.set; -LongSchema.get = mongoose_1.default.SchemaType.get; -mongoose_1.default.Schema.Types.Long = LongSchema; -mongoose_1.default.Types.Long = mongoose_1.default.mongo.Long; -//# sourceMappingURL=MongoBigInt.js.map \ No newline at end of file diff --git a/dist/util/MongoBigInt.js.map b/dist/util/MongoBigInt.js.map deleted file mode 100644 index 962b0454..00000000 --- a/dist/util/MongoBigInt.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MongoBigInt.js","sourceRoot":"","sources":["../../src/util/MongoBigInt.ts"],"names":[],"mappings":";;;;;AAAA,wDAAgC;AAEhC,MAAM,UAAW,SAAQ,kBAAQ,CAAC,UAAU;IAA5C;;QACQ,yBAAoB,GAAG;YAC7B,GAAG,EAAE,IAAI,CAAC,YAAY;YACtB,IAAI,EAAE,IAAI,CAAC,YAAY;YACvB,GAAG,EAAE,IAAI,CAAC,YAAY;YACtB,IAAI,EAAE,IAAI,CAAC,YAAY;YACvB,GAAG,EAAE,IAAI,CAAC,YAAY;YACtB,GAAG,EAAE,IAAI,CAAC,WAAW;YACrB,IAAI,EAAE,IAAI,CAAC,WAAW;YACtB,IAAI,EAAE,IAAI,CAAC,WAAW;YACtB,IAAI,EAAE,IAAI,CAAC,WAAW;YACtB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC;IAgDH,CAAC;IA9CA,YAAY,CAAC,GAAQ;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED,WAAW,CAAC,GAAQ;QACnB,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,OAAO,GAAG,CAAC,GAAG,CAAC,UAAU,CAAM;YAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAA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ACb,MAAM,IAAI,KAAK,CAAC,YAAY,GAAG,YAAY,GAAG,aAAa,CAAC,CAAC;aAC7D;YACD,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SACjC;aAAM;YACN,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;SACpD;IACF,CAAC;CACD;AAED,UAAU,CAAC,IAAI,GAAG,kBAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;AAC3C,UAAU,CAAC,GAAG,GAAG,kBAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;AACzC,UAAU,CAAC,GAAG,GAAG,kBAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;AAazC,kBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AACxC,kBAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,kBAAQ,CAAC,KAAK,CAAC,IAAI,CAAC"} \ No newline at end of file diff --git a/dist/util/Permissions.d.ts b/dist/util/Permissions.d.ts deleted file mode 100644 index 19135666..00000000 --- a/dist/util/Permissions.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { MemberDocument } from "../models/Member"; -import { ChannelDocument } from "../models/Channel"; -import { ChannelPermissionOverwrite } from "../models/Channel"; -import { Role } from "../models/Role"; -import { BitField } from "./BitField"; -export declare type PermissionResolvable = bigint | number | Permissions | PermissionResolvable[] | PermissionString; -declare type PermissionString = "CREATE_INSTANT_INVITE" | "KICK_MEMBERS" | "BAN_MEMBERS" | "ADMINISTRATOR" | "MANAGE_CHANNELS" | "MANAGE_GUILD" | "ADD_REACTIONS" | "VIEW_AUDIT_LOG" | "PRIORITY_SPEAKER" | "STREAM" | "VIEW_CHANNEL" | "SEND_MESSAGES" | "SEND_TTS_MESSAGES" | "MANAGE_MESSAGES" | "EMBED_LINKS" | "ATTACH_FILES" | "READ_MESSAGE_HISTORY" | "MENTION_EVERYONE" | "USE_EXTERNAL_EMOJIS" | "VIEW_GUILD_INSIGHTS" | "CONNECT" | "SPEAK" | "MUTE_MEMBERS" | "DEAFEN_MEMBERS" | "MOVE_MEMBERS" | "USE_VAD" | "CHANGE_NICKNAME" | "MANAGE_NICKNAMES" | "MANAGE_ROLES" | "MANAGE_WEBHOOKS" | "MANAGE_EMOJIS"; -export declare class Permissions extends BitField { - static FLAGS: { - CREATE_INSTANT_INVITE: bigint; - KICK_MEMBERS: bigint; - BAN_MEMBERS: bigint; - ADMINISTRATOR: bigint; - MANAGE_CHANNELS: bigint; - MANAGE_GUILD: bigint; - ADD_REACTIONS: bigint; - VIEW_AUDIT_LOG: bigint; - PRIORITY_SPEAKER: bigint; - STREAM: bigint; - VIEW_CHANNEL: bigint; - SEND_MESSAGES: bigint; - SEND_TTS_MESSAGES: bigint; - MANAGE_MESSAGES: bigint; - EMBED_LINKS: bigint; - ATTACH_FILES: bigint; - READ_MESSAGE_HISTORY: bigint; - MENTION_EVERYONE: bigint; - USE_EXTERNAL_EMOJIS: bigint; - VIEW_GUILD_INSIGHTS: bigint; - CONNECT: bigint; - SPEAK: bigint; - MUTE_MEMBERS: bigint; - DEAFEN_MEMBERS: bigint; - MOVE_MEMBERS: bigint; - USE_VAD: bigint; - CHANGE_NICKNAME: bigint; - MANAGE_NICKNAMES: bigint; - MANAGE_ROLES: bigint; - MANAGE_WEBHOOKS: bigint; - MANAGE_EMOJIS: bigint; - }; - any(permission: PermissionResolvable, checkAdmin?: boolean): boolean; - /** - * Checks whether the bitfield has a permission, or multiple permissions. - */ - has(permission: PermissionResolvable, checkAdmin?: boolean): boolean; - static channelPermission(overwrites: ChannelPermissionOverwrite[], init?: bigint): bigint; - static rolePermission(roles: Role[]): bigint; - static finalPermission({ user, guild, channel, }: { - user: { - id: string; - roles: string[]; - }; - guild: { - roles: Role[]; - }; - channel?: { - overwrites?: ChannelPermissionOverwrite[]; - }; - }): bigint; -} -export declare function getPermission(user_id: string, guild_id: string, channel_id?: string, cache?: { - channel?: ChannelDocument | null; - member?: MemberDocument | null; -}): Promise; -export {}; diff --git a/dist/util/Permissions.js b/dist/util/Permissions.js deleted file mode 100644 index c170f3f9..00000000 --- a/dist/util/Permissions.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getPermission = exports.Permissions = void 0; -// https://github.com/discordjs/discord.js/blob/master/src/util/Permissions.js -// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah -const Member_1 = require("../models/Member"); -const Channel_1 = require("../models/Channel"); -const Role_1 = require("../models/Role"); -const BitField_1 = require("./BitField"); -const Guild_1 = require("../models/Guild"); -const CUSTOM_PERMISSION_OFFSET = 1n << 48n; // 16 free custom permission bits, and 16 for discord to add new ones -class Permissions extends BitField_1.BitField { - any(permission, checkAdmin = true) { - return (checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.any(permission); - } - /** - * Checks whether the bitfield has a permission, or multiple permissions. - */ - has(permission, checkAdmin = true) { - return (checkAdmin && super.has(Permissions.FLAGS.ADMINISTRATOR)) || super.has(permission); - } - static channelPermission(overwrites, init) { - // TODO: do not deny any permissions if admin - return overwrites.reduce((permission, overwrite) => { - // apply disallowed permission - // * permission: current calculated permission (e.g. 010) - // * deny contains all denied permissions (e.g. 011) - // * allow contains all explicitly allowed permisions (e.g. 100) - return (permission & ~overwrite.deny) | overwrite.allow; - // ~ operator inverts deny (e.g. 011 -> 100) - // & operator only allows 1 for both ~deny and permission (e.g. 010 & 100 -> 000) - // | operators adds both together (e.g. 000 + 100 -> 100) - }, 0n ?? init); - } - static rolePermission(roles) { - // adds all permissions of all roles together (Bit OR) - return roles.reduce((permission, role) => permission | role.permissions, 0n); - } - static finalPermission({ user, guild, channel, }) { - let roles = guild.roles.filter((x) => user.roles.includes(x.id)); - let permission = Permissions.rolePermission(roles); - if (channel?.overwrites) { - let overwrites = channel.overwrites.filter((x) => { - if (x.type === 0 && user.roles.includes(x.id)) - return true; - if (x.type === 1 && x.id == user.id) - return true; - return false; - }); - permission = Permissions.channelPermission(overwrites, permission); - } - return permission; - } -} -exports.Permissions = Permissions; -Permissions.FLAGS = { - CREATE_INSTANT_INVITE: 1n << 0n, - KICK_MEMBERS: 1n << 1n, - BAN_MEMBERS: 1n << 2n, - ADMINISTRATOR: 1n << 3n, - MANAGE_CHANNELS: 1n << 4n, - MANAGE_GUILD: 1n << 5n, - ADD_REACTIONS: 1n << 6n, - VIEW_AUDIT_LOG: 1n << 7n, - PRIORITY_SPEAKER: 1n << 8n, - STREAM: 1n << 9n, - VIEW_CHANNEL: 1n << 10n, - SEND_MESSAGES: 1n << 11n, - SEND_TTS_MESSAGES: 1n << 12n, - MANAGE_MESSAGES: 1n << 13n, - EMBED_LINKS: 1n << 14n, - ATTACH_FILES: 1n << 15n, - READ_MESSAGE_HISTORY: 1n << 16n, - MENTION_EVERYONE: 1n << 17n, - USE_EXTERNAL_EMOJIS: 1n << 18n, - VIEW_GUILD_INSIGHTS: 1n << 19n, - CONNECT: 1n << 20n, - SPEAK: 1n << 21n, - MUTE_MEMBERS: 1n << 22n, - DEAFEN_MEMBERS: 1n << 23n, - MOVE_MEMBERS: 1n << 24n, - USE_VAD: 1n << 25n, - CHANGE_NICKNAME: 1n << 26n, - MANAGE_NICKNAMES: 1n << 27n, - MANAGE_ROLES: 1n << 28n, - MANAGE_WEBHOOKS: 1n << 29n, - MANAGE_EMOJIS: 1n << 30n, -}; -async function getPermission(user_id, guild_id, channel_id, cache) { - var { channel, member } = cache || {}; - const guild = await Guild_1.GuildModel.findOne({ id: guild_id }, { owner_id: true }).exec(); - if (!guild) - throw new Error("Guild not found"); - if (guild.owner_id === user_id) - return new Permissions(Permissions.FLAGS.ADMINISTRATOR); - member = await Member_1.MemberModel.findOne({ guild_id, id: user_id }, "roles").exec(); - if (!member) - throw new Error("Member not found"); - var roles = await Role_1.RoleModel.find({ guild_id, id: { $in: member.roles } }) - .lean() - .exec(); - if (channel_id) { - channel = await Channel_1.ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec(); - } - var permission = Permissions.finalPermission({ - user: { - id: user_id, - roles: member.roles, - }, - guild: { - roles: roles, - }, - channel: { - overwrites: channel?.permission_overwrites, - }, - }); - return new Permissions(permission); -} -exports.getPermission = getPermission; -//# sourceMappingURL=Permissions.js.map \ No newline at end of file diff --git a/dist/util/Permissions.js.map b/dist/util/Permissions.js.map deleted file mode 100644 index 14774970..00000000 --- a/dist/util/Permissions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Permissions.js","sourceRoot":"","sources":["../../src/util/Permissions.ts"],"names":[],"mappings":";;;AAAA,8EAA8E;AAC9E,8DAA8D;AAC9D,6CAA+D;AAC/D,+CAAkE;AAElE,yCAAiD;AACjD,yCAAsC;AACtC,2CAA4D;AAqC5D,MAAM,wBAAwB,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,qEAAqE;AAEjH,MAAa,WAAY,SAAQ,mBAAQ;IA0CxC,GAAG,CAAC,UAAgC,EAAE,UAAU,GAAG,IAAI;QACtD,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,UAAgC,EAAE,UAAU,GAAG,IAAI;QACtD,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5F,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,UAAwC,EAAE,IAAa;QAC/E,6CAA6C;QAC7C,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE;YAClD,8BAA8B;YAC9B,yDAAyD;YACzD,oDAAoD;YACpD,gEAAgE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qB;SAC1C;KACD,CAAC,CAAC;IAEH,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC;AApCD,sCAoCC"} \ No newline at end of file diff --git a/dist/util/Snowflake.d.ts b/dist/util/Snowflake.d.ts deleted file mode 100644 index 06e98492..00000000 --- a/dist/util/Snowflake.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * A container for useful snowflake-related methods. - */ -export declare class Snowflake { - static readonly EPOCH = 1420070400000; - static INCREMENT: bigint; - static processId: bigint; - static workerId: bigint; - constructor(); - /** - * A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z - * ``` - * If we have a snowflake '266241948824764416' we can represent it as binary: - * - * 64 22 17 12 0 - * 000000111011000111100001101001000101000000 00001 00000 000000000000 - * number of ms since Discord epoch worker pid increment - * ``` - * @typedef {string} Snowflake - */ - /** - * Transforms a snowflake from a decimal string to a bit string. - * @param {Snowflake} num Snowflake to be transformed - * @returns {string} - * @private - */ - static idToBinary(num: any): string; - /** - * Transforms a snowflake from a bit string to a decimal string. - * @param {string} num Bit string to be transformed - * @returns {Snowflake} - * @private - */ - static binaryToID(num: any): string; - static generate(): string; - /** - * A deconstructed snowflake. - * @typedef {Object} DeconstructedSnowflake - * @property {number} timestamp Timestamp the snowflake was created - * @property {Date} date Date the snowflake was created - * @property {number} workerID Worker ID in the snowflake - * @property {number} processID Process ID in the snowflake - * @property {number} increment Increment in the snowflake - * @property {string} binary Binary representation of the snowflake - */ - /** - * Deconstructs a Discord snowflake. - * @param {Snowflake} snowflake Snowflake to deconstruct - * @returns {DeconstructedSnowflake} Deconstructed snowflake - */ - static deconstruct(snowflake: any): { - timestamp: any; - workerID: number; - processID: number; - increment: number; - binary: string; - }; -} diff --git a/dist/util/Snowflake.js b/dist/util/Snowflake.js deleted file mode 100644 index 1217b0c8..00000000 --- a/dist/util/Snowflake.js +++ /dev/null @@ -1,116 +0,0 @@ -// @ts-nocheck -// https://github.com/discordjs/discord.js/blob/master/src/util/Snowflake.js -// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Snowflake = void 0; -// Discord epoch (2015-01-01T00:00:00.000Z) -/** - * A container for useful snowflake-related methods. - */ -class Snowflake { - constructor() { - throw new Error(`The ${this.constructor.name} class may not be instantiated.`); - } - /** - * A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z - * ``` - * If we have a snowflake '266241948824764416' we can represent it as binary: - * - * 64 22 17 12 0 - * 000000111011000111100001101001000101000000 00001 00000 000000000000 - * number of ms since Discord epoch worker pid increment - * ``` - * @typedef {string} Snowflake - */ - /** - * Transforms a snowflake from a decimal string to a bit string. - * @param {Snowflake} num Snowflake to be transformed - * @returns {string} - * @private - */ - static idToBinary(num) { - let bin = ""; - let high = parseInt(num.slice(0, -10)) || 0; - let low = parseInt(num.slice(-10)); - while (low > 0 || high > 0) { - bin = String(low & 1) + bin; - low = Math.floor(low / 2); - if (high > 0) { - low += 5000000000 * (high % 2); - high = Math.floor(high / 2); - } - } - return bin; - } - /** - * Transforms a snowflake from a bit string to a decimal string. - * @param {string} num Bit string to be transformed - * @returns {Snowflake} - * @private - */ - static binaryToID(num) { - let dec = ""; - while (num.length > 50) { - const high = parseInt(num.slice(0, -32), 2); - const low = parseInt((high % 10).toString(2) + num.slice(-32), 2); - dec = (low % 10).toString() + dec; - num = - Math.floor(high / 10).toString(2) + - Math.floor(low / 10) - .toString(2) - .padStart(32, "0"); - } - num = parseInt(num, 2); - while (num > 0) { - dec = (num % 10).toString() + dec; - num = Math.floor(num / 10); - } - return dec; - } - static generate() { - var time = BigInt(Date.now() - Snowflake.EPOCH) << 22n; - var worker = Snowflake.workerId << 17n; - var process = Snowflake.processId << 12n; - var increment = Snowflake.INCREMENT++; - return (time | worker | process | increment).toString(); - } - /** - * A deconstructed snowflake. - * @typedef {Object} DeconstructedSnowflake - * @property {number} timestamp Timestamp the snowflake was created - * @property {Date} date Date the snowflake was created - * @property {number} workerID Worker ID in the snowflake - * @property {number} processID Process ID in the snowflake - * @property {number} increment Increment in the snowflake - * @property {string} binary Binary representation of the snowflake - */ - /** - * Deconstructs a Discord snowflake. - * @param {Snowflake} snowflake Snowflake to deconstruct - * @returns {DeconstructedSnowflake} Deconstructed snowflake - */ - static deconstruct(snowflake) { - const BINARY = Snowflake.idToBinary(snowflake).toString(2).padStart(64, "0"); - const res = { - timestamp: parseInt(BINARY.substring(0, 42), 2) + EPOCH, - workerID: parseInt(BINARY.substring(42, 47), 2), - processID: parseInt(BINARY.substring(47, 52), 2), - increment: parseInt(BINARY.substring(52, 64), 2), - binary: BINARY, - }; - Object.defineProperty(res, "date", { - get: function get() { - return new Date(this.timestamp); - }, - enumerable: true, - }); - return res; - } -} -exports.Snowflake = Snowflake; -Snowflake.EPOCH = 1420070400000; -Snowflake.INCREMENT = 0n; // max 4095 -Snowflake.processId = 0n; // max 31 -Snowflake.workerId = 0n; // max 31 -//# sourceMappingURL=Snowflake.js.map \ No newline at end of file diff --git a/dist/util/Snowflake.js.map b/dist/util/Snowflake.js.map deleted file mode 100644 index df2df3f6..00000000 --- a/dist/util/Snowflake.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Snowflake.js","sourceRoot":"","sources":["../../src/util/Snowflake.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,4EAA4E;AAC5E,8DAA8D;AAC9D,YAAY,CAAC;;;AAEb,2CAA2C;AAE3C;;GAEG;AACH,MAAa,SAAS;IAMrB;QACC,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,iCAAiC,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;;;;;OAUG;IAEH;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG;QACpB,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,IAAI,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CA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AAQ,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;YAChD,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;YAChD,MAAM,EAAE,MAAM;SACd,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE;YAClC,GAAG,EAAE,SAAS,GAAG;gBAChB,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACjC,CAAC;YACD,UAAU,EAAE,IAAI;SAChB,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACZ,CAAC;;AAjHF,8BAkHC;AAjHgB,eAAK,GAAG,aAAa,CAAC;AAC/B,mBAAS,GAAG,EAAE,CAAC,CAAC,WAAW;AAC3B,mBAAS,GAAG,EAAE,CAAC,CAAC,SAAS;AACzB,kBAAQ,GAAG,EAAE,CAAC,CAAC,SAAS"} \ No newline at end of file diff --git a/dist/util/String.d.ts b/dist/util/String.d.ts deleted file mode 100644 index 0ec4281e..00000000 --- a/dist/util/String.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare const DOUBLE_WHITE_SPACE: RegExp; -export declare const SPECIAL_CHAR: RegExp; -export declare function trimSpecial(str: string): string; diff --git a/dist/util/String.js b/dist/util/String.js deleted file mode 100644 index 712328ef..00000000 --- a/dist/util/String.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.trimSpecial = exports.SPECIAL_CHAR = exports.DOUBLE_WHITE_SPACE = void 0; -exports.DOUBLE_WHITE_SPACE = /\s\s+/g; -exports.SPECIAL_CHAR = /[@#`:\r\n\t\f\v\p{C}]/gu; -function trimSpecial(str) { - return str.replace(exports.SPECIAL_CHAR, "").replace(exports.DOUBLE_WHITE_SPACE, " ").trim(); -} -exports.trimSpecial = trimSpecial; -//# sourceMappingURL=String.js.map \ No newline at end of file diff --git a/dist/util/String.js.map b/dist/util/String.js.map deleted file mode 100644 index 83644ad9..00000000 --- a/dist/util/String.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"String.js","sourceRoot":"","sources":["../../src/util/String.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,QAAQ,CAAC;AAC9B,QAAA,YAAY,GAAG,yBAAyB,CAAC;AAEtD,SAAgB,WAAW,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAY,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,0BAAkB,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9E,CAAC;AAFD,kCAEC"} \ No newline at end of file diff --git a/dist/util/UserFlags.d.ts b/dist/util/UserFlags.d.ts deleted file mode 100644 index b721d61c..00000000 --- a/dist/util/UserFlags.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { BitField } from "./BitField"; -export declare class UserFlags extends BitField { - static FLAGS: { - DISCORD_EMPLOYEE: bigint; - PARTNERED_SERVER_OWNER: bigint; - HYPESQUAD_EVENTS: bigint; - BUGHUNTER_LEVEL_1: bigint; - HOUSE_BRAVERY: bigint; - HOUSE_BRILLIANCE: bigint; - HOUSE_BALANCE: bigint; - EARLY_SUPPORTER: bigint; - TEAM_USER: bigint; - SYSTEM: bigint; - BUGHUNTER_LEVEL_2: bigint; - VERIFIED_BOT: bigint; - EARLY_VERIFIED_BOT_DEVELOPER: bigint; - }; -} diff --git a/dist/util/UserFlags.js b/dist/util/UserFlags.js deleted file mode 100644 index 4df3f232..00000000 --- a/dist/util/UserFlags.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -// https://github.com/discordjs/discord.js/blob/master/src/util/UserFlags.js -// Apache License Version 2.0 Copyright 2015 - 2021 Amish Shah -Object.defineProperty(exports, "__esModule", { value: true }); -exports.UserFlags = void 0; -const BitField_1 = require("./BitField"); -class UserFlags extends BitField_1.BitField { -} -exports.UserFlags = UserFlags; -UserFlags.FLAGS = { - DISCORD_EMPLOYEE: 1n << 0n, - PARTNERED_SERVER_OWNER: 1n << 1n, - HYPESQUAD_EVENTS: 1n << 2n, - BUGHUNTER_LEVEL_1: 1n << 3n, - HOUSE_BRAVERY: 1n << 6n, - HOUSE_BRILLIANCE: 1n << 7n, - HOUSE_BALANCE: 1n << 8n, - EARLY_SUPPORTER: 1n << 9n, - TEAM_USER: 1n << 10n, - SYSTEM: 1n << 12n, - BUGHUNTER_LEVEL_2: 1n << 14n, - VERIFIED_BOT: 1n << 16n, - EARLY_VERIFIED_BOT_DEVELOPER: 1n << 17n, -}; -//# sourceMappingURL=UserFlags.js.map \ No newline at end of file diff --git a/dist/util/UserFlags.js.map b/dist/util/UserFlags.js.map deleted file mode 100644 index 997bd6da..00000000 --- a/dist/util/UserFlags.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"UserFlags.js","sourceRoot":"","sources":["../../src/util/UserFlags.ts"],"names":[],"mappings":";AAAA,4EAA4E;AAC5E,8DAA8D;;;AAE9D,yCAAsC;AAEtC,MAAa,SAAU,SAAQ,mBAAQ;;AAAvC,8BAgBC;AAfO,eAAK,GAAG;IACd,gBAAgB,EAAE,EAAE,IAAI,EAAE;IAC1B,sBAAsB,EAAE,EAAE,IAAI,EAAE;IAChC,gBAAgB,EAAE,EAAE,IAAI,EAAE;IAC1B,iBAAiB,EAAE,EAAE,IAAI,EAAE;IAC3B,aAAa,EAAE,EAAE,IAAI,EAAE;IACvB,gBAAgB,EAAE,EAAE,IAAI,EAAE;IAC1B,aAAa,EAAE,EAAE,IAAI,EAAE;IACvB,eAAe,EAAE,EAAE,IAAI,EAAE;IACzB,SAAS,EAAE,EAAE,IAAI,GAAG;IACpB,MAAM,EAAE,EAAE,IAAI,GAAG;IACjB,iBAAiB,EAAE,EAAE,IAAI,GAAG;IAC5B,YAAY,EAAE,EAAE,IAAI,GAAG;IACvB,4BAA4B,EAAE,EAAE,IAAI,GAAG;CACvC,CAAC"} \ No newline at end of file diff --git a/dist/util/checkToken.d.ts b/dist/util/checkToken.d.ts deleted file mode 100644 index f8dcbe12..00000000 --- a/dist/util/checkToken.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function checkToken(token: string): Promise; diff --git a/dist/util/checkToken.js b/dist/util/checkToken.js deleted file mode 100644 index 17d88178..00000000 --- a/dist/util/checkToken.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.checkToken = void 0; -const Constants_1 = require("./Constants"); -const jsonwebtoken_1 = __importDefault(require("jsonwebtoken")); -const Config_1 = __importDefault(require("./Config")); -function checkToken(token) { - return new Promise((res, rej) => { - jsonwebtoken_1.default.verify(token, Config_1.default.getAll().api.security.jwtSecret, Constants_1.JWTOptions, (err, decoded) => { - if (err || !decoded) - return rej("Invalid Token"); - return res(decoded); - }); - }); -} -exports.checkToken = checkToken; -//# sourceMappingURL=checkToken.js.map \ No newline at end of file diff --git a/dist/util/checkToken.js.map b/dist/util/checkToken.js.map deleted file mode 100644 index 173dd43d..00000000 --- a/dist/util/checkToken.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"checkToken.js","sourceRoot":"","sources":["../../src/util/checkToken.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAyC;AACzC,gEAA+B;AAC/B,sDAA8B;AAE9B,SAAgB,UAAU,CAAC,KAAa;IACvC,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC/B,sBAAG,CAAC,MAAM,CAAC,KAAK,EAAE,gBAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,EAAE,sBAAU,EAAE,CAAC,GAAG,EAAE,OAAY,EAAE,EAAE;YAC3F,IAAI,GAAG,IAAI,CAAC,OAAO;gBAAE,OAAO,GAAG,CAAC,eAAe,CAAC,CAAC;YAEjD,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AARD,gCAQC"} \ No newline at end of file From 977d5b482d0dea4acef4c74fcdc22f59fbd864d2 Mon Sep 17 00:00:00 2001 From: afeuerstein <32029275+afeuerstein@users.noreply.github.com> Date: Tue, 6 Apr 2021 21:33:02 +0200 Subject: [PATCH 18/35] resolve conflicting mongodb and mongoose versions --- package-lock.json | 106 +++++++++++----------------------------------- 1 file changed, 24 insertions(+), 82 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e40ede6..124aacb1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "fosscord-server-util", "version": "1.0.0", "license": "ISC", "dependencies": { @@ -562,16 +561,15 @@ } }, "node_modules/mongodb": { - "version": "3.6.4", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz", - "integrity": "sha512-Y+Ki9iXE9jI+n9bVtbTOOdK0B95d6wVGSucwtBkvQ+HIvVdTCfpVRp01FDC24uhC/Q2WXQ8Lpq3/zwtB5Op9Qw==", + "version": "3.6.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" + "safe-buffer": "^5.1.2" }, "engines": { "node": ">=4" @@ -625,7 +623,6 @@ "lockfile": "^1.0.4", "md5-file": "^5.0.0", "mkdirp": "^1.0.4", - "mongodb": "3.6.2", "semver": "^7.3.2", "tar-stream": "^2.1.4", "tmp": "^0.2.1", @@ -649,8 +646,7 @@ "bson": "^1.1.4", "denque": "^1.4.1", "require_optional": "^1.0.1", - "safe-buffer": "^5.1.2", - "saslprep": "^1.0.0" + "safe-buffer": "^5.1.2" }, "engines": { "node": ">=4" @@ -674,17 +670,17 @@ } }, "node_modules/mongoose": { - "version": "5.11.15", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.11.15.tgz", - "integrity": "sha512-8T4bT6eCGB7MqCm40oVhnhT/1AyAdwe+y1rYUhdl3ljsks3BpYz8whZgcMkIoh6VoCCjipOXRqZqdk1UByvlYA==", + "version": "5.12.3", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.3.tgz", + "integrity": "sha512-frsSR9yeldaRpSUeTegXCSB0Tu5UGq8sHuHBuEV31Jk3COyxlKFQPL7UsdMhxPUCmk74FpOYSmNwxhWBEqgzQg==", "dependencies": { "@types/mongodb": "^3.5.27", "bson": "^1.1.4", "kareem": "2.3.2", - "mongodb": "3.6.3", + "mongodb": "3.6.5", "mongoose-legacy-pluralize": "1.0.2", "mpath": "0.8.3", - "mquery": "3.2.3", + "mquery": "3.2.5", "ms": "2.1.2", "regexp-clone": "1.0.0", "safe-buffer": "5.2.1", @@ -707,45 +703,6 @@ "mongoose": "*" } }, - "node_modules/mongoose/node_modules/mongodb": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.3.tgz", - "integrity": "sha512-rOZuR0QkodZiM+UbQE5kDsJykBqWi0CL4Ec2i1nrGrUI3KO11r6Fbxskqmq3JK2NH7aW4dcccBuUujAP0ERl5w==", - "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", @@ -755,9 +712,9 @@ } }, "node_modules/mquery": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.3.tgz", - "integrity": "sha512-cIfbP4TyMYX+SkaQ2MntD+F2XbqaBHUYWk3j+kqdDztPWok3tgyssOZxMHMtzbV1w9DaSlvEea0Iocuro41A4g==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.5.tgz", + "integrity": "sha512-VjOKHHgU84wij7IUoZzFRU07IAxd5kWJaDmyUzQlbjHjyoeK5TNeeo8ZsFDtTYnSgpW6n/nMNIHvE3u8Lbrf4A==", "dependencies": { "bluebird": "3.5.1", "debug": "3.1.0", @@ -1544,9 +1501,9 @@ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" }, "mongodb": { - "version": "3.6.4", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz", - "integrity": "sha512-Y+Ki9iXE9jI+n9bVtbTOOdK0B95d6wVGSucwtBkvQ+HIvVdTCfpVRp01FDC24uhC/Q2WXQ8Lpq3/zwtB5Op9Qw==", + "version": "3.6.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", @@ -1613,37 +1570,22 @@ } }, "mongoose": { - "version": "5.11.15", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.11.15.tgz", - "integrity": "sha512-8T4bT6eCGB7MqCm40oVhnhT/1AyAdwe+y1rYUhdl3ljsks3BpYz8whZgcMkIoh6VoCCjipOXRqZqdk1UByvlYA==", + "version": "5.12.3", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.3.tgz", + "integrity": "sha512-frsSR9yeldaRpSUeTegXCSB0Tu5UGq8sHuHBuEV31Jk3COyxlKFQPL7UsdMhxPUCmk74FpOYSmNwxhWBEqgzQg==", "requires": { "@types/mongodb": "^3.5.27", "bson": "^1.1.4", "kareem": "2.3.2", - "mongodb": "3.6.3", + "mongodb": "3.6.5", "mongoose-legacy-pluralize": "1.0.2", "mpath": "0.8.3", - "mquery": "3.2.3", + "mquery": "3.2.5", "ms": "2.1.2", "regexp-clone": "1.0.0", "safe-buffer": "5.2.1", "sift": "7.0.1", "sliced": "1.0.1" - }, - "dependencies": { - "mongodb": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.3.tgz", - "integrity": "sha512-rOZuR0QkodZiM+UbQE5kDsJykBqWi0CL4Ec2i1nrGrUI3KO11r6Fbxskqmq3JK2NH7aW4dcccBuUujAP0ERl5w==", - "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": { @@ -1658,9 +1600,9 @@ "integrity": "sha512-eb9rRvhDltXVNL6Fxd2zM9D4vKBxjVVQNLNijlj7uoXUy19zNDsIif5zR+pWmPCWNKwAtqyo4JveQm4nfD5+eA==" }, "mquery": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.3.tgz", - "integrity": "sha512-cIfbP4TyMYX+SkaQ2MntD+F2XbqaBHUYWk3j+kqdDztPWok3tgyssOZxMHMtzbV1w9DaSlvEea0Iocuro41A4g==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.5.tgz", + "integrity": "sha512-VjOKHHgU84wij7IUoZzFRU07IAxd5kWJaDmyUzQlbjHjyoeK5TNeeo8ZsFDtTYnSgpW6n/nMNIHvE3u8Lbrf4A==", "requires": { "bluebird": "3.5.1", "debug": "3.1.0", 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: [PATCH 19/35] resolve deprecation warnings --- src/util/Database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; 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: [PATCH 20/35] :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 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,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,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM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ACd,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,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,MAAM;IACV,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;CACb,CAAC;AAEW,QAAA,UAAU,GAAG;IACzB,GAAG,EAAE,MAAM;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EH,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"; From 731ea2e751342ccae68a422ea3104195138e6521 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 22:12:58 +0200 Subject: [PATCH 21/35] update mongoose version to get rid of circular dependency issue --- package-lock.json | 11 ++++++++--- package.json | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 124aacb1..4448c6fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,13 +5,15 @@ "requires": true, "packages": { "": { + "name": "fosscord-server-util", "version": "1.0.0", "license": "ISC", "dependencies": { "jsonwebtoken": "^8.5.1", "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2", - "mongodb": "^3.6.4" + "mongodb": "^3.6.4", + "mongoose": "^5.12.3" }, "devDependencies": { "@types/jsonwebtoken": "^8.5.0", @@ -569,7 +571,8 @@ "bson": "^1.1.4", "denque": "^1.4.1", "require_optional": "^1.0.1", - "safe-buffer": "^5.1.2" + "safe-buffer": "^5.1.2", + "saslprep": "^1.0.0" }, "engines": { "node": ">=4" @@ -623,6 +626,7 @@ "lockfile": "^1.0.4", "md5-file": "^5.0.0", "mkdirp": "^1.0.4", + "mongodb": "3.6.2", "semver": "^7.3.2", "tar-stream": "^2.1.4", "tmp": "^0.2.1", @@ -646,7 +650,8 @@ "bson": "^1.1.4", "denque": "^1.4.1", "require_optional": "^1.0.1", - "safe-buffer": "^5.1.2" + "safe-buffer": "^5.1.2", + "saslprep": "^1.0.0" }, "engines": { "node": ">=4" diff --git a/package.json b/package.json index 4e2b4c1e..0ac2c9ce 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "jsonwebtoken": "^8.5.1", "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2", - "mongodb": "^3.6.4" + "mongodb": "^3.6.4", + "mongoose": "^5.12.3" }, "devDependencies": { "@types/jsonwebtoken": "^8.5.0", 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: [PATCH 22/35] :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(-) 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 */ From e0d88a9117f14cd325aeea30bffdcbf64543440d Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 23:55:52 +0200 Subject: [PATCH 23/35] remove dist --- 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 - 6 files changed, 86 deletions(-) delete mode 100644 dist/models/index.d.ts delete mode 100644 dist/models/index.js delete mode 100644 dist/models/index.js.map delete mode 100644 dist/util/index.d.ts delete mode 100644 dist/util/index.js delete mode 100644 dist/util/index.js.map diff --git a/dist/models/index.d.ts b/dist/models/index.d.ts deleted file mode 100644 index f82f24de..00000000 --- a/dist/models/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 3c81f38f..00000000 --- a/dist/models/index.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __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 deleted file mode 100644 index db9b8835..00000000 --- a/dist/models/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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 deleted file mode 100644 index b0c7fe62..00000000 --- a/dist/util/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index 25791a96..00000000 --- a/dist/util/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __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 deleted file mode 100644 index ce0269d5..00000000 --- a/dist/util/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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 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: [PATCH 24/35] :bug: fix lean not working with virtuals --- package-lock.json | 39 +++++++++++++++++++ package.json | 1 + src/index.ts | 4 +- src/models/Message.ts | 90 +++++++++++++++++++++---------------------- src/models/index.ts | 27 +++++++------ src/util/Database.ts | 9 +++++ 6 files changed, 111 insertions(+), 59 deletions(-) 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, - 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, - }, +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, }, - { - toJSON: { - transform: function (doc, ret) { - delete ret.mention_channel_ids; - delete ret.mention_user_ids; - delete ret.mention_role_ids; - }, - }, - } -); + flags: Types.Long, + stickers: [], + message_reference: { + message_id: String, + channel_id: String, + guild_id: String, + }, +}); 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; 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: [PATCH 25/35] fix toObject type --- src/util/Database.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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); } 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: [PATCH 26/35] getPermission use cache --- src/util/Permissions.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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(); } From 3b6038b672b72aa6efe77bf6f88e48b7c9d0b172 Mon Sep 17 00:00:00 2001 From: notsapinho <52896767+notsapinho@users.noreply.github.com> Date: Wed, 7 Apr 2021 14:45:54 -0300 Subject: [PATCH 27/35] Update Guild.ts --- src/models/Guild.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/Guild.ts b/src/models/Guild.ts index d3f098ea..1709db5f 100644 --- a/src/models/Guild.ts +++ b/src/models/Guild.ts @@ -108,7 +108,7 @@ GuildSchema.virtual("roles", { GuildSchema.virtual("members", { ref: MemberModel, localField: "id", - foreignField: "member_id", + foreignField: "guild_id", justOne: false, }); From a6d82b466f61c1b60b1058d75b0647f2c0ac91a0 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Wed, 7 Apr 2021 20:26:19 +0200 Subject: [PATCH 28/35] :zap: use mongoose autopopulate --- package-lock.json | 36 +++++++++++++++++++++++++++++++++++- package.json | 4 +++- src/models/Guild.ts | 4 +++- src/models/Member.ts | 17 ++++++++++++++++- src/models/Message.ts | 16 ++++++++++++++-- src/models/Role.ts | 1 + src/models/User.ts | 7 +++++++ src/models/index.ts | 3 +++ 8 files changed, 82 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 902566ed..17d70c4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,10 +13,12 @@ "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2", "mongodb": "^3.6.6", - "mongoose": "^5.12.3" + "mongoose": "^5.12.3", + "mongoose-autopopulate": "^0.12.3" }, "devDependencies": { "@types/jsonwebtoken": "^8.5.0", + "@types/mongoose-autopopulate": "^0.10.1", "@types/mongoose-lean-virtuals": "^0.5.1", "@types/node": "^14.14.25", "typescript": "^4.1.3" @@ -58,6 +60,15 @@ "@types/node": "*" } }, + "node_modules/@types/mongoose-autopopulate": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@types/mongoose-autopopulate/-/mongoose-autopopulate-0.10.1.tgz", + "integrity": "sha512-L67MAIE3WEoTtt7a7/spRYk+76lgp67FAP6I38Y9NcC1kQuzwqnukTaJzodfb8180wxHZM4qt68u6x6ptuDRaQ==", + "dev": true, + "dependencies": { + "@types/mongoose": "*" + } + }, "node_modules/@types/mongoose-lean-virtuals": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/@types/mongoose-lean-virtuals/-/mongoose-lean-virtuals-0.5.1.tgz", @@ -720,6 +731,14 @@ "url": "https://opencollective.com/mongoose" } }, + "node_modules/mongoose-autopopulate": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/mongoose-autopopulate/-/mongoose-autopopulate-0.12.3.tgz", + "integrity": "sha512-yNmYsfi6OpS/GQ+48mkB0KQ199ExHmmPrt3wt3fyxPHPMtEBGts7yq3wBQR6VgKCPOQaKvCI1URbJCPOtrPeLw==", + "peerDependencies": { + "mongoose": "4.x || 5.x" + } + }, "node_modules/mongoose-legacy-pluralize": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", @@ -1194,6 +1213,15 @@ "@types/node": "*" } }, + "@types/mongoose-autopopulate": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@types/mongoose-autopopulate/-/mongoose-autopopulate-0.10.1.tgz", + "integrity": "sha512-L67MAIE3WEoTtt7a7/spRYk+76lgp67FAP6I38Y9NcC1kQuzwqnukTaJzodfb8180wxHZM4qt68u6x6ptuDRaQ==", + "dev": true, + "requires": { + "@types/mongoose": "*" + } + }, "@types/mongoose-lean-virtuals": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/@types/mongoose-lean-virtuals/-/mongoose-lean-virtuals-0.5.1.tgz", @@ -1694,6 +1722,12 @@ } } }, + "mongoose-autopopulate": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/mongoose-autopopulate/-/mongoose-autopopulate-0.12.3.tgz", + "integrity": "sha512-yNmYsfi6OpS/GQ+48mkB0KQ199ExHmmPrt3wt3fyxPHPMtEBGts7yq3wBQR6VgKCPOQaKvCI1URbJCPOtrPeLw==", + "requires": {} + }, "mongoose-legacy-pluralize": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", diff --git a/package.json b/package.json index b92228ff..9bf8cd16 100644 --- a/package.json +++ b/package.json @@ -24,10 +24,12 @@ "lambert-db": "^1.1.7", "missing-native-js-functions": "^1.2.2", "mongodb": "^3.6.6", - "mongoose": "^5.12.3" + "mongoose": "^5.12.3", + "mongoose-autopopulate": "^0.12.3" }, "devDependencies": { "@types/jsonwebtoken": "^8.5.0", + "@types/mongoose-autopopulate": "^0.10.1", "@types/mongoose-lean-virtuals": "^0.5.1", "@types/node": "^14.14.25", "typescript": "^4.1.3" diff --git a/src/models/Guild.ts b/src/models/Guild.ts index d3f098ea..aa520329 100644 --- a/src/models/Guild.ts +++ b/src/models/Guild.ts @@ -96,12 +96,14 @@ GuildSchema.virtual("channels", { localField: "id", foreignField: "guild_id", justOne: false, + autopopulate: true, }); GuildSchema.virtual("roles", { ref: RoleModel, localField: "id", foreignField: "guild_id", justOne: false, + autopopulate: true, }); // nested populate is needed for member users: https://gist.github.com/yangsu/5312204 @@ -117,6 +119,7 @@ GuildSchema.virtual("emojis", { localField: "id", foreignField: "guild_id", justOne: false, + autopopulate: true, }); GuildSchema.virtual("joined_at", { @@ -125,7 +128,6 @@ GuildSchema.virtual("joined_at", { foreignField: "guild_id", justOne: true, }).get((member: any, virtual: any, doc: any) => { - console.log("get", member, this); return member.joined_at; }); diff --git a/src/models/Member.ts b/src/models/Member.ts index fc9d5b99..52151235 100644 --- a/src/models/Member.ts +++ b/src/models/Member.ts @@ -1,7 +1,19 @@ -import { PublicUser, User, UserModel } from "./User"; +import { PublicUser, PublicUserProjection, User, UserModel } from "./User"; import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; +export const PublicMemberProjection = { + id: true, + guild_id: true, + nick: true, + roles: true, + joined_at: true, + pending: true, + deaf: true, + mute: true, + premium_since: true, +}; + export interface Member { id: string; guild_id: string; @@ -80,6 +92,9 @@ MemberSchema.virtual("user", { localField: "id", foreignField: "id", justOne: true, + autopopulate: { + select: PublicUserProjection, + }, }); // @ts-ignore diff --git a/src/models/Message.ts b/src/models/Message.ts index ee038f97..15ff57d3 100644 --- a/src/models/Message.ts +++ b/src/models/Message.ts @@ -1,7 +1,7 @@ import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; -import { PublicUser, UserModel } from "./User"; -import { MemberModel, PublicMember } from "./Member"; +import { PublicUser, PublicUserProjection, UserModel } from "./User"; +import { MemberModel, PublicMember, PublicMemberProjection } from "./Member"; import { Role, RoleModel } from "./Role"; import { Channel } from "./Channel"; @@ -229,6 +229,14 @@ export const MessageSchema = new Schema({ channel_id: String, guild_id: String, }, + // virtual: + // author: { + // ref: UserModel, + // localField: "author_id", + // foreignField: "id", + // justOne: true, + // autopopulate: { select: { id: true, user_data: false } }, + // }, }); MessageSchema.virtual("author", { @@ -236,6 +244,7 @@ MessageSchema.virtual("author", { localField: "author_id", foreignField: "id", justOne: true, + autopopulate: { select: PublicUserProjection }, }); MessageSchema.virtual("member", { @@ -250,6 +259,7 @@ MessageSchema.virtual("mentions", { localField: "mention_user_ids", foreignField: "id", justOne: false, + autopopulate: { select: PublicUserProjection }, }); MessageSchema.virtual("mention_roles", { @@ -257,6 +267,7 @@ MessageSchema.virtual("mention_roles", { localField: "mention_role_ids", foreignField: "id", justOne: false, + autopopulate: true, }); MessageSchema.virtual("mention_channels", { @@ -264,6 +275,7 @@ MessageSchema.virtual("mention_channels", { localField: "mention_channel_ids", foreignField: "id", justOne: false, + autopopulate: { select: { id: true, guild_id: true, type: true, name: true } }, }); MessageSchema.set("removeResponse", ["mention_channel_ids", "mention_role_ids", "mention_user_ids", "author_id"]); diff --git a/src/models/Role.ts b/src/models/Role.ts index adb75b0a..84ad55d0 100644 --- a/src/models/Role.ts +++ b/src/models/Role.ts @@ -34,6 +34,7 @@ export const RoleSchema = new Schema({ bot_id: String, }, }); +RoleSchema.set("removeResponse", ["guild_id"]); // @ts-ignore export const RoleModel = db.model("Role", RoleSchema, "roles"); diff --git a/src/models/User.ts b/src/models/User.ts index 76251e09..1f01e837 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -3,6 +3,13 @@ import { ClientStatus, Status } from "./Status"; import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; +export const PublicUserProjection = { + username: true, + discriminator: true, + id: true, + public_flags: true, + avatar: true, +}; export interface User { id: string; username: string; // username max length 32, min 2 diff --git a/src/models/index.ts b/src/models/index.ts index 03b9fe70..876e5984 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,5 +1,8 @@ import mongoose from "mongoose"; import { Schema } from "mongoose"; +import mongooseAutoPopulate from "mongoose-autopopulate"; + +mongoose.plugin(mongooseAutoPopulate); mongoose.plugin((schema: Schema, opts: any) => { schema.set("toObject", { From 44ddef21c6b41d1d09fb2031c64d795c8a1ef05a Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Thu, 8 Apr 2021 04:45:34 +0200 Subject: [PATCH 29/35] :page_facing_up: use Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License --- LICENSE | 111 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 94 insertions(+), 17 deletions(-) diff --git a/LICENSE b/LICENSE index 5c3f22a6..425b12be 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,98 @@ -MIT License +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License -Copyright (c) 2021 Discord Open Source +Copyright (c) 2021 Fosscord -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +Section 1 – Definitions. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. +Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. +BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License. +Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. +Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. +Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. +License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike. +Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. +Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. +Licensor means the individual(s) or entity(ies) granting rights under this Public License. +NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. +Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. +Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. +You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. +Section 2 – Scope. + +License grant. +Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: +reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and +produce, reproduce, and Share Adapted Material for NonCommercial purposes only. +Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. +Term. The term of this Public License is specified in Section 6(a). +Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. +Downstream recipients. +Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. +Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply. +No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. +No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). +Other rights. + +Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. +Patent and trademark rights are not licensed under this Public License. +To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + +Attribution. + +If You Share the Licensed Material (including in modified form), You must: + +retain the following if it is supplied by the Licensor with the Licensed Material: +identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); +a copyright notice; +a notice that refers to this Public License; +a notice that refers to the disclaimer of warranties; +a URI or hyperlink to the Licensed Material to the extent reasonably practicable; +indicate if You modified the Licensed Material and retain an indication of any previous modifications; and +indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. +You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. +If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. +ShareAlike. +In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. + +The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License. +You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. +You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + +for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only; +if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and +You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. +Section 5 – Disclaimer of Warranties and Limitation of Liability. + +Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. +To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. +The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. +Section 6 – Term and Termination. + +This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. +Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + +automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or +upon express reinstatement by the Licensor. +For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. +For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. +Sections 1, 5, 6, 7, and 8 survive termination of this Public License. +Section 7 – Other Terms and Conditions. + +The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. +Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. +Section 8 – Interpretation. + +For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. +To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. +No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. +Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. From 0b3ca4533f6dfa7f3e85bf2a8e0889510fd20bf9 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Thu, 8 Apr 2021 15:32:32 +0200 Subject: [PATCH 30/35] :bug: move dev dependencies to normal --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 9bf8cd16..1d3620f0 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,7 @@ "missing-native-js-functions": "^1.2.2", "mongodb": "^3.6.6", "mongoose": "^5.12.3", - "mongoose-autopopulate": "^0.12.3" - }, - "devDependencies": { + "mongoose-autopopulate": "^0.12.3", "@types/jsonwebtoken": "^8.5.0", "@types/mongoose-autopopulate": "^0.10.1", "@types/mongoose-lean-virtuals": "^0.5.1", From 9e7963824a47757d747ff5eda0226d939812f462 Mon Sep 17 00:00:00 2001 From: xnacly Date: Thu, 8 Apr 2021 15:56:09 +0200 Subject: [PATCH 31/35] added hasThrow --- src/util/Permissions.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) => { 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: [PATCH 32/35] 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 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); +} From 2d7e6a5081faef289c5a2f67189f220dc8c893ed Mon Sep 17 00:00:00 2001 From: xnacly Date: Thu, 8 Apr 2021 17:54:53 +0200 Subject: [PATCH 33/35] updated invite model --- src/models/Invite.ts | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/models/Invite.ts b/src/models/Invite.ts index 590a4598..41f33a02 100644 --- a/src/models/Invite.ts +++ b/src/models/Invite.ts @@ -1,5 +1,8 @@ import { Schema, Document, Types } from "mongoose"; import db from "../util/Database"; +import { ChannelModel } from "./Channel"; +import { UserModel } from "./User"; +import { GuildModel } from "./Guild"; export interface Invite extends Document { code: string; @@ -33,5 +36,62 @@ export const InviteSchema = new Schema({ target_user_type: Number, }); +InviteSchema.virtual("channel", { + ref: ChannelModel, + localField: "channel_id", + foreignField: "id", + justOne: true, + autopopulate: { + select: { + id: true, + name: true, + type: true, + }, + }, +}); + +InviteSchema.virtual("inviter", { + ref: UserModel, + localField: "inviter_id", + foreignField: "id", + justOne: true, + autopopulate: { + select: { + id: true, + username: true, + avatar: true, + discriminater: true, + public_flags: true, + }, + }, +}); + +InviteSchema.virtual("guild", { + ref: GuildModel, + localField: "guild_id", + foreignField: "id", + justOne: true, + autopopulate: { + select: { + id: true, + name: true, + splash: true, + banner: true, + description: true, + icon: true, + features: true, + verification_level: true, + vanity_url_code: true, + welcome_screen: true, + nsfw: true, + + // TODO: hide the following entries: + // channels: false, + // roles: false, + // emojis: false, + }, + }, +}); + // @ts-ignore export const InviteModel = db.model("Invite", InviteSchema, "invites"); From e5ada80d7ea12eb9d76227729264c56a9e2a8356 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Fri, 9 Apr 2021 00:36:08 +0200 Subject: [PATCH 34/35] :bug: fix Activity model with body schema --- src/models/Activity.ts | 40 +++++++++++++++++++++++++++++++++++++++- src/models/User.ts | 4 ++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/models/Activity.ts b/src/models/Activity.ts index 340590c4..e31f0019 100644 --- a/src/models/Activity.ts +++ b/src/models/Activity.ts @@ -46,7 +46,45 @@ export interface Activity { flags?: bigint; } -export const Activity = { +export const ActivitySchema = { + name: { type: String, required: true }, + type: { type: Number, required: true }, + url: String, + created_at: Date, + timestamps: [ + { + start: Number, + end: Number, + }, + ], + application_id: String, + details: String, + state: String, + emoji: { + name: String, + id: String, + amimated: Boolean, + }, + party: { + id: String, + size: [Number, Number], + }, + assets: { + large_image: String, + large_text: String, + small_image: String, + small_text: String, + }, + secrets: { + join: String, + spectate: String, + match: String, + }, + instance: Boolean, + flags: BigInt, +}; + +export const ActivityBodySchema = { name: String, type: Number, $url: String, diff --git a/src/models/User.ts b/src/models/User.ts index 8511a9b0..8cec334b 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -1,4 +1,4 @@ -import { Activity } from "./Activity"; +import { Activity, ActivitySchema } from "./Activity"; import { ClientStatus, Status } from "./Status"; import { Schema, Types, Document } from "mongoose"; import db from "../util/Database"; @@ -220,7 +220,7 @@ export const UserSchema = new Schema({ presence: { status: String, - activities: [Activity], + activities: [ActivitySchema], client_status: ClientStatus, }, }); From bd7b29cb1edba922524330ef3505908c797e057a Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Fri, 9 Apr 2021 13:59:02 +0200 Subject: [PATCH 35/35] :bug: fix Activity model --- src/models/Activity.ts | 3 ++- src/models/index.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/models/Activity.ts b/src/models/Activity.ts index e31f0019..2d70379c 100644 --- a/src/models/Activity.ts +++ b/src/models/Activity.ts @@ -1,6 +1,7 @@ import { User } from ".."; import { ClientStatus, Status } from "./Status"; import { Schema, model, Types, Document } from "mongoose"; +import toBigInt from "../util/toBigInt"; export interface Presence { user: User; @@ -81,7 +82,7 @@ export const ActivitySchema = { match: String, }, instance: Boolean, - flags: BigInt, + flags: { type: String, get: toBigInt }, }; export const ActivityBodySchema = { diff --git a/src/models/index.ts b/src/models/index.ts index 876e5984..5752e60d 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -19,18 +19,18 @@ mongoose.plugin((schema: Schema, opts: any) => { }); }); +export * from "./Activity"; +export * from "./Application"; export * from "./Ban"; export * from "./Channel"; export * from "./Emoji"; +export * from "./Event"; export * from "./Guild"; export * from "./Invite"; -export * from "./Member"; -export * from "./Role"; -export * from "./User"; -export * from "./Activity"; -export * from "./Application"; export * from "./Interaction"; +export * from "./Member"; export * from "./Message"; export * from "./Status"; +export * from "./Role"; +export * from "./User"; export * from "./VoiceState"; -export * from "./Event";