Beispiel #1
0
        bool HandleWhoCommand(UserInfo user, string channel, string cmd, bool opchat)
        {
            bool     isWho = cmd == ".who" || cmd == ".players" || cmd == "!players";
            DateTime last  = opchat ? lastOpWho : lastWho;

            if (!isWho || (DateTime.UtcNow - last).TotalSeconds <= 5)
            {
                return(false);
            }

            try {
                Player p = new IRCPlayer(channel, user.Nick, bot);
                Command.Find("Players").Use(p, "", ircDefault.DefaultCmdData);
            } catch (Exception e) {
                Logger.LogError(e);
            }

            if (opchat)
            {
                lastOpWho = DateTime.UtcNow;
            }
            else
            {
                lastWho = DateTime.UtcNow;
            }
            return(true);
        }
Beispiel #2
0
        bool HandleIRCCommand(UserInfo user, string channel, string cmdName, string cmdArgs)
        {
            Command cmd = Command.Find(cmdName);
            Player  p   = new IRCPlayer(channel, user.Nick, bot);

            if (cmd == null)
            {
                p.Message("Unknown command!"); return(false);
            }

            string logCmd = cmdArgs.Length == 0 ? cmdName : cmdName + " " + cmdArgs;

            Logger.Log(LogType.CommandUsage, "/{0} (by {1} from IRC)", logCmd, user.Nick);

            try {
                if (!p.CanUse(cmd))
                {
                    CommandPerms.Find(cmd.name).MessageCannotUse(p);
                    return(false);
                }
                if (!cmd.SuperUseable)
                {
                    p.Message(cmd.name + " can only be used in-game.");
                    return(false);
                }
                cmd.Use(p, cmdArgs);
            } catch (Exception ex) {
                p.Message("CMD Error: " + ex);
                Logger.LogError(ex);
            }
            return(true);
        }
Beispiel #3
0
        bool HandleWhoCommand(UserInfo user, string channel, string ircCmd, bool opchat)
        {
            bool     whoCmd = ircCmd == ".who" || ircCmd == ".players" || ircCmd == "!players";
            DateTime last   = opchat ? lastOpWho : lastWho;

            if (!whoCmd || (DateTime.UtcNow - last).TotalSeconds <= 5)
            {
                return(false);
            }

            try {
                Player p = new IRCPlayer(channel, user.Nick, bot);
                p.group = Group.GuestRank;
                Command.all.FindByName("Players").Use(p, "");
            } catch (Exception e) {
                Logger.LogError(e);
            }

            if (opchat)
            {
                lastOpWho = DateTime.UtcNow;
            }
            else
            {
                lastWho = DateTime.UtcNow;
            }
            return(true);
        }