Skip to content

Commit cbb877b

Browse files
committed
Fix thread name length reaching limit
1 parent 0aa3255 commit cbb877b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bridge/discord/discord.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,20 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) {
293293
if msg.ParentValid() {
294294
if parentMessage, _ := b.c.ChannelMessage(channelID, msg.ParentID); parentMessage != nil {
295295
if parentMessage.Thread != nil {
296-
b.Log.Debugf("Thread found: %s", parentMessage.Thread.ParentID)
296+
b.Log.Infof("Thread found: %s", parentMessage.Thread.ParentID)
297297
threadID = parentMessage.Thread.ID
298298
} else {
299299
content := replaceEmotes(parentMessage.Content)
300300
if content == "" {
301301
content = "thread"
302302
}
303+
if len(content) > 100 {
304+
content = content[:100]
305+
}
303306

304-
b.Log.Debugf("Creating thread")
305-
var thread, _ = b.c.MessageThreadStart(channelID, parentMessage.ID, content, 60)
306-
b.Log.Debugf("Created thread %s", thread.ID)
307+
b.Log.Infof("Creating thread")
308+
var thread, err = b.c.MessageThreadStart(channelID, parentMessage.ID, content, 60)
309+
b.Log.Infof("Created thread %s %s", thread.ID, err)
307310
threadID = thread.ID
308311
}
309312
}

0 commit comments

Comments
 (0)