Skip to content

bot

Proxy seller bot.

The bot allows users to purchase proxy services through Telegram.

Modules:

cache

Bot Redis cache module.

This module provides a simple interface to interact with a Redis cache server.

Modules:

  • redis

    Redis cache for bot

redis

Redis cache for bot

core

Bot core.

This package contains the core functionalities and components of the bot.

Modules:

  • config

    This module loads a settings from .env_file.

  • main

    This module contains the main entry point for the proxy seller bot.

config

This module loads a settings from .env_file.

Classes:

  • BotSettings

    Bot settings class to load bot-specific environment variables.

  • CacheSettings

    Cache settings class to load cache-specific environment variables.

  • DBSettings

    Database settings class to load database-specific environment variables.

  • EnvBaseSettings

    Base settings class to load environment variables from a .env file.

  • Settings

    Settings class to load all environment variables.

BotSettings

Bot settings class to load bot-specific environment variables.

CacheSettings

Cache settings class to load cache-specific environment variables.

DBSettings

Database settings class to load database-specific environment variables.

Attributes:

database_url property
database_url: URL | str

Construct the database URL for SQLModel.

Returns:

  • URL | str

    URL | str: The constructed database URL.

Example

postgresql+asyncpg://user:password@host:port/dbname

EnvBaseSettings

Base settings class to load environment variables from a .env file.

Settings

Settings class to load all environment variables.

Attributes:

database_url property
database_url: URL | str

Construct the database URL for SQLModel.

Returns:

  • URL | str

    URL | str: The constructed database URL.

Example

postgresql+asyncpg://user:password@host:port/dbname

main

This module contains the main entry point for the proxy seller bot.

Functions:

  • main

    Create the entry instances and start the bot.

main async

main() -> None

Create the entry instances and start the bot.

Args: None

Returns: None

Raises: None

Source code in bot/core/main.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
async def main() -> None:
    """Create the entry instances and start the bot.

    Args: None

    Returns: None

    Raises: None
    """
    bot = Bot(
        token=settings.BOT_TOKEN,
        default=DefaultBotProperties(parse_mode=ParseMode.HTML),
    )

    dp = Dispatcher(storage=storage)

    dp.update.middleware.register(i18n_middleware)

    dp.include_router(main_router)

    await dp.start_polling(bot)

handlers

Bot handlers.

This package contains various handlers for the bot.

Modules:

  • start

    Start handler module.

start

Start handler module.

This module contains the start handler for the bot.

Functions:

cmd_start async

cmd_start(message: Message)

Start handler for the bot.

Parameters:

  • message
    (Message) –

    The message object.

Returns:

  • None

Source code in bot/handlers/start.py
14
15
16
17
18
19
20
21
22
23
24
25
26
@start_router.message(CommandStart())
async def cmd_start(message: Message):
    """Start handler for the bot.

    Parameters:
        message (Message): The message object.

    Returns:
        None
    """
    start_text = _("start text")

    await message.answer(start_text)

middlewares

Bot middlewares.

This package contains middleware components for the bot.

Modules:

  • i18n

    i18n middleware.

i18n

i18n middleware.

Bot middleware for handling internationalization in the bot.