private async Task SendMessageToHandlerAsync(Channel channel, User user, string text, bool botIsMentioned, Handler handler) { try { await handler.OnMessage(channel, user, text, botIsMentioned, _cancellationSource.Token); } catch (Exception ex) { await SendMessage(channel, ex.ToString()); } }
public void RegisterHandler(Handler handler) { handler.SetBot(this); _handlers.Add(handler); }