sharp-chat/SharpChat/Packet/BanListResponsePacket.cs

27 lines
780 B
C#

using System.Text;
namespace SharpChat.Packet {
public class BanListResponsePacket : SockChatTimedS2CPacket {
private readonly string[] Bans;
public BanListResponsePacket(string[] bans) {
Bans = bans;
}
public override string Pack() {
StringBuilder sb = new();
sb.AppendFormat("2\t{0}\t-1\t0\fbanlist\f", TimeStamp.ToUnixTimeSeconds());
foreach(string ban in Bans)
sb.AppendFormat(@"<a href=""javascript:void(0);"" onclick=""Chat.SendMessageWrapper('/unban '+ this.innerHTML);"">{0}</a>, ", ban);
if(Bans.Length > 0)
sb.Length -= 2;
sb.AppendFormat("\t{0}\t10010", MessageId);
return sb.ToString();
}
}
}