nyxx/nyxx.interactions/lib/src/Internal/_EventController.dart

24 lines
732 B
Dart
Raw Normal View History

2020-12-22 12:33:28 +01:00
part of nyxx_interactions;
class _EventController implements Disposable {
/// Emitted when a a slash command is sent.
late final StreamController<InteractionEvent> onSlashCommand;
/// Emitted when a a slash command is sent.
late final StreamController<SlashCommand> onSlashCommandCreated;
2020-12-22 12:33:28 +01:00
_EventController(Interactions _client) {
this.onSlashCommand = StreamController.broadcast();
_client.onSlashCommand = this.onSlashCommand.stream;
this.onSlashCommandCreated = StreamController.broadcast();
_client.onSlashCommandCreated = this.onSlashCommandCreated.stream;
2020-12-22 12:33:28 +01:00
}
@override
Future<void> dispose() async {
await this.onSlashCommand.close();
await this.onSlashCommandCreated.close();
2020-12-22 12:33:28 +01:00
}
2021-02-10 17:29:42 +01:00
}