Broadcast bans and kicks to everybody

This commit is contained in:
Noah 2023-08-06 20:37:41 -07:00
parent ba88357121
commit 6d26c2f141

View File

@ -124,6 +124,13 @@ func (s *Server) KickCommand(words []string, sub *Subscriber) {
})
s.DeleteSubscriber(other)
sub.ChatServer("%s has been kicked from the room", username)
// Broadcast it to everyone.
s.Broadcast(Message{
Action: ActionPresence,
Username: username,
Message: "has been kicked from the room!",
})
}
}
@ -197,6 +204,13 @@ func (s *Server) BanCommand(words []string, sub *Subscriber) {
// Ban them.
BanUser(username, duration)
// Broadcast it to everyone.
s.Broadcast(Message{
Action: ActionPresence,
Username: username,
Message: "has been banned!",
})
other.ChatServer("You have been banned from the chat room by %s. You may come back after %d hours.", sub.Username, duration/time.Hour)
other.SendJSON(Message{
Action: ActionKick,