Skip to content

Commit c8da380

Browse files
committed
trying to remove mentions
1 parent 40aaec4 commit c8da380

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/bot/chat.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ func (c *chatCommand) Handler(ctx context.Context, s *discordgo.Session, m *disc
5757
if err != nil {
5858
return nil, err
5959
}
60-
60+
for _, msg := range msgs {
61+
if msg.Content == "" {
62+
break //sometimes history gives us empty items
63+
}
64+
msg.Content = strings.ReplaceAll(msg.Content, s.State.User.Mention(), s.State.User.GlobalName)
65+
}
66+
s.State.User.Mention()
6167
//remove latest from history
6268
msgs = msgs[:len(msgs)-1]
6369
resp, err := c.llm.Chat(ctx, m.Message, msgs)

0 commit comments

Comments
 (0)