Arguments Stupendous Searcher (ASS)
Project description
Arguments Stupendous Searcher (ASS)
The library used to parse arguments from the message.
Currently, works only with Aiogram 3.x!
See also:
Quick example:
Let's create a handler for a tban (temporary ban) command using ASS arguments.
from ass_tg.types import UserArg, ActionTimeArg, TextArg, OptionalArg
from ass_tg.types.base_abc import ParsedArg
from stfu_tg import Section, KeyValue
@dp.message(Command('tban')) # Set a command filter
@flags.args(
user=UserArg("User"),
time=ActionTimeArg("Time to ban"),
description=OptionalArg(TextArg("Reason text"))
)
async def tban_user_handler(
msg: Message,
user: str,
time: timedelta,
description: str | None
):
# Here we used STFU's formatting, but you can use variables as you wish!
await msg.reply(str(Section(
KeyValue("User", user),
KeyValue("On", time),
KeyValue("Description", description or "No description"),
title="Ban"
)))
The argument parser contains inbuilt type and argument checker:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
ass_tg-2.0.4-py3-none-any.whl
(22.4 kB
view hashes)