Skip to content

Commit

Permalink
Move onMessageCreate listener
Browse files Browse the repository at this point in the history
  • Loading branch information
l7ssha committed Oct 28, 2024
1 parent db8b9f0 commit b544e52
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/src/commands.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ class CommandsPlugin extends NyxxPlugin<NyxxRest> implements CommandGroup<Comman
client.onApplicationCommandInteraction.map((event) => event.interaction);
onApplicationCommandAutocompleteInteraction =
client.onApplicationCommandAutocompleteInteraction.map((event) => event.interaction);

client.onMessageCreate.listen((event) async {
try {
await eventManager.processMessageCreateEvent(event);
} on CommandsException catch (e) {
_onCommandErrorController.add(e);
}
});
} else {
throw ArgumentError();
}
Expand Down Expand Up @@ -276,14 +284,6 @@ class CommandsPlugin extends NyxxPlugin<NyxxRest> implements CommandGroup<Comman
}
});

(client as NyxxGateway).onMessageCreate.listen((event) async {
try {
await eventManager.processMessageCreateEvent(event);
} on CommandsException catch (e) {
_onCommandErrorController.add(e);
}
});

if (children.isNotEmpty) {
_syncCommands(client);
}
Expand Down

0 comments on commit b544e52

Please sign in to comment.