raito.plugins.roles.providers.base module

class raito.plugins.roles.providers.base.BaseRoleProvider(storage)[исходный код]

Базовые классы: IRoleProvider

Base role provider class.

Параметры:

storage (BaseStorage)

async get_role(bot_id, user_id)[исходный код]

Get the role for a specific user.

Параметры:
  • bot_id (int) – The Telegram bot ID

  • user_id (int) – The Telegram user ID

Результат:

The role slug or None if not found

Тип результата:

str | None

async set_role(bot_id, user_id, role_slug)[исходный код]

Set the role for a specific user.

Параметры:
  • bot_id (int) – The Telegram bot ID

  • user_id (int) – The Telegram user ID

  • role_slug (str) – The role slug to assign

Тип результата:

None

async remove_role(bot_id, user_id)[исходный код]

Remove the role for a specific user.

Параметры:
  • bot_id (int) – The Telegram bot ID

  • user_id (int) – The Telegram user ID

Тип результата:

None

async migrate()[исходный код]

Initialize the storage backend (create tables, etc.).

Тип результата:

None

async get_users(bot_id, role_slug)[исходный код]

Get all users with a specific role.

Параметры:
  • bot_id (int) – The Telegram bot ID

  • role_slug (str) – The role slug to check for

Результат:

A list of Telegram user IDs

Тип результата:

list[int]