Пример #1
0
 void OnRaided(IChannelInfoChannel channel, RaidInformation info)
 {
     Logger.Info(this, $"Channel is being raided by {info.Login} with {info.RaiderCount} users on {info.Service}");
     if (ValidUser(info.Service, info.Login))
     {
         Raid?.Invoke(info);
     }
 }
Пример #2
0
 /// <summary>
 /// creates a new <see cref="TwitchAccountChat"/>
 /// </summary>
 /// <param name="channel"></param>
 /// <param name="usermodule"></param>
 /// <param name="imagecache"></param>
 public TwitchAccountChat(ChatChannel channel, UserModule usermodule, ImageCacheModule imagecache)
     : base(channel, usermodule, imagecache)
 {
     channel.Raid += notice => Raid?.Invoke(this, new RaidInformation()
     {
         Service       = TwitchConstants.ServiceKey,
         Login         = notice.Login,
         DisplayName   = notice.DisplayName,
         Color         = notice.Color,
         Avatar        = notice.Avatar,
         Channel       = notice.Channel,
         RaiderCount   = notice.RaiderCount,
         RoomID        = notice.RoomID,
         SystemMessage = notice.SystemMessage
     });
 }
Пример #3
0
        void ReceiveRaidNotice(IrcMessage message)
        {
            RaidNotice raid = new RaidNotice();

            foreach (IrcTag attribute in message.Tags)
            {
                if (string.IsNullOrEmpty(attribute.Value))
                {
                    continue;
                }

                switch (attribute.Key)
                {
                case "color":
                    raid.Color = attribute.Value;
                    break;

                case "msg-param-displayName":
                case "display-name":
                    raid.DisplayName = attribute.Value;
                    break;

                case "msg-param-login":
                case "login":
                    raid.Login = attribute.Value;
                    break;

                case "msg-param-profileImageURL":
                    raid.Avatar = attribute.Value;
                    break;

                case "msg-param-viewerCount":
                    raid.RaiderCount = int.Parse(attribute.Value);
                    break;

                case "room-id":
                    raid.RoomID = attribute.Value;
                    break;

                case "system-msg":
                    raid.SystemMessage = attribute.Value;
                    break;
                }
            }

            Raid?.Invoke(raid);
        }