Add config option for number of private channels to automatically bridge on startup
This commit is contained in:
@@ -34,6 +34,8 @@ type BridgeConfig struct {
|
|||||||
GuildNameTemplate string `yaml:"guild_name_template"`
|
GuildNameTemplate string `yaml:"guild_name_template"`
|
||||||
PrivateChatPortalMeta bool `yaml:"private_chat_portal_meta"`
|
PrivateChatPortalMeta bool `yaml:"private_chat_portal_meta"`
|
||||||
|
|
||||||
|
PrivateChannelCreateLimit int `yaml:"startup_private_channel_create_limit"`
|
||||||
|
|
||||||
DeliveryReceipts bool `yaml:"delivery_receipts"`
|
DeliveryReceipts bool `yaml:"delivery_receipts"`
|
||||||
MessageStatusEvents bool `yaml:"message_status_events"`
|
MessageStatusEvents bool `yaml:"message_status_events"`
|
||||||
MessageErrorNotices bool `yaml:"message_error_notices"`
|
MessageErrorNotices bool `yaml:"message_error_notices"`
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ func DoUpgrade(helper *up.Helper) {
|
|||||||
helper.Copy(up.Str, "bridge", "channel_name_template")
|
helper.Copy(up.Str, "bridge", "channel_name_template")
|
||||||
helper.Copy(up.Str, "bridge", "guild_name_template")
|
helper.Copy(up.Str, "bridge", "guild_name_template")
|
||||||
helper.Copy(up.Bool, "bridge", "private_chat_portal_meta")
|
helper.Copy(up.Bool, "bridge", "private_chat_portal_meta")
|
||||||
|
helper.Copy(up.Bool, "bridge", "startup_private_channel_create_limit")
|
||||||
helper.Copy(up.Int, "bridge", "portal_message_buffer")
|
helper.Copy(up.Int, "bridge", "portal_message_buffer")
|
||||||
helper.Copy(up.Bool, "bridge", "delivery_receipts")
|
helper.Copy(up.Bool, "bridge", "delivery_receipts")
|
||||||
helper.Copy(up.Bool, "bridge", "message_status_events")
|
helper.Copy(up.Bool, "bridge", "message_status_events")
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ bridge:
|
|||||||
|
|
||||||
portal_message_buffer: 128
|
portal_message_buffer: 128
|
||||||
|
|
||||||
|
# Number of private channel portals to create on bridge startup.
|
||||||
|
# Other portals will be created when receiving messages.
|
||||||
|
startup_private_channel_create_limit: 5
|
||||||
# Should the bridge send a read receipt from the bridge bot when a message has been sent to Discord?
|
# Should the bridge send a read receipt from the bridge bot when a message has been sent to Discord?
|
||||||
delivery_receipts: false
|
delivery_receipts: false
|
||||||
# Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
|
# Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
|
||||||
|
|||||||
3
user.go
3
user.go
@@ -544,10 +544,9 @@ func (user *User) readyHandler(_ *discordgo.Session, r *discordgo.Ready) {
|
|||||||
user.handleGuild(guild, updateTS, portalsInSpace[guild.ID])
|
user.handleGuild(guild, updateTS, portalsInSpace[guild.ID])
|
||||||
}
|
}
|
||||||
user.PrunePortalList(updateTS)
|
user.PrunePortalList(updateTS)
|
||||||
const maxCreate = 5
|
|
||||||
for i, ch := range r.PrivateChannels {
|
for i, ch := range r.PrivateChannels {
|
||||||
portal := user.GetPortalByMeta(ch)
|
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 {
|
if r.ReadState.Version > user.ReadStateVersion {
|
||||||
|
|||||||
Reference in New Issue
Block a user