discord.js-selfbot-v13/src/client/actions/InviteCreate.js
March 7th 7dfdef46a5 Downgrade to v13
[vi] cảm giác đau khổ
2022-03-24 17:55:32 +07:00

29 lines
893 B
JavaScript

'use strict';
const Action = require('./Action');
const { Events } = require('../../util/Constants');
class InviteCreateAction extends Action {
handle(data) {
const client = this.client;
const channel = client.channels.cache.get(data.channel_id);
const guild = client.guilds.cache.get(data.guild_id);
if (!channel) return false;
const inviteData = Object.assign(data, { channel, guild });
const invite = guild.invites._add(inviteData);
/**
* Emitted when an invite is created.
* <info> This event only triggers if the client has `MANAGE_GUILD` permissions for the guild,
* or `MANAGE_CHANNELS` permissions for the channel.</info>
* @event Client#inviteCreate
* @param {Invite} invite The invite that was created
*/
client.emit(Events.INVITE_CREATE, invite);
return { invite };
}
}
module.exports = InviteCreateAction;