Exemple #1
0
        public void HandleCommand(TriggerBase trigger, string delimiter)
        {
            var cmdstring = trigger.Args.NextWord();

            cmdstring = cmdstring.ToLower();

            var cmd = this[cmdstring];

            if (cmd != null)
            {
                try
                {
                    cmd.Delimiter = delimiter;

                    if (trigger.BindToCommand(cmd))
                    {
                        cmd.Execute(trigger);
                    }

                    //Log command
                    trigger.Log();
                }
                catch (Exception ex)
                {
                    trigger.ReplyError("Raised exception : {1}", ex.Message);

                    if (ex.InnerException != null)
                    {
                        trigger.ReplyError(" => " + ex.InnerException.Message);
                    }
                }
            }
            else
            {
                trigger.ReplyError(CommandNotFound, cmdstring);
            }
        }