Add simple thread support for forums
Some checks failed
Some checks failed
This commit is contained in:
20
commands.go
20
commands.go
@@ -706,8 +706,24 @@ func fnBridge(ce *WrappedCommandEvent) {
|
|||||||
}
|
}
|
||||||
portal := ce.User.GetExistingPortalByID(channelID)
|
portal := ce.User.GetExistingPortalByID(channelID)
|
||||||
if portal == nil {
|
if portal == nil {
|
||||||
ce.Reply("Channel not found")
|
// HACK: Before giving up, discover if the user is trying to join a
|
||||||
return
|
// 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()
|
portal.roomCreateLock.Lock()
|
||||||
defer portal.roomCreateLock.Unlock()
|
defer portal.roomCreateLock.Unlock()
|
||||||
|
|||||||
Reference in New Issue
Block a user