UNPKG

guilded.ts

Version:

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

85 lines 3.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.unlocked = exports.locked = exports.unpinned = exports.pinned = exports.deleted = exports.updated = exports.created = void 0; const ForumTopic_1 = require("../../structures/ForumTopic"); /** * Handle the ForumTopicCreated event. * @param client The client the Websocket belongs to. * @param data The data of the event. */ async function created(client, data) { const channel = (await client.channels.fetch(data.forumTopic.channelId)); const topic = new ForumTopic_1.ForumTopic(channel, data.forumTopic); client.emit('forumTopicCreate', topic); } exports.created = created; /** * Handle the ForumTopicUpdated event. * @param client The client the Websocket belongs to. * @param data The data of the event. */ async function updated(client, data) { const channel = (await client.channels.fetch(data.forumTopic.channelId)); const oldForumTopic = channel.topics.cache.get(data.forumTopic.id); const newForumTopic = new ForumTopic_1.ForumTopic(channel, data.forumTopic); client.emit('forumTopicEdit', newForumTopic, oldForumTopic); } exports.updated = updated; /** * Handle the ForumTopicDeleted event. * @param client The client the Websocket belongs to. * @param data The data of the event. */ async function deleted(client, data) { const channel = (await client.channels.fetch(data.forumTopic.channelId)); const forumTopic = new ForumTopic_1.ForumTopic(channel, data.forumTopic); if (client.options.disposeCachedForumTopics ?? true) channel.topics.cache.delete(forumTopic.id); client.emit('forumTopicDelete', forumTopic); } exports.deleted = deleted; /** * Handle the ForumTopicPinned event. * @param client The client the Websocket belongs to. * @param data The data of the event. */ async function pinned(client, data) { const channel = (await client.channels.fetch(data.forumTopic.channelId)); const forumTopic = new ForumTopic_1.ForumTopic(channel, data.forumTopic); client.emit('forumTopicPin', forumTopic); } exports.pinned = pinned; /** * Handle the ForumTopicUnpinned event. * @param client The client the Websocket belongs to. * @param data The data of the event. */ async function unpinned(client, data) { const channel = (await client.channels.fetch(data.forumTopic.channelId)); const forumTopic = new ForumTopic_1.ForumTopic(channel, data.forumTopic); client.emit('forumTopicUnpin', forumTopic); } exports.unpinned = unpinned; /** * Handle the ForumTopicLocked event. * @param client The client the Websocket belongs to. * @param data The data of the event. */ async function locked(client, data) { const channel = (await client.channels.fetch(data.forumTopic.channelId)); const forumTopic = new ForumTopic_1.ForumTopic(channel, data.forumTopic); client.emit('forumTopicLock', forumTopic); } exports.locked = locked; /** * Handle the ForumTopicUnlocked event. * @param client The client the Websocket belongs to. * @param data The data of the event. */ async function unlocked(client, data) { const channel = (await client.channels.fetch(data.forumTopic.channelId)); const forumTopic = new ForumTopic_1.ForumTopic(channel, data.forumTopic); client.emit('forumTopicUnlock', forumTopic); } exports.unlocked = unlocked; //# sourceMappingURL=forumTopic.js.map