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 OnChannelCommandReceived(IBotChatChannel channel, StreamCommand command)
        {
            if (!ValidUser(command.Service, command.User))
            {
                return;
            }

            string whispered = command.IsWhispered ? "(Whispered)" : "";

            Logger.Info(this, $"{command.Service} - {whispered}{command.User}: !{command.Command} {string.Join(" ", command.Arguments)}");
            ExecuteCommand(channel, command);
        }