Exemplo n.º 1
0
        public async void HandleMessage(Room room, Message message)
        {
            var chatLine = message.Line as ChatLine;
            if (chatLine == null || chatLine.SenderId == "0")
                return;

            await Task.Yield();

            var senderId = long.Parse(chatLine.SenderId);

            var recipientDevices = Notifications
                .Where(n => n.UserId != senderId && !room.IsBanned(n.Name) && n.Rooms.Contains(chatLine.Chat))
                .Where(n => IsMatch(n.Regex, chatLine.Content))
                .Select(n => n.DeviceToken)
                .ToList();

            if (recipientDevices.Count > 0)
            {
                var content = $"[{chatLine.Chat}] {WebUtility.HtmlDecode(chatLine.Sender)}: {WebUtility.HtmlDecode(chatLine.Content)}";
                await Notify(recipientDevices, content);
            }
        }
Exemplo n.º 2
0
 // For RohBot rooms
 public CommandTarget(Connection connection, string room)
 {
     Room = Program.RoomManager.Get(room);
     Connection = connection;
 }
Exemplo n.º 3
0
 // For Steam rooms
 public CommandTarget(Room room, SteamPersona sender)
 {
     Room = room;
     Persona = sender;
 }
Exemplo n.º 4
0
 public void SendLeaveRoom(Room room)
 {
     Send(new Chat
     {
         Method = "leave",
         Name = room.RoomInfo.Name,
         ShortName = room.RoomInfo.ShortName
     });
 }
Exemplo n.º 5
0
        public void SendJoinRoom(Room room)
        {
            Send(new Chat
            {
                Method = "join",
                Name = room.RoomInfo.Name,
                ShortName = room.RoomInfo.ShortName
            });

            room.SendHistory(this);
        }
Exemplo n.º 6
0
 private static string GetRankString(Room room, string username)
 {
     if (Util.IsAdmin(room, username))
         return "Administrator";
     if (Util.IsMod(room, username))
         return "Moderator";
     if (room.IsBanned(username))
         return "Guest";
     return "Member";
 }