REPL, hot-reload, keyboards, pagination, and internal dev tools β all in one. That's Raito.
- π₯ Hot Reload β automatic router loading and file watching for instant development cycles
- π Role System β pre-configured roles (owner, support, tester, etc) and selector UI
- π Pagination β easy pagination over text and media using inline buttons
- π¬ FSM Toolkit β interactive confirmations, questionnaires, and mockable message flow
- π CLI Generator β
$ raito initcreates a ready-to-use bot template in seconds - β¨οΈ Keyboard Factory β static and dynamic generation
- π οΈ Command Registration β automatic setup of bot commands with descriptions for each
- πΌοΈ Album Support β groups media albums and passes them to handlers
- π‘οΈ Rate Limiting β apply global or per-command throttling via decorators or middleware
- πΎ Database Storages β optional JSON & SQL support
- π§ͺ REPL β execute async Python in context (
_msg,_user,_raito) - π Params Parser β extracts and validates command arguments
- βοΈ Logging Formatter β beautiful, readable logs out of the box
- π Metrics β inspect memory usage, uptime, and caching stats
pip install -U raitoimport asyncio
from aiogram import Bot, Dispatcher
from raito import Raito
async def main() -> None:
bot = Bot(token="TOKEN")
dispatcher = Dispatcher()
raito = Raito(dispatcher, "src/handlers")
await raito.setup()
await dispatcher.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())Raito speeds up your bot development by removing the boring parts β no more boilerplate, no more manual restarts, no more duplicated code across projects.
Everything that used to slow you down is already solved.
You can control access to commands using @rt.roles
The @rt.description decorator adds a description to each command β they will show up in the slash menu automatically.
For commands like /ban 1234, use @rt.params to extract and validate the arguments.
Limit command usage with @rt.limiter and control the rate by mode.
@router.message(filters.Command("ban"), OWNER | ADMINISTRATOR | MODERATOR)
@rt.description("Ban a user")
@rt.limiter(300, mode="chat")
@rt.params(user_id=int)
async def ban(message: types.Message, user_id: int, bot: Bot):
await bot.ban_chat_member(chat_id=message.chat.id, user_id=user_id)
await message.answer(text="β
User banned successfully!")Whenever you change a file with handlers, Raito automatically reloads it without restarting the bot.
You can also manage your routers manually using the .rt load, .rt unload, .rt reload, or .rt routers commands in the bot.
hot-reload-raito-showcase.mp4
Use built-in roles to set different access levels for team members.
The simplest, most native and most effective pagination. Unlike many other libraries, it does not use internal storage.
It is very user-friendly and fully customizable.
@router.message(filters.Command("pagination"))
async def pagination(message: Message, raito: Raito, bot: Bot):
if not message.from_user:
return
await raito.paginate(
"button_list",
chat_id=message.chat.id,
bot=bot,
from_user=message.from_user,
limit=5,
)
# mock data
BUTTONS = [
InlineKeyboardButton(text=f"Button #{i}", callback_data=f"button:{i}")
for i in range(10000)
]
@rt.on_pagination(router, "button_list")
async def on_pagination(query: CallbackQuery, paginator: InlinePaginator, offset: int, limit: int):
content = BUTTONS[offset : offset + limit]
await paginator.answer(text="Here is your buttons:", buttons=content)Sometimes you want quick layouts. Sometimes β full control. You get both.
@rt.keyboard.static(inline=True)
def information():
return [
("π Terms of Service", "tos"),
[("βΉοΈ About", "about"), ("βοΈ Website", "web")],
]@rt.keyboard.dynamic(1, 2, adjust=True, inline=False)
def start_menu(builder: ReplyKeyboardBuilder, app_url: str):
builder.button(text="π± Open App", web_app=WebAppInfo(url=app_url))
builder.button(text="π¬ Support")
builder.button(text="π’ Channel")Define startup and shutdown logic in one place.
@rt.lifespan(router)
async def lifespan(bot: Bot):
user = await bot.get_me()
rt.debug("π Bot [%s] is starting...", user.full_name)
yield
rt.debug("ππ» Bye!")Have an idea, found a bug, or want to improve something?
Contributions are welcome! Feel free to open an issue or submit a pull request.
If you discover a security vulnerability, please report it responsibly.
You can open a private GitHub issue or contact the maintainer directly.
Thereβs no bounty program β this is a solo open source project.
Use in production at your own risk.
For full details, check out the Security Policy.
Open an issue or start a discussion in the GitHub Discussions tab.
You can also ping @Aidenable for feedback or ideas.
