Add simple thread support for forums
Some checks failed
Go / Lint ${{ matrix.go-version == '1.26' && '(latest)' || '(old)' }} (1.26) (push) Has been cancelled
Go / Lint ${{ matrix.go-version == '1.26' && '(latest)' || '(old)' }} (1.25) (push) Failing after 4m44s
Lock old issues / lock-stale (push) Failing after 5s

This commit is contained in:
2026-02-17 21:38:06 +02:00
parent 19e26674e6
commit 1717ddb30f

View File

@@ -706,9 +706,25 @@ func fnBridge(ce *WrappedCommandEvent) {
}
portal := ce.User.GetExistingPortalByID(channelID)
if portal == nil {
// HACK: Before giving up, discover if the user is trying to join a
// thread. Then, cause the creation of a portal.
// This is for forum channel threads; they don't show up on the
// forum channels.
ch, err := ce.User.Session.Channel(channelID)
if err != nil {
ce.Reply("Channel not found")
return
}
if ch.Type != discordgo.ChannelTypeGuildPublicThread &&
ch.Type != discordgo.ChannelTypeGuildPrivateThread {
return
}
ce.ZLog.Debug().Msg("Adding public / private thread as a portal")
portal = ce.User.GetPortalByID(channelID, ch.Type)
}
portal.roomCreateLock.Lock()
defer portal.roomCreateLock.Unlock()
if portal.MXID != "" {