From 8eaa5e0c72919fc1d558fcb1d01b301b1afbfe30 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Sat, 11 Jun 2022 23:15:51 +0700 Subject: [PATCH] fix: channel.sendSlash is not function Todo: fix opcode 24 error --- src/errors/Messages.js | 1 + src/structures/interfaces/TextBasedChannel.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/errors/Messages.js b/src/errors/Messages.js index cead85f..d16677a 100644 --- a/src/errors/Messages.js +++ b/src/errors/Messages.js @@ -95,6 +95,7 @@ const Messages = { GUILD_CHANNEL_UNOWNED: "The fetched channel does not belong to this manager's guild.", GUILD_OWNED: 'Guild is owned by the client.', GUILD_MEMBERS_TIMEOUT: "Members didn't arrive in time.", + GUILD_APPLICATION_COMMANDS_SEARCH_TIMEOUT: "Application commands didn't arrive in time.", GUILD_UNCACHED_ME: 'The client user as a member of this guild is uncached.', CHANNEL_NOT_CACHED: 'Could not find the channel where this message came from in the cache!', STAGE_CHANNEL_RESOLVE: 'Could not resolve channel to a stage channel.', diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index ac087b4..a26f97c 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -393,10 +393,10 @@ class TextBasedChannel { * Send Slash to this channel * @param {Snowflake} botId Bot Id * @param {string} commandName Command name - * @param {?Array} args Command arguments + * @param {...?string} args Command arguments * @returns {Promise} */ - async sendSlash(botId, commandName, args = []) { + async sendSlash(botId, commandName, ...args) { // If (!this.isText()) throw new Error('This channel is not text-based.'); if (!botId) throw new Error('Bot ID is required'); const user = await this.client.users.fetch(botId).catch(() => {}); @@ -427,7 +427,7 @@ class TextBasedChannel { content: '', id: this.client.user.id, }), - args, + args && args.length ? args : [], ); } @@ -447,6 +447,7 @@ class TextBasedChannel { 'createWebhook', 'setRateLimitPerUser', 'setNSFW', + 'sendSlash', ); } for (const prop of props) {