コード例 #1
0
        public static async Task MassMentionCheck(SocketCommandContext context)
        {
            try
            {
                if (context.Message.MentionedUsers.Count > 8)
                {
                    SocketUser target = context.Message.Author;
                    await context.Message.DeleteAsync();

                    await DiscordContextSeymour.AddRole(DiscordContextSeymour.GrabRole(MordhauRoleEnum.Muted), target.Id);

                    await DiscordContextOverseer.LogModerationAction(target.Id, "Muted", "excessive pinging", Utilities.ShortTimeSpanFormatting(new TimeSpan(3, 0, 0, 0)));

                    await TimedEventManager.CreateEvent(DisciplinaryEventEnum.MuteEvent,
                                                        context.Client.CurrentUser.Id,
                                                        "excessive pinging",
                                                        target.Id,
                                                        target.Username,
                                                        (DateTimeOffset.UtcNow + new TimeSpan(0, 30, 0)).DateTime);

                    await TimedEventManager.CreateEvent(DisciplinaryEventEnum.WarnEvent, context.Client.CurrentUser.Id, "AutoWarn : excessive pinging", target.Id, target.Username, DateTime.UtcNow.AddDays(ConfigManager.GetIntegerProperty(PropertyItem.WarnDuration)));

                    if (context.Channel != null)
                    {
                        await DiscordContextOverseer.GetChannel(context.Channel.Id).SendMessageAsync($"{context.Message.Author.Mention}, Thou shall not say thy noble's names in vain. {DiscordContextSeymour.GetEmoteAyySeymour()}");
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.HandleException($"{typeof(AutoModeratorManager).GetType().FullName}: {ExceptionManager.GetAsyncMethodName()}", ex);
            }
        }
コード例 #2
0
        //
        // Constructors
        //

        public Scene()
        {
            // Make all the managers
            this.manAnimationFlip   = new AnimationFlipManager(2, 1);
            this.manAnimationFrame  = new AnimationFrameManager(4, 1);
            this.manAnimationMotion = new AnimationMotionManager(1, 1);
            this.manCollisionPair   = new CollisonPairManager(13, 1);
            this.manGameObject      = new GameObjectManager(50, 10);
            this.manSpriteBatch     = new SpriteBatchManager(7, 1);
            this.manSpriteProxy     = new SpriteProxyManager(50, 10);
            this.manSpriteColProxy  = new SpriteCollisonProxyManager(50, 10);
            this.manTimedEvent      = new TimedEventManager(10, 1, SceneManager.Self.AzulClockTime);

            // Make all the other containers
            this.gameData                 = new GameSessionData();
            this.hudDisplay               = this.CreateHud();
            this.collisionBatch           = this.manSpriteBatch.Find(SpriteBatch.Name.SpriteCollisions);
            this.collisionBatch.IsEnabled = false;

            // Set scene data
            this.name                   = Name.UNINITIALIZED;
            this.lastAzulTime           = 0.0f;
            this.alienCoordinatorId     = 0u;
            this.ufoId                  = 0u;
            this.isLoaded               = false;
            this.isPaused               = false;
            this.isMarkedForSceneChange = false;
            this.isMarkedForRemoval     = false;
        }
コード例 #3
0
ファイル: Events.cs プロジェクト: zangopmd/Scripts
        public static void StartEvent()
        {
            if (ActiveEvent == null)
            {
                return;
            }

            foreach (var registeredClient in EventManager.GetRegisteredClients())
            {
                Story story = new Story(Guid.NewGuid().ToString());
                StoryBuilderSegment segment = StoryBuilder.BuildStory();
                StoryBuilder.AppendSaySegment(segment, $"This event is... {ActiveEvent.Name}!", -1, 0, 0);
                StoryBuilder.AppendSaySegment(segment, ActiveEvent.IntroductionMessage, -1, 0, 0);

                foreach (var rule in ActiveEvent.Rules)
                {
                    StoryBuilder.AppendSaySegment(segment, rule, -1, 0, 0);
                }

                if (ActiveEvent.Duration.HasValue)
                {
                    StoryBuilder.AppendSaySegment(segment, $"The event will end in {ActiveEvent.Duration.Value.TotalMinutes} minutes.", -1, 0, 0);
                }
                if (Main.IsTestingEvent)
                {
                    StoryBuilder.AppendSaySegment(segment, $"This event is currently being tested and winners will not receive any prizes.", -1, 0, 0);
                }
                else if (!string.IsNullOrEmpty(ActiveEvent.RewardMessage))
                {
                    StoryBuilder.AppendSaySegment(segment, ActiveEvent.RewardMessage, -1, 0, 0);
                }

                StoryBuilder.AppendSaySegment(segment, "The event has now begun!", -1, 0, 0);
                segment.AppendToStory(story);
                StoryManager.PlayStory(registeredClient, story);
            }

            ActiveEvent.Start();

            var eventStartMessage = new StringBuilder();

            if (Main.IsTestingEvent)
            {
                eventStartMessage.Append("[Testing] ");
            }
            eventStartMessage.Append($"{ActiveEvent.Name} has started!");

            Task.Run(() => DiscordManager.Instance.SendAnnouncement(eventStartMessage.ToString()));
            Messenger.SendAnnouncement("Weekly Event", eventStartMessage.ToString());

            if (ActiveEvent.Duration.HasValue)
            {
                var endTime = DateTime.UtcNow.Add(ActiveEvent.Duration.Value);

                SetGlobalCountdown(new Countdown("The event ends in...", endTime));
                TimedEventManager.CreateTimer("endevent", endTime, null);
            }
        }
コード例 #4
0
        public static async Task CheckForWarnThreshold(SocketGuildUser target, SocketCommandContext context, int warnCount, ITextChannel chnl = null)
        {
            try
            {
                if (warnCount >= (ConfigManager.GetIntegerProperty(PropertyItem.MaxWarns))) //more or equal the warn thresold
                {
                    await DiscordContextSeymour.AddRole(DiscordContextSeymour.GrabRole(MordhauRoleEnum.Muted), target.Id);

                    await DiscordContextOverseer.LogModerationAction(target.Id, "Muted", $"User has been warned {warnCount} times, exceeding the {ConfigManager.GetIntegerProperty(PropertyItem.MaxWarns)} warn threshold", Utilities.ShortTimeSpanFormatting(new TimeSpan(1, 0, 0, 0)));

                    await TimedEventManager.CreateEvent(DisciplinaryEventEnum.MuteEvent,
                                                        context.Client.CurrentUser.Id,
                                                        $"User has been warned {warnCount} times, exceeding the {ConfigManager.GetIntegerProperty(PropertyItem.MaxWarns)} warn threshold",
                                                        target.Id,
                                                        target.Username,
                                                        (DateTimeOffset.UtcNow + new TimeSpan(1, 0, 0, 0)).DateTime);

                    if (chnl == null)
                    {
                        await DiscordContextOverseer.GetChannel(context.Channel.Id).SendMessageAsync($"Silence. {target.Mention}");
                    }
                    else
                    {
                        await DiscordContextOverseer.GetChannel(chnl.Id).SendMessageAsync($"Silence. {target.Mention}");
                    }
                }
                else if (warnCount > (ConfigManager.GetIntegerProperty(PropertyItem.MaxWarns) / 2)) //more than half the warn thresold
                {
                    await DiscordContextSeymour.AddRole(DiscordContextSeymour.GrabRole(MordhauRoleEnum.Muted), target.Id);

                    await DiscordContextOverseer.LogModerationAction(target.Id, "Muted", $"User has been warned {warnCount} times, exceeding half of the {ConfigManager.GetIntegerProperty(PropertyItem.MaxWarns)} warn threshold", Utilities.ShortTimeSpanFormatting(new TimeSpan(0, 30, 0)));

                    await TimedEventManager.CreateEvent(DisciplinaryEventEnum.MuteEvent,
                                                        context.Client.CurrentUser.Id,
                                                        $"User has been warned {warnCount} times, exceeding half of the {ConfigManager.GetIntegerProperty(PropertyItem.MaxWarns)} warn threshold",
                                                        target.Id,
                                                        target.Username,
                                                        (DateTimeOffset.UtcNow + new TimeSpan(0, 30, 0)).DateTime);


                    if (chnl == null) //channel specified check
                    {
                        await DiscordContextOverseer.GetChannel(context.Channel.Id).SendMessageAsync($"{target.Mention}, enough.");
                    }
                    else
                    {
                        await DiscordContextOverseer.GetChannel(chnl.Id).SendMessageAsync($"{target.Mention}, enough.");
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.HandleException(ErrMessages.CheckForWarnThresholdException, ex);
            }
        }
コード例 #5
0
ファイル: Events.cs プロジェクト: zangopmd/Scripts
        public static void FinishEvent()
        {
            if (ActiveEvent != null)
            {
                ActiveEvent.AnnounceWinner();

                ActiveEvent = null;
                EventManager.ActiveEventIdentifier = null;
                TimedEventManager.CreateTimer("eventdeschedule", DateTime.UtcNow.AddDays(1), null);
            }

            EventManager.RegisteredCharacters.Clear();
        }
コード例 #6
0
 void Awake() {
     World = _World;
     LandWaterMask = _LandWaterMask;
     GT = transform.GetComponent<GameTime>();
     WM = transform.GetComponent<WorldManager>();
     AEM = transform.GetComponent<AnomalousEventManager>();
     TEM = transform.GetComponent<TimedEventManager>();
     CM = transform.GetComponent<ColorManager>();
     NM  = transform.GetComponent<NotificationManager>();
     GOI = transform.GetComponent<GoIManager>();
     POI = transform.GetComponent<PoIManager>();        
     WC = transform.GetComponent<WebController>();
     
 }
コード例 #7
0
ファイル: Eviction.cs プロジェクト: GIRU-GIRU/SeymourBot
        private async Task BanUserAsync(ulong userID, TimeSpan timeSpan, [Remainder] string reason = "no reason specified")
        {
            try
            {
                SocketGuildUser user = Context.Guild.GetUser(userID);
                if (user == null)
                {
                    await Context.Channel.SendMessageAsync($"Unable to locate user {DiscordContextSeymour.GetEmoteAyySeymour()}");

                    return;
                }
                string kickTargetName = user.Username;
                if (!await DiscordContextSeymour.IsUserDevOrAdminAsync(user as SocketGuildUser))
                {
                    await user.BanAsync(reason : reason);
                }
                else
                {
                    return;
                }

                var embed = Utilities.BuildDefaultEmbed(DisciplinaryEventEnum.BanEvent, timeSpan, reason, kickTargetName, false);
                await Context.Channel.SendMessageAsync("", false, embed);

                UserDisciplinaryEventStorage obj = new UserDisciplinaryEventStorage()
                {
                    DateInserted         = DateTime.UtcNow,
                    DateToRemove         = (DateTimeOffset.UtcNow + timeSpan).DateTime,
                    DiscipinaryEventType = DisciplinaryEventEnum.BanEvent,
                    ModeratorID          = Context.Message.Author.Id,
                    Reason = reason,
                    UserID = Context.Message.Author.Id
                };
                UserStorage newUser = new UserStorage()
                {
                    UserID   = Context.Message.Author.Id,
                    UserName = Context.Message.Author.Username
                };

                await TimedEventManager.CreateEvent(obj, newUser);
            }
            catch (Exception ex)
            {
                ExceptionManager.HandleException(ErrMessages.BanException, ex);
            }
        }
コード例 #8
0
        // Call on first load to set up custom components
        private void InitProgram()
        {
            m_Log.Log(Logging.LOGTYPE.ERROR, "Enter Init program()");

            // Hide it on startup
            SetWindowVisible(false);

            m_Log.Log(Logging.LOGTYPE.ERROR, "Load panels");
            LoadPanels();
            LoadIcons();

            m_Log.Log(Logging.LOGTYPE.ERROR, "Reading configured start");
            ReadConfiguredStart();

            m_Log.Log(Logging.LOGTYPE.ERROR, "Set up stats panel");
            SetStatusPanel();

            // Set/Check status every second
            m_TimedEventManager = new TimedEventManager(1000, m_Log);
            m_TimedEventManager.Begin();

            m_Log.Log(Logging.LOGTYPE.ERROR, "HandleState()");
            // Get states and set up processing
            HandleState();


            m_Log.Log(Logging.LOGTYPE.ERROR, "Setup timers");
            LoadMainTimer();

            LoadUpdateTimer();

            m_Log.Log(Logging.LOGTYPE.ERROR, "UpdateUI()");
            // Do initial GUI setup
            UpdateUI();

            m_Log.Log(Logging.LOGTYPE.ERROR, "Leaving Init Program()");
        }
コード例 #9
0
 // Use this for initialization
 void Start()
 {
     TimedEventManager.GetInstance().AddTimedEvent(.5f, () => {
         theAnimator.SetTrigger("doStand");
     });
 }
コード例 #10
0
        public static async Task FilterMessage(SocketCommandContext context)
        {
            var splitContent = context.Message.Content.ToLower().Split();

            if (bannedRegex.Count > 0)
            {
                foreach (ModeratedElement element in bannedRegex)
                {
                    if (new Regex(element.Pattern).Match(context.Message.Content).Success)
                    {
                        await context.Message.DeleteAsync();

                        string reason;
                        if (element.Dialog.Length == 0)
                        {
                            reason = BotDialogs.DefaultRegexFilterMessage;
                        }
                        else
                        {
                            reason = element.Dialog;
                        }
                        await context.Channel.SendMessageAsync(context.User.Mention + ", " + reason);

                        await TimedEventManager.CreateEvent(DisciplinaryEventEnum.WarnEvent, context.Client.CurrentUser.Id, "AutoWarn : " + reason, context.Message.Author.Id, context.Message.Author.Username, DateTime.UtcNow.AddDays(ConfigManager.GetIntegerProperty(PropertyItem.WarnDuration)));
                        await CheckForWarnThreshold(context.Message.Author as SocketGuildUser, context, await StorageManager.GetRecentWarningsAsync(context.Message.Author.Id));

                        break;
                    }
                }
            }
            foreach (ModeratedElement element in bannedWords)
            {
                if (splitContent.Contains(element.Pattern.Trim()))
                {
                    string reason;
                    if (element.Dialog.Length == 0)
                    {
                        reason = "Do not use such disgusting language in my presence";
                    }
                    else
                    {
                        reason = element.Dialog;
                    }
                    await context.Channel.SendMessageAsync(context.User.Mention + ", " + reason);

                    await TimedEventManager.CreateEvent(DisciplinaryEventEnum.WarnEvent, context.Client.CurrentUser.Id, "AutoWarn : " + reason, context.Message.Author.Id, context.Message.Author.Username, DateTime.UtcNow.AddDays(ConfigManager.GetIntegerProperty(PropertyItem.WarnDuration)));
                    await CheckForWarnThreshold(context.Message.Author as SocketGuildUser, context, await StorageManager.GetRecentWarningsAsync(context.Message.Author.Id));


                    try
                    {
                        await context.Message.DeleteAsync();
                    }
                    catch (Exception ex)
                    {
                        await ExceptionManager.LogExceptionAsync(ex.Message);
                    }
                    break;
                }
            }
        }