UNPKG

guilded.ts

Version:

A powerful NPM module that allows you to easily interact with the Guilded API.

35 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MessageCollector = void 0; const Collector_1 = require("./Collector"); /** * The message collector for a channel. * @example new MessageCollector(channel); */ class MessageCollector extends Collector_1.Collector { channel; /** * @param channel The channel the message collector belongs to. * @param options The options of the message collector. */ constructor(channel, options) { super(channel.client, options); this.channel = channel; this.options.dispose = options?.dispose ?? this.client.options.disposeCollectedMessages; this.client.on('messageCreate', this.collectMessage.bind(this)); this.client.on('messageEdit', this.collectMessage.bind(this)); this.client.on('messageDelete', this.disposeMessage.bind(this)); } /** @ignore */ collectMessage(message) { if (message.channelId !== this.channel.id) return; this.collect(message); } /** @ignore */ disposeMessage(message) { this.dispose(message.id); } } exports.MessageCollector = MessageCollector; //# sourceMappingURL=MessageCollector.js.map