コード例 #1
0
ファイル: JinxMod.cs プロジェクト: Mofsy/jinxbot-plugins
        public bool HandleCommand(IJinxBotPrincipal commander, string command, string[] parameters)
        {
            // TODO: Fix the ability to determine if I am the owner (that is, if I'm commanding myself)
            if (commander.Username.Equals(m_bnet.UniqueUsername, StringComparison.OrdinalIgnoreCase) || commander.IsInRole("O"))
            {
                switch (command.ToUpper())
                {
                    case "FIND":
                        if (parameters.Length == 1)
                        {
                            Find(parameters[0]);
                            return true;
                        }
                        return false;
                    case "ADDROLE":
                        if (parameters.Length == 2)
                        {
                            AddRole(parameters);
                            return true;
                        }
                        return false;
                    case "REMROLE":
                        if (parameters.Length == 2)
                        {
                            RemoveRole(parameters);
                            return true;
                        }
                        return false;
                    default:
                        return false;
                }
            }

            return false;
        }
コード例 #2
0
ファイル: JinxMod.cs プロジェクト: Mofsy/jinxbot-plugins
 public IEnumerable<string> GetCommandHelp(IJinxBotPrincipal commander)
 {
     if (commander.Username.Equals(m_bnet.UniqueUsername, StringComparison.OrdinalIgnoreCase) || commander.IsInRole("O"))
     {
         yield return "addrole <user|meta> <role> - Adds the specified role to a user or meta";
         yield return "delrole <user|meta> <role> - Removes the specified role from a user or meta";
         yield return "find <user> - Finds the most recent occurrance of <user>.";
     }
 }