detritus-client
Version:
A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.
30 lines (29 loc) • 862 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Messages = void 0;
const basecollection_1 = require("./basecollection");
;
const defaultsMessagesCache = Object.freeze({
expire: 10 * 60 * 1000, // auto expire messages after 10 minutes
});
/**
* Messages Collection
* @category Collections
*/
class Messages extends basecollection_1.BaseClientCollection {
constructor(client, options = {}) {
if (typeof (options) === 'boolean') {
options = { enabled: options };
}
super(client, Object.assign({}, defaultsMessagesCache, options));
}
insert(message) {
if (this.enabled) {
this.set(message.id, message);
}
}
get [Symbol.toStringTag]() {
return `Messages (${this.size.toLocaleString()} items)`;
}
}
exports.Messages = Messages;