Add config option for number of private channels to automatically bridge on startup

This commit is contained in:
Tulir Asokan
2022-07-08 22:43:52 +03:00
parent ca8682657c
commit 33a002a053
4 changed files with 7 additions and 2 deletions

View File

@@ -544,10 +544,9 @@ func (user *User) readyHandler(_ *discordgo.Session, r *discordgo.Ready) {
user.handleGuild(guild, updateTS, portalsInSpace[guild.ID])
}
user.PrunePortalList(updateTS)
const maxCreate = 5
for i, ch := range r.PrivateChannels {
portal := user.GetPortalByMeta(ch)
user.handlePrivateChannel(portal, ch, updateTS, i < maxCreate, portalsInSpace[portal.Key.ChannelID])
user.handlePrivateChannel(portal, ch, updateTS, i < user.bridge.Config.Bridge.PrivateChannelCreateLimit, portalsInSpace[portal.Key.ChannelID])
}
if r.ReadState.Version > user.ReadStateVersion {