Skip to content

Commit

Permalink
fix command
Browse files Browse the repository at this point in the history
  • Loading branch information
zcpua committed Jul 3, 2023
1 parent e70147f commit 449d5c1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ export class Command {
if (this.cache[name] !== undefined) {
return this.cache[name];
}
const command = await this.getCommand(name);
this.cache[name] = command;
return command;
if (this.config.ServerId){
const command = await this.getCommand(name);
this.cache[name] = command;
return command;
}
this.allCommand();
return this.cache[name];
}
async allCommand() {
const searchParams = new URLSearchParams({
Expand Down Expand Up @@ -67,7 +71,7 @@ export class Command {
query: name,
limit: "1",
include_applications: "true",
command_ids: `${this.config.BotId}`,
// command_ids: `${this.config.BotId}`,
});
const url = `${this.config.DiscordBaseUrl}/api/v9/channels/${this.config.ChannelId}/application-commands/search?${searchParams}`;
const response = await this.config.fetch(url, {
Expand Down

0 comments on commit 449d5c1

Please sign in to comment.