fix: channel.sendSlash is not function

Todo: fix opcode 24 error
This commit is contained in:
March 7th 2022-06-11 23:15:51 +07:00
parent 81bc22f388
commit 8eaa5e0c72
2 changed files with 5 additions and 3 deletions

View File

@ -95,6 +95,7 @@ const Messages = {
GUILD_CHANNEL_UNOWNED: "The fetched channel does not belong to this manager's guild.", GUILD_CHANNEL_UNOWNED: "The fetched channel does not belong to this manager's guild.",
GUILD_OWNED: 'Guild is owned by the client.', GUILD_OWNED: 'Guild is owned by the client.',
GUILD_MEMBERS_TIMEOUT: "Members didn't arrive in time.", 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.', 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!', 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.', STAGE_CHANNEL_RESOLVE: 'Could not resolve channel to a stage channel.',

View File

@ -393,10 +393,10 @@ class TextBasedChannel {
* Send Slash to this channel * Send Slash to this channel
* @param {Snowflake} botId Bot Id * @param {Snowflake} botId Bot Id
* @param {string} commandName Command name * @param {string} commandName Command name
* @param {?Array<string>} args Command arguments * @param {...?string} args Command arguments
* @returns {Promise<pending>} * @returns {Promise<pending>}
*/ */
async sendSlash(botId, commandName, args = []) { async sendSlash(botId, commandName, ...args) {
// If (!this.isText()) throw new Error('This channel is not text-based.'); // If (!this.isText()) throw new Error('This channel is not text-based.');
if (!botId) throw new Error('Bot ID is required'); if (!botId) throw new Error('Bot ID is required');
const user = await this.client.users.fetch(botId).catch(() => {}); const user = await this.client.users.fetch(botId).catch(() => {});
@ -427,7 +427,7 @@ class TextBasedChannel {
content: '', content: '',
id: this.client.user.id, id: this.client.user.id,
}), }),
args, args && args.length ? args : [],
); );
} }
@ -447,6 +447,7 @@ class TextBasedChannel {
'createWebhook', 'createWebhook',
'setRateLimitPerUser', 'setRateLimitPerUser',
'setNSFW', 'setNSFW',
'sendSlash',
); );
} }
for (const prop of props) { for (const prop of props) {