Ejemplo n.º 1
0
 private void HandleChannelNotice(object sender, ChannelNotice message)
 {
     if (Enabled)
     {
         CheckMessages(message.Sender.Nickname);
     }
 }
Ejemplo n.º 2
0
 private void HandleChannelNoticeEvent(object sender, ChannelNotice info)
 {
     if (Enabled &&
         !Bot.ServerConfig.ChannelBlacklist.Contains(info.Channel) &&
         !Bot.ServerConfig.NickBlacklist.Contains(info.Sender.Nickname) &&
         !ChannelBlacklist.Contains(info.Channel) &&
         !NickBlacklist.Contains(info.Sender.Nickname))
     {
         ProcessAutoBan(info.Channel, info.Sender.Nickname, info.Sender.Host);
     }
 }
Ejemplo n.º 3
0
 private void HandleChannelNotice(object sender, ChannelNotice message)
 {
     if (Enabled && !Bot.IsCommand(message.Message))
     {
         string command = Bot.GetCommand(message.Message);
         if (!string.IsNullOrEmpty(command))
         {
             List <Dictionary <string, object> > foundTriggers = GetTrigger(message.Sender, null, message.Channel, null, command);
             if (foundTriggers.Any())
             {
                 foreach (Dictionary <string, object> foundTrigger in foundTriggers)
                 {
                     ExecuteCommand(MessageType.Notice, message.Channel, message.Sender, foundTrigger);
                 }
             }
         }
     }
 }
        public async void SendNewChannelNoticesAsync(IEnumerable <ChannelUserVm> channelUsers, long channelId, ClientConnection clientConnection)
        {
            try
            {
                ChannelVm channel = await loadChannelsService.GetChannelByIdAsync(channelId).ConfigureAwait(false);

                ChannelNotice notice = new ChannelNotice(channel);
                foreach (var channelUser in channelUsers)
                {
                    var clientConnections = connectionsService.GetUserClientConnections(channelUser.UserId);
                    if (clientConnections != null)
                    {
                        await SendNoticeToClientsAsync(clientConnections.Where(opt => opt != clientConnection), notice).ConfigureAwait(false);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex);
            }
        }
 public async void SendChannelNoticeAsync(ChannelVm channel, List <long> usersId, ClientConnection clientConnection = null)
 {
     try
     {
         List <ClientConnection> clientsConnections = new List <ClientConnection>();
         foreach (long userId in usersId)
         {
             var clientConnections = connectionsService.GetUserClientConnections(userId);
             if (clientConnections != null)
             {
                 clientsConnections.AddRange(clientConnections.Where(opt => opt != clientConnection));
             }
         }
         ChannelVm channelClone = (ChannelVm)channel.Clone();
         channelClone.ChannelUsers = null;
         channelClone.UserRole     = null;
         ChannelNotice notice = new ChannelNotice(channelClone);
         await SendNoticeToClientsAsync(clientsConnections, notice).ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         Logger.WriteLog(ex);
     }
 }
Ejemplo n.º 6
0
        private void ChannelNoticeHandler(object sender, ChannelNotice e)
        {
            string message = string.Format("saying the following notice in \u0002{0}\u0002: {1}", e.Channel, e.Message);

            UpdateSeen(e.Channel, e.Sender, message, e.TimeStamp);
        }
Ejemplo n.º 7
0
 private void LogChannelNotice(object sender, ChannelNotice notice)
 {
     LogToFile(notice.Channel, notice.TimeStamp, string.Format("<{0}> {1}", notice.Sender.Nickname, notice.Message));
 }
Ejemplo n.º 8
0
        private void ChannelNoticeReceivedHandler(object sender, ChannelNotice message, string server)
        {
            string location = (SelectedServer == server) ? SelectedLocation : null;

            AddToBuffer(server, location, string.Format("[{0}] \u0002{1}\u0002 -NOTICE-: {2}", message.TimeStamp.ToString("HH:mm:ss"), message.Sender.Nickname, message.Message));
        }
Ejemplo n.º 9
0
        private void RelayChannelNotice(object sender, ChannelNotice e)
        {
            string msg = string.Format("[{0}] [-{1}-] {2}", e.Channel, e.Sender.Nickname, e.Message);

            ProcessRelay(e.Channel, RelayType.Message, msg);
        }