[Python] In aiogram 2.9, how can I get the command arguments?

Discussão em 'Python' iniciado por Stack, Março 8, 2025.

  1. Stack

    Stack Membro Participativo

    If I remember correctly, previously, you could extract them using get_args() if the link was of the form: t.me/XXXXX?start=XXXXX. Now, it seems that this doesn't work anymore. With the following code, an error occurs:

    try:
    args = message.get_args()
    print(f"аргументы: {args}")
    await message.reply(f"Привет, {args[0]}!")
    except Exception as e:
    print(e)

    Continue reading...

Compartilhe esta Página