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