config: add member list and max member count options

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
Sumner Evans
2024-07-17 12:03:58 -06:00
parent 0e6ea310d1
commit 48858ac28f
2 changed files with 38 additions and 0 deletions
+12
View File
@@ -21,6 +21,14 @@ type TelegramConfig struct {
SetPrivateChatPortalMeta bool `yaml:"set_private_chat_portal_meta"`
AnimatedSticker media.AnimatedStickerConfig `yaml:"animated_sticker"`
MemberList struct {
MaxInitialSync int `yaml:"max_initial_sync"`
SyncChannels bool `yaml:"sync_channels"`
SkipDeleted bool `yaml:"skip_deleted"`
} `yaml:"member_list"`
MaxMemberCount int `yaml:"max_member_count"`
}
//go:embed example-config.yaml
@@ -35,6 +43,10 @@ func upgradeConfig(helper up.Helper) {
helper.Copy(up.Int, "animated_sticker", "args", "width")
helper.Copy(up.Int, "animated_sticker", "args", "height")
helper.Copy(up.Int, "animated_sticker", "args", "fps")
helper.Copy(up.Int, "member_list", "max_initial_sync")
helper.Copy(up.Bool, "member_list", "sync_channels")
helper.Copy(up.Bool, "member_list", "skip_deleted")
helper.Copy(up.Int, "max_member_count")
}
func (tg *TelegramConnector) GetConfig() (example string, data any, upgrader up.Upgrader) {
+26
View File
@@ -25,3 +25,29 @@ animated_sticker:
width: 256
height: 256
fps: 25 # only for webm, webp and gif (2, 5, 10, 20 or 25 recommended)
# Settings for syncing the member list for portals.
member_list:
# Maximum number of members to sync per portal when starting up. Other
# members will be synced when they send messages. The maximum is 10000,
# after which the Telegram server will not send any more members.
#
# -1 means no limit (which means it's limited to 10000 by the server)
max_initial_sync: 100
# Whether or not to sync the member list in channels. If disabled, members
# will still be synced when they send messages.
#
# If no channel admins have logged into the bridge, the bridge won't be
# able to sync the member list regardless of this setting.
sync_channels: false
# Whether or not to skip deleted members when syncing members.
skip_deleted: true
# Maximum number of participants in chats to bridge. Only applies when the
# portal is being created. If there are more members when trying to create a
# room, the room creation will be cancelled.
#
# -1 means no limit (which means all chats can be bridged)
max_member_count: -1