CommandService constructor

CommandService(
  1. List<MineralCommandContract> commands
)

Implementation

CommandService(List<MineralCommandContract> commands): super(inject: true) {
  register(commands);

  controller.stream.listen((event) async {
    final command = _handlers.getOrFail(_buildIdentifier(event.interaction.data));

    await command.handle(command.scope!.isGlobal
        ? event.getInteraction<GlobalCommandInteraction>(CommandScope.global)
        : event.getInteraction<GuildCommandInteraction>(CommandScope.guild));
  });
}