Beispiel #1
0
        public void AddChannel(IChatChannel channel)
        {
            Logger.Info(this, $"Adding channel '{channel.Name}' from connected channel list");
            lock (channellock) {
                channel.UserJoined += OnChannelUserJoined;
                channel.UserLeft   += OnChannelUserLeft;

                if (channel.Flags.HasFlag(ChannelFlags.Chat))
                {
                    channel.ChatMessage += OnChannelChatMessage;
                }

                if (channel is IBotChatChannel)
                {
                    IBotChatChannel botchannel = (IBotChatChannel)channel;

                    botchannel.CommandReceived += OnChannelCommandReceived;
                }

                if (channel is IChannelInfoChannel)
                {
                    IChannelInfoChannel infochannel = (IChannelInfoChannel)channel;
                    infochannel.Hosted       += OnHosted;
                    infochannel.Raid         += OnRaided;
                    infochannel.MicroPresent += OnChannelMicroPresentReceived;
                }

                channels.Add(channel);
                channel.Initialize();
            }
        }
Beispiel #2
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);
     }
 }
Beispiel #3
0
 void OnHosted(IChannelInfoChannel channel, HostInformation information)
 {
     Logger.Info(this, $"Channel is being hosted by {information.Channel} with {information.Viewers} viewers on {information.Service}");
     if (ValidUser(information.Service, information.Channel))
     {
         Hosted?.Invoke(information);
     }
 }
Beispiel #4
0
 void OnChannelMicroPresentReceived(IChannelInfoChannel channel, MicroPresent present)
 {
     Logger.Info(this, $"{present.Service}/{present.Username} donated {present.Amount} {present.Currency}.");
     MicroPresent?.Invoke(present);
 }