Update get_slash_commands.ts

This commit is contained in:
ITOH
2021-04-23 23:27:56 +02:00
parent f27d586811
commit 653e608d0e
+2 -2
View File
@@ -6,12 +6,12 @@ import { endpoints } from "../../util/constants.ts";
/** Fetch all of the global commands for your application. */ /** Fetch all of the global commands for your application. */
export async function getSlashCommands(guildId?: string) { export async function getSlashCommands(guildId?: string) {
const result = (await rest.runMethod( const result = await rest.runMethod<ApplicationCommand[]>(
"get", "get",
guildId guildId
? endpoints.COMMANDS_GUILD(applicationId, guildId) ? endpoints.COMMANDS_GUILD(applicationId, guildId)
: endpoints.COMMANDS(applicationId), : endpoints.COMMANDS(applicationId),
)) as ApplicationCommand[]; );
return new Collection(result.map((command) => [command.name, command])); return new Collection(result.map((command) => [command.name, command]));
} }