edit_bot_access_settings()

Client.edit_bot_access_settings()

Edit the access settings of a bot.

Usable by Users Bots
Parameters:
  • bot (int | str) – Unique identifier (int) or username (str) of the bot.

  • restricted (bool, optional) – Pass True to restrict the bot’s access.

  • add_users (List of int | str, optional) – List of users to grant access to the bot.

Returns:

bool – True on success.

Example

# Restrict bot
await app.edit_bot_access_settings("@mybot", restricted=True)

# Allow specific users
await app.edit_bot_access_settings("@mybot", add_users=["@user1", "@user2"])