public void HandleCommand(TriggerBase trigger) { string text = trigger.Args.NextWord(); if (CommandBase.IgnoreCommandCase) { text = text.ToLower(); } CommandBase commandBase = this[text]; if (commandBase != null && trigger.CanAccessCommand(commandBase)) { try { if (trigger.BindToCommand(commandBase)) { commandBase.Execute(trigger); } return; } catch (Exception ex) { trigger.ReplyError("Raised exception (error-index:{0}) : {1}", new object[] { trigger.RegisterException(ex), ex.Message }); if (ex.InnerException != null) { trigger.ReplyError(" => " + ex.InnerException.Message); } return; } } trigger.ReplyError("Incorrect Command \"{0}\". Type commandslist or help for command list.", new object[] { text }); }
public void HandleCommand(TriggerBase trigger) { var cmdstring = trigger.Args.NextWord(); if (CommandBase.IgnoreCommandCase) { cmdstring = cmdstring.ToLower(); } var cmd = this[cmdstring]; if (cmd != null && trigger.CanAccessCommand(cmd)) { try { if (trigger.BindToCommand(cmd)) { cmd.Execute(trigger); } trigger.Log(); } catch (Exception ex) { trigger.ReplyError("Raised exception (error-index:{0}) : {1}", trigger.RegisterException(ex), ex.Message); if (ex.InnerException != null) { trigger.ReplyError(" => " + ex.InnerException.Message); } } } else { if (cmdstring.Length > 0) { trigger.ReplyError("La commande \"{0}\" est incorrecte, <b>.help</b> pour avoir la liste des commandes.", cmdstring); } } }
public void HandleCommand(TriggerBase trigger) { var cmdstring = trigger.Args.NextWord(); if (CommandBase.IgnoreCommandCase) { cmdstring = cmdstring.ToLower(); } var cmd = this[cmdstring]; if (cmd != null && trigger.CanAccessCommand(cmd)) { try { if (trigger.BindToCommand(cmd)) { cmd.Execute(trigger); } //Log command trigger.Log(); } catch (Exception ex) { trigger.ReplyError("Raised exception (error-index:{0}) : {1}", trigger.RegisterException(ex), ex.Message); if (ex.InnerException != null) { trigger.ReplyError(" => " + ex.InnerException.Message); } } } else { trigger.ReplyError("Incorrect Command \"{0}\". Type commandslist or help for command list.", cmdstring); } }