Skip to content

Commit

Permalink
Soulseek: implement user actions
Browse files Browse the repository at this point in the history
  • Loading branch information
7x11x13 committed Jul 13, 2024
1 parent e36a15c commit 9f24a1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions bridge/soulseek/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func (b *Bsoulseek) handleChatMessage(msg sayChatroomMessageReceive) {
Channel: msg.Room,
Username: msg.Username,
}
if strings.HasPrefix(msg.Message, "/me ") {
// user action
bridgeMessage.Text = msg.Message[4:]
bridgeMessage.Event = config.EventUserAction
}
b.local <- bridgeMessage
}

Expand Down
6 changes: 5 additions & 1 deletion bridge/soulseek/soulseek.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ func (b *Bsoulseek) Send(msg config.Message) (string, error) {
if msg.Event != "" && msg.Event != config.EventUserAction && msg.Event != config.EventJoinLeave {
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
}

Expand Down

0 comments on commit 9f24a1e

Please sign in to comment.