guilded.ts
Version:
A powerful NPM module that allows you to easily interact with the Guilded API.
28 lines • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.updated = exports.created = void 0;
const Webhook_1 = require("../../structures/Webhook");
/**
* Handle the ServerWebhookCreated 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.webhook.channelId);
const webhook = new Webhook_1.Webhook(channel, data.webhook);
client.emit('webhookCreate', webhook);
}
exports.created = created;
/**
* Handle the ServerWebhookUpdated 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.webhook.channelId);
const oldWebhook = channel.webhooks.cache.get(data.webhook.id);
const newWebhook = new Webhook_1.Webhook(channel, data.webhook);
client.emit('webhookEdit', newWebhook, oldWebhook);
}
exports.updated = updated;
//# sourceMappingURL=webhook.js.map