UNPKG

guilded.ts

Version:

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

38 lines 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.deleted = exports.updated = exports.created = void 0; const util_1 = require("../../util"); /** * Handle the ServerChannelCreated event. * @param client The client the Websocket belongs to. * @param data The data of the event. */ function created(client, data) { const channel = (0, util_1.createChannel)(client, data.channel); client.emit('channelCreate', channel); } exports.created = created; /** * Handle the ServerChannelUpdated event. * @param client The client the Websocket belongs to. * @param data The data of the event. */ function updated(client, data) { const oldChannel = client.channels.cache.get(data.channel.id); const newChannel = (0, util_1.createChannel)(client, data.channel); client.emit('channelEdit', newChannel, oldChannel); } exports.updated = updated; /** * Handle the ServerChannelDeleted event. * @param client The client the Websocket belongs to. * @param data The data of the event. */ function deleted(client, data) { const channel = (0, util_1.createChannel)(client, data.channel); if (client.options.disposeCachedChannels ?? true) client.channels.cache.delete(channel.id); client.emit('channelDelete', channel); } exports.deleted = deleted; //# sourceMappingURL=channel.js.map