fix #977
This commit is contained in:
Elysia
2024-01-07 19:59:45 +07:00
parent f025065a63
commit 556f1d3396
3 changed files with 6 additions and 3 deletions

View File

@@ -498,8 +498,11 @@ class TextBasedChannel {
}
if (user._partial) await user.getProfile().catch(() => {});
if (!commandName || typeof commandName !== 'string') throw new Error('Command name is required');
const data = await this.searchInteraction(user.application?.id ?? user.id, 'CHAT_INPUT');
const API =
this.client.api[this.guild ? 'guilds' : 'channels'][this.guild?.id || this.id]['application-command-index'];
const data = await API.get();
for (const command of data.application_commands) {
if (command.type !== 1) continue;
if (user.id == command.application_id || user.application.id == command.application_id) {
user.application?.commands?._add(command, true);
}