π 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,
"AllowNewUsers": true,
"AllowRules": {
"AllowAll": false,
"WhitelistedReferrerIds": [],
"BlacklistedReferrerIds": []
}
}
}
π― Key Parametersβ
1. Enabling/Disabling Access Policyβ
- Enabled: Enables or disables the access policy. If
false
, all users will have access to the bot.
2. Policy for New Usersβ
- NewUsersPolicy.Enabled: Enables or disables the policy 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 users gain access to the bot. - 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.
π‘ Tipsβ
- If you want to fully open access to the bot, set
"AllowAll": true
. Or simply set"NewUsersPolicy.Enabled": false"
. - For stricter control, use a Whitelist to ensure only trusted users can add new members.