UNPKG

auth.gg

Version:
74 lines (51 loc) 2.49 kB
const { Structures } = require("discord.js"); const APIMessage = require('../../v12/Classes/APIMessage').APIMessage; const WebhookClient = require('../../v12/Classes/WebhookClient'); const { ApplicationCommandOptionTypes, InteractionResponseTypes } = require('discord.js').Constants; const MessageFlags = require('discord.js').MessageFlags; class CommandInteraction extends Structures.get("CommandInteraction") { constructor(client, data) { super(client, data); this.webhook = new WebhookClient(this.applicationID, this.token, this.client.options); } async reply(content, options) { if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED'); const apiMessage = content instanceof APIMessage ? content : APIMessage.create(this, content, options); const { data, files } = await apiMessage.resolveData().resolveFiles(); await this.client.api.interactions(this.id, this.token).callback.post({ data: { type: InteractionResponseTypes.CHANNEL_MESSAGE_WITH_SOURCE, data, }, files, }); this.replied = true; } async followUp(content, options) { const apiMessage = content instanceof APIMessage ? content : APIMessage.create(this, content, options); const { data, files } = await apiMessage.resolveData().resolveFiles(); const raw = await this.client.api.webhooks(this.applicationID, this.token).post({ data, files, }); return this.channel?.messages.add(raw) ?? raw; } async editReply(content, options) { const raw = await this.webhook.editMessage('@original', content, options); return this.channel?.messages.add(raw) ?? raw; } } module.exports = CommandInteraction; //Developed By OldModz95#7213 // https://discord.gg/3t2568W //====CREDIT==== // System Button created by AngeloCore // https://www.npmjs.com/package/discord-buttons // System Button nuggies by Nuggies-bot //https://github.com/Nuggies-bot/nuggies-npm //https://www.npmjs.com/package/nuggies //============ // La base des plugins ont étais développer par leur créateur. // J'ai apporté beaucoup de modification par apport au bot que je voulais faire. // The basis of the plugins were developed by their creator. // I made a lot of changes for the bot I wanted to do.