raito.plugins.roles.providers.protocol moduleΒΆ

class raito.plugins.roles.providers.protocol.IRoleProvider(*args, **kwargs)[source]ΒΆ

Bases: Protocol

Protocol for providers that manage user roles.

async get_role(bot_id, user_id)[source]ΒΆ

Get the role for a specific user.

Parameters:
  • bot_id (int) – The Telegram bot ID

  • user_id (int) – The Telegram user ID

Returns:

The role slug or None if not found

Return type:

str | None

async set_role(bot_id, user_id, role_slug)[source]ΒΆ

Set the role for a specific user.

Parameters:
  • bot_id (int) – The Telegram bot ID

  • user_id (int) – The Telegram user ID

  • role_slug (str) – The role slug to assign

Return type:

None

async remove_role(bot_id, user_id)[source]ΒΆ

Remove the role for a specific user.

Parameters:
  • bot_id (int) – The Telegram bot ID

  • user_id (int) – The Telegram user ID

Return type:

None

async migrate()[source]ΒΆ

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

Return type:

None

async get_users(bot_id, role_slug)[source]ΒΆ

Get all users with a specific role.

Parameters:
  • bot_id (int) – The Telegram bot ID

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

Returns:

A list of Telegram user IDs

Return type:

list[int]