File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { API } from '@discordjs/core/http-only' ;
2- import { REST , type RESTPutAPIApplicationCommandsResult } from 'discord.js' ;
1+ import { REST , type RESTPutAPIApplicationCommandsResult , Routes } from 'discord.js' ;
32import { commands } from '../commands/index.js' ;
43import { config } from '../env.js' ;
54
65export async function deployCommands ( ) : Promise < RESTPutAPIApplicationCommandsResult > {
76 const commandData = [ ...commands . values ( ) ] . map ( ( command ) => command . data ) ;
87
98 const rest = new REST ( { version : '10' } ) . setToken ( config . discord . token ) ;
10- const api = new API ( rest ) ;
119
12- const result = await api . applicationCommands . bulkOverwriteGlobalCommands (
13- config . discord . clientId ,
14- commandData
15- ) ;
10+ const result = ( await rest . put (
11+ Routes . applicationGuildCommands ( config . discord . clientId , config . serverId ) ,
12+ {
13+ body : commandData ,
14+ }
15+ ) ) as RESTPutAPIApplicationCommandsResult ;
1616
1717 console . log ( `Successfully registered ${ result . length } commands.` ) ;
1818 return result ;
You can’t perform that action at this time.
0 commit comments