Skip to content

0.18.1 - Eventhandler deprecation, Introducing streams

Compare
Choose a tag to compare
@l7ssha l7ssha released this 26 Jun 11:47

This version drastically changes API from 0.18.0 from overriding handler class to simply listeting to streams:

  Stream<Message> commandNotFoundEvent;
  Stream<Message> forAdminOnlyEvent;
  Stream<Message> requiredPermissionEvent;

To make use of streams just listen to it:

var commandsListener = new discord.Commands('~~', bot)
    ..add(new TestCommand())
    ..commandNotFoundEvent.listen((m) {
      m.channel.sendMessage(content: "Command '${m.content}' not found!");
    });