sharp-chat/SharpChat.Protocol.SockChat/Packets/BanListPacket.cs

19 lines
648 B
C#
Raw Permalink Normal View History

2022-08-30 15:05:29 +00:00
using SharpChat.Bans;
using SharpChat.Users;
using System.Collections.Generic;
using System.Linq;
namespace SharpChat.Protocol.SockChat.Packets {
public class BanListPacket : BotResponsePacket {
private const string FORMAT = @"<a href=""javascript:void(0);"" onclick=""Chat.SendMessageWrapper('/unban '+ this.innerHTML);"">{0}</a>, ";
public BanListPacket(IUser sender, IEnumerable<IBanRecord> bans)
: base(
sender.UserId,
BotArguments.BANS,
false,
string.Join(@", ", bans.Select(b => string.Format(FORMAT, b.UserName)))
) { }
}
}