Update messaging on /nsfw command

This commit is contained in:
Noah 2023-08-11 18:36:21 -07:00
parent 69abf26e80
commit ef496b5642

View File

@ -44,24 +44,7 @@ func (s *Server) ProcessCommand(sub *Subscriber, msg Message) bool {
s.BansCommand(words, sub) s.BansCommand(words, sub)
return true return true
case "/nsfw": case "/nsfw":
if len(words) == 1 { s.NSFWCommand(words, sub)
sub.ChatServer("Usage: `/nsfw username` to add the NSFW flag to their camera.")
}
username := words[1]
other, err := s.GetSubscriber(username)
if err != nil {
sub.ChatServer("/nsfw: username not found: %s", username)
} else {
other.ChatServer(
"Just a friendly reminder to mark your camera as 'Explicit' by using the button at the top "+
"of the page if you are going to be sexual on webcam. Your camera has been marked as Explicit "+
"for you by @%s", sub.Username,
)
other.VideoStatus |= VideoFlagNSFW
other.SendMe()
s.SendWhoList()
sub.ChatServer("%s now has their camera marked as Explicit", username)
}
return true return true
case "/help": case "/help":
sub.ChatServer(RenderMarkdown("Moderator commands are:\n\n" + sub.ChatServer(RenderMarkdown("Moderator commands are:\n\n" +
@ -103,6 +86,35 @@ func (s *Server) ProcessCommand(sub *Subscriber, msg Message) bool {
return false return false
} }
// NSFWCommand handles the `/nsfw` operator command.
func (s *Server) NSFWCommand(words []string, sub *Subscriber) {
if len(words) == 1 {
sub.ChatServer("Usage: `/nsfw username` to add the NSFW flag to their camera.")
}
username := words[1]
other, err := s.GetSubscriber(username)
if err != nil {
sub.ChatServer("/nsfw: username not found: %s", username)
} else {
// The message to deliver to the target.
var message = "Just a friendly reminder to mark your camera as 'Explicit' by using the button at the top " +
"of the page if you are going to be sexual on webcam. "
// If the admin who marked it was previously booted
if other.Boots(sub.Username) {
message += "Your camera was detected to depict 'Explicit' activity and has been marked for you."
} else {
message += fmt.Sprintf("Your camera has been marked as Explicit for you by @%s", sub.Username)
}
other.ChatServer(message)
other.VideoStatus |= VideoFlagNSFW
other.SendMe()
s.SendWhoList()
sub.ChatServer("%s now has their camera marked as Explicit", username)
}
}
// KickCommand handles the `/kick` operator command. // KickCommand handles the `/kick` operator command.
func (s *Server) KickCommand(words []string, sub *Subscriber) { func (s *Server) KickCommand(words []string, sub *Subscriber) {
if len(words) == 1 { if len(words) == 1 {