π Access Policy
Access Policy is a feature that allows you to control how the bot interacts with new users. This is especially useful if you want to restrict access to the bot and keep it only for your acquaintances.
π Configuring Access Policyβ
To configure the access policy, open the appsettings.json
file and find the AccessPolicy
section. Here is an example configuration:
"AccessPolicy": {
"Enabled": true,
"NewUsersPolicy": {
"Enabled": true,
"ShowAccessDeniedMessage": false,
"AllowNewUsers": true,
"AllowRules": {
"AllowAll": false,
"WhitelistedReferrerIds": [],
"BlacklistedReferrerIds": []
}
}
}
π― Key Parametersβ
1. Enabling/Disabling Access Policyβ
- Enabled: Enables or disables the access policy.
2. Policy for New Usersβ
- NewUsersPolicy.Enabled: Enables or disables the policy specifically for new users.
- AllowNewUsers: Allows or denies access to new users.
- If
true
, new users can use the bot. - If
false
, access will be restricted to existing users only.
- If
3. Access Rulesβ
- AllowAll: If
true
, all bot users can invite new people to the bot. Iffalse
- only those who are in theWhitelistedReferrerIds
list. - WhitelistedReferrerIds: A list of Telegram IDs of users who can always add new users.
- For example:
"WhitelistedReferrerIds": [123456789, 987654321]
- For example:
- BlacklistedReferrerIds: A list of Telegram IDs of users who will never be able to add new users.
- For example:
"BlacklistedReferrerIds": [111111111, 222222222]
- For example:
β οΈ Important Notesβ
- User IDs: Make sure you are using the correct Telegram user IDs.
- Testing: After changing the settings, test the bot to ensure the access policy works as expected.
tip
Restart the bot for the settings changes to take effect.
π‘ Tipsβ
- If you want full access to the bot, set
"AllowAll" and "AllowNewUsers": true
. Or just set"NewUsersPolicy.Enabled: false"
- For tighter control, use Whitelist so that only trusted users can add new members.