示例#1
0
        protected override bool CheckController(string userID, ref string error)
        {
            bool foundAtAll = false;

            foreach (string chan in Channels)
            {
                if (nicks.VerifyNick(chan, userID, ref error, ref foundAtAll))
                {
                    return(true);
                }
            }
            foreach (string chan in OpChannels)
            {
                if (nicks.VerifyNick(chan, userID, ref error, ref foundAtAll))
                {
                    return(true);
                }
            }

            if (!foundAtAll)
            {
                error = "You are not on the bot's list of users for some reason, please leave and rejoin.";
            }
            return(false);
        }
示例#2
0
文件: IRCBot.cs 项目: Fam0r/MCGalaxy
        protected override bool CanUseCommands(RelayUser user, string cmdName, out string error)
        {
            error = null;
            string nick = user.Nick;

            if (!Server.ircControllers.Contains(nick))
            {
                return(false);
            }

            bool foundAtAll = false;

            foreach (string chan in Channels)
            {
                if (nicks.VerifyNick(chan, nick, ref error, ref foundAtAll))
                {
                    return(true);
                }
            }
            foreach (string chan in OpChannels)
            {
                if (nicks.VerifyNick(chan, nick, ref error, ref foundAtAll))
                {
                    return(true);
                }
            }

            if (!foundAtAll)
            {
                error = "You are not on the bot's list of users for some reason, please leave and rejoin."; return(false);
            }
            if (BannedCommands.CaselessContains(cmdName))
            {
                error = "You are not allowed to use this command from IRC.";
            }
            return(false);
        }