mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-27 09:12:43 +02:00
fix command permission handling and push discord to v10 (#640)
Co-authored-by: Max Isom <hi@maxisom.me>
This commit is contained in:
parent
1ef05aba9d
commit
eb2885b206
38 changed files with 1214 additions and 644 deletions
19
src/utils/register-commands-on-guild.ts
Normal file
19
src/utils/register-commands-on-guild.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import {REST} from '@discordjs/rest';
|
||||
import {Routes} from 'discord-api-types/v10';
|
||||
import Command from '../commands';
|
||||
|
||||
interface RegisterCommandsOnGuildOptions {
|
||||
rest: REST;
|
||||
applicationId: string;
|
||||
guildId: string;
|
||||
commands: Array<Command['slashCommand']>;
|
||||
}
|
||||
|
||||
const registerCommandsOnGuild = async ({rest, applicationId, guildId, commands}: RegisterCommandsOnGuildOptions) => {
|
||||
await rest.put(
|
||||
Routes.applicationGuildCommands(applicationId, guildId),
|
||||
{body: commands.map(command => command.toJSON())},
|
||||
);
|
||||
};
|
||||
|
||||
export default registerCommandsOnGuild;
|
Loading…
Add table
Add a link
Reference in a new issue