registerGuildCommands method Null safety

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

Implementation

Future<void> registerGuildCommands ({ required Guild guild, required List<SlashCommand> commands, required List<MineralContextMenu> contextMenus }) async {
  Http http = ioc.singleton(ioc.services.http);
  await http.put(
    url: "/applications/${_application.id}/guilds/${guild.id}/commands",
    payload: [
      ...commands.map((command) => command.toJson()).toList(),
      ...contextMenus.map((contextMenus) => contextMenus.toJson()).toList()
    ]
  );
}