private async Task MessageReceived(SocketMessage msg) { // Take input and Validate if (msg is not SocketUserMessage message) { return; // We only accept SocketUserMessages } if (message.Author.IsBot) { return; // We don't allow bots to talk to each other lest they take over the world! } IChannelHandler handler = ChannelHandlers.ContainsKey(msg.Channel.Name) ? ChannelHandlers[msg.Channel.Name] : DefaultHandler; var context = new CommandContext(Context, message); if (context == null || string.IsNullOrWhiteSpace(context.Message.Content)) { return; // Context must be valid and message must not be empty } await handler.MessageReceived(context); }