Exemplo n.º 1
0
        bool cmdMute(VPServices app, Avatar who, string target, bool muting)
        {
            // Mute IRC
            if (target == "")
            {
                who.SetSetting(settingMuteIRC, muting);
                app.Notify(who.Session, msgMuteIRC, muting ? "hidden from" : "shown to");
                return true;
            }

            // Reject invalid names
            if ( target.Contains(',') )
            {
                app.Warn(who.Session, "Cannot mute that name; commas not allowed");
                return true;
            }

            var muteList = who.GetSetting(settingMuteList);
            var muted    = ( muteList ?? "" ).TerseSplit(',').ToList();
            target       = target.ToLower();

            if (muting)
            {
                if ( muted.Contains(target) )
                {
                    app.Warn(who.Session, msgMuted, "already");
                    return true;
                }

                muted.Add(target);
                app.Notify(who.Session, msgMuteUser, target, "hidden");
            }
            else
            {
                if ( !muted.Contains(target) )
                {
                    app.Warn(who.Session, msgMuted, "not");
                    return true;
                }

                muted.Remove(target);
                app.Notify(who.Session, msgMuteUser, target, "shown");
            }

            muteList = string.Join(",", muted);
            who.SetSetting(settingMuteList, muteList);
            return true;
        }
Exemplo n.º 2
0
        void onEnter(Instance sender, Avatar who)
        {
            // Do not teleport users home within 10 seconds of bot's startup
            if ( VPServices.App.LastConnect.SecondsToNow() < 10 )
                return;

            var lastExit = who.GetSettingDateTime(settingLastExit);

            // Ignore bouncing/disconnected users
            if ( lastExit.SecondsToNow() < 10 )
                return;

            // Do not teleport home if bouncing
            if ( who.GetSetting(settingBounce) != null )
                who.DeleteSetting(settingBounce);
            else
                cmdGoHome(VPServices.App, who, true);
        }