Soulseek: implement user actions

This commit is contained in:
7x11x13 2024-07-13 11:25:20 -04:00
parent e36a15c706
commit 9f24a1e54f
2 changed files with 10 additions and 1 deletions

View File

@ -42,6 +42,11 @@ func (b *Bsoulseek) handleChatMessage(msg sayChatroomMessageReceive) {
Channel: msg.Room, Channel: msg.Room,
Username: msg.Username, Username: msg.Username,
} }
if strings.HasPrefix(msg.Message, "/me ") {
// user action
bridgeMessage.Text = msg.Message[4:]
bridgeMessage.Event = config.EventUserAction
}
b.local <- bridgeMessage b.local <- bridgeMessage
} }

View File

@ -211,7 +211,11 @@ func (b *Bsoulseek) Send(msg config.Message) (string, error) {
if msg.Event != "" && msg.Event != config.EventUserAction && msg.Event != config.EventJoinLeave { if msg.Event != "" && msg.Event != config.EventUserAction && msg.Event != config.EventJoinLeave {
return "", nil return "", nil
} }
b.messagesToSend <- makeSayChatroomMessage(msg.Channel, msg.Username+msg.Text) text := msg.Username+msg.Text
if msg.Event == config.EventUserAction {
text = msg.Username + "/me " + msg.Text
}
b.messagesToSend <- makeSayChatroomMessage(msg.Channel, text)
return "", nil return "", nil
} }