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;CACb,CAAC;AAEW,QAAA,UAAU,GAAG;IACzB,G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AC,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;IACX,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,MA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tC,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";