Answer if mentioned if not specifying a default channel

Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
mudler
2025-04-02 17:10:03 +02:00
parent 6d9f1a95cc
commit b81f34a8f8

View File

@@ -195,13 +195,14 @@ func (d *Discord) messageCreate(a *agent.Agent) func(s *discordgo.Session, m *di
} }
// check if the message is in a thread and get all messages in the thread // check if the message is in a thread and get all messages in the thread
if m.MessageReference != nil { if m.MessageReference != nil &&
((d.defaultChannel != "" && m.ChannelID == d.defaultChannel) || (mentioned && d.defaultChannel == "")) {
d.handleThreadMessage(a, s, m) d.handleThreadMessage(a, s, m)
return return
} }
// Or we are in the default channel (if one is set!) // Or we are in the default channel (if one is set!)
if d.defaultChannel != "" && m.ChannelID == d.defaultChannel { if (d.defaultChannel != "" && m.ChannelID == d.defaultChannel) || (mentioned && d.defaultChannel == "") {
d.handleChannelMessage(a, s, m) d.handleChannelMessage(a, s, m)
return return
} }