registerGuildCommands method

Future<void> registerGuildCommands({
  1. required Guild guild,
  2. required List<AbstractCommand<CommandInteraction>> commands,
  3. required List<MineralContextMenu> contextMenus,
})

Implementation

Future<void> registerGuildCommands ({ required Guild guild, required List<AbstractCommand> commands, required List<MineralContextMenu> contextMenus }) async {
  await ioc.use<DiscordApiHttpService>().put(url: "/applications/${_application.id}/guilds/${guild.id}/commands")
    .payload([
      ...commands.map((command) => command.serialize).toList(),
      ...contextMenus.map((contextMenus) => contextMenus.builder.toJson).toList()
    ])
    .build();
}