コード例 #1
0
        public async Task MessageHandler(IContext e)
        {
            ICommand command = CommandProvider.ProvideCommand(e.ExtractMessageContent());

            if (command is null)
            {
                foreach (var comm in CommandProvider.Commands.Values)
                {
                    await comm.OnRegularMessage(e);
                }
            }

            if (command is null)
            {
                if (IsCommand(e.ExtractMessageContent()))
                {
                    await e.Respond("Command not recognized :(");
                }
                return;
            }

            await command.Run(e);
        }