raito.core.raito module¶
- class raito.core.raito.Raito(dispatcher, routers_dir, *, developers=None, locales=None, production=True, enable_dangerous_commands=False, configuration=None, storage=None)[исходный код]¶
Базовые классы:
objectMain class for managing the Raito utilities.
Provides router management, middleware setup, etc.
- Параметры:
- property command_parameters_error: EventObserver¶
Observer for command signature errors.
Устарело, начиная с версии 1.3.7: Use
@raito.Router.on_command_signature_errorinstead.
- async setup()[исходный код]¶
Set up the Raito by loading routers and starting watchdog.
Loads all routers from the specified directory and starts file watching in development mode for automatic reloading.
- Тип результата:
None
- add_throttling(rate_limit, mode='chat', max_size=10000)[исходный код]¶
Add global throttling middleware to prevent spam.
Applies rate limiting to both messages and callback queries.
- async paginate(name, chat_id, bot, from_user, *, existing_message=None, mode=PaginationMode.INLINE, current_page=1, total_pages=None, limit=20)[исходный код]¶
- async register_commands(bot)[исходный код]¶
- Параметры:
bot (Bot)
- Тип результата:
None
- init_logging(*mute_loggers)[исходный код]¶
Configure global logging with a colored formatter.
- Параметры:
mute_loggers (str) – List of logger names to suppress from output
- Тип результата:
None
- async wait_for(context, *filters)[исходный код]¶
Wait for the next message from user that matches given filters.
This function sets special state
raito__conversationin FSM and suspends coroutine execution until user sends a message that passes all provided filters. Result is wrapped intoWaiter.- Параметры:
- Результат:
Conversation result with text, parsed number and original message
- Исключение:
RuntimeError – If handler object not found during filter execution
asyncio.CancelledError – If conversation was cancelled
- Тип результата: