Пример #1
0
        private void ProcessChatMessage(ChatMessage chat)
        {
            var timeStamp = DateTime.UtcNow.AddHours(Config.TimeZoneOffset);

            if (Match.IsFreezeTime && Match.IsLive && !Match.Paused)
            {
                if (chat.Message.ToLower() == ".tac")
                {
                    Match.Paused = true;

                    TacMessageEventArgs tacArgs = new TacMessageEventArgs
                    {
                        Guild       = Manager.Guild,
                        CTScore     = Match.CTScore,
                        TScore      = Match.TScore,
                        TimeStamp   = timeStamp,
                        CTName      = Match.CTName,
                        TName       = Match.TName,
                        PausingTeam = chat.Player.Team == "CT" ? Match.CTName : Match.TName,
                        ServerId    = ID
                    };

                    OnTacPause(tacArgs);
                }
                else if (chat.Message.ToLower() == ".tech")
                {
                    Match.Paused = true;

                    TechMessageEventArgs techArgs = new TechMessageEventArgs
                    {
                        Guild       = Manager.Guild,
                        CTScore     = Match.CTScore,
                        TScore      = Match.TScore,
                        TimeStamp   = timeStamp,
                        CTName      = Match.CTName,
                        TName       = Match.TName,
                        PausingTeam = chat.Player.Team == "CT" ? Match.CTName : Match.TName,
                        ServerId    = ID
                    };

                    OnTechPause(techArgs);
                }
                else if (chat.Message.ToLower() == ".unpause")
                {
                    Match.Paused = false;
                    UnpauseMessageEventArgs unpauseMessageArgs = new UnpauseMessageEventArgs
                    {
                        Guild = Manager.Guild,

                        TimeStamp = timeStamp,

                        ServerId = ID
                    };

                    OnUnpause(unpauseMessageArgs);
                }
            }

            ChatMessageEventArgs chatArgs = new ChatMessageEventArgs
            {
                ChatMessage = chat,
                TimeStamp   = timeStamp,
                Guild       = Manager.Guild,
                ServerId    = ID
            };

            OnChatMessage(chatArgs);
        }
Пример #2
0
 private void OnUnpause(UnpauseMessageEventArgs unpauseMessageArgs)
 {
     UnpauseMessageEventArgs?.Invoke(this, unpauseMessageArgs);
 }
Пример #3
0
        private async void CsServerUnpauseAsync(object sender, UnpauseMessageEventArgs e)
        {
            var notification = await GetChannelAsync(e.Guild, ChannelNames.Notifications) as ISocketMessageChannel;

            await notification.SendMessageAsync($"[{e.ServerId}] {MentionUtils.MentionRole((await GetRoleAsync(e.Guild, RoleNames.Broadcast) as IRole).Id)} Match has unpaused - {e.TimeStamp.ToString("HH:mm:ss")}");
        }