Questions tagged [aiogram]

aiogram is an asynchronous Python framework for Telegram Bot API. Use this tag when your question is related specifically to aiogram.

aiogram asynchronous framework for Telegram Bot API based on client.

Resources

Related Tags

430 questions
0
votes
0 answers

Aiogram message_handler problems

@dp.message_handler() async def on_right_word(message: types.Message): chat = get_current_chat(message.chat.id) if chat['current_word'] == message.text.lower(): sender = message.from_user return await message.reply(text =…
0
votes
0 answers

How to get chat id by link? aiogram

I need the user to send me the url of a telegram chat, and I will send him back the id of the chat. How can I get the id of the chat?
Printon
  • 31
  • 2
0
votes
1 answer

How to make Aiogram send an image from file?

In my bot, I generate an image with three variables. Then, I want to send the image to user. I tried this code: ... module.full_card(int(userid),tested_word[1],correct_word) await bot.send_photo(callback_query.from_user.id,…
Vlad F
  • 3
  • 1
0
votes
0 answers

psycopg2.errors.UndefinedColumn ERROR: column "korzina" is doesnt exist

`id = '001' us_id = callback.message.from_user.id cursor.execute("SELECT opisanie FROM assortiment WHERE id='001'") cursor.execute(f'SELECT array_append("korzina",{id}) FROM assortiment WHERE user_id={us_id}') await…
0
votes
0 answers

The beginning of the response from api GPT is eaten during an asynchronous request

I am writing a bot through aiogram and attached gpt to it, but with asynchronous requests, the beginning of the text began to eat up. Such a thing is only with an asynchronous request, through the Openai module. I also tried using aiohttp and it…
0
votes
0 answers

I can't figure out `FSMContext`, `State` in `aiogram v3.x`. I'm writing a registration system

As a result of my "misunderstandings", the show_summary function in the code below is not outputting values correctly. This is what is output in (show_summary): The following is a summary of the information you provided: Student Name: (Parent) #…
Colorado
  • 1
  • 1
0
votes
0 answers

How to schedule a function in aiogram

I have Django+aiogram bot and that's how my mailing works: Manager/admin create a instance of the Post/Poll model in the admin panel -> Admin approve/disapprove it in telegram PM with inline keyboard -> if approves ("post" callback data) ->…
0
votes
2 answers

Telegram bot on Aiogram does not respond to the basic start command handler

I specifically commented out all the code leaving only one initial handler for the start command When I start the bot I see in the logs that the bot started correctly and there is no error, but at the same time in the chat the bot does not react to…
0
votes
0 answers

aiogram: state changes only after the second press on the inline-button (FSM)

Something strange is going on in FSM. Everything is fine until the await BotStatesGroup.next() line in callback_category, but then it turns out that the transition to the process_species state occurs only from the second click on the inline button…
Bte Deni
  • 41
  • 5
0
votes
0 answers

Problem with making aiohttp function for DRF-endpoint

I'm making telegram bot on aiogram and DRF and I need aiohttp function for bot. So, I've made endpoint and it works well manually, but function return error 404. There's my code: class BotUser(models.Model): name =…
0
votes
0 answers

Issue with LookupError and when using aiogram

Hello! I'm encountering an issue while using the aiogram library to create a Telegram bot. Currently, I'm using the following code: # Imports and settings async def main(): bot = Bot(token=config.token_bot.get_secret_value(),…
0
votes
1 answer

Why is the bot code ignoring one of the three async functions?

The bot manages tables: users and bans. Users and bans have a single user entry (test). The bot writes the new commenter's id to users and checks the commenter's id in the bans table. If id is in bans, the bot should remove any comment. Otherwise,…
Andrey
  • 1
0
votes
0 answers

Telegram bot Python bottom "back"?

We need such a button so that even if the bot breaks, the button works. Is it possible? We are making a bot in aiogram. Of course, we can make a back button through the list, but if the bot breaks, the back button will not work. The bot literally…
ridaN
  • 1
0
votes
1 answer

Add user to private channel with aiogram

How to add user in private channel using aiogram? I try await bot.send_chat_action, chatgpt send me this command, but it doesn't work. I have private channel in telegram and I need to add user in channel, when he write to bot command /channel
Danya
  • 7
  • 2
0
votes
0 answers

__enter__ was never awaited: asyncpg+sqlalchemy error

I have troubles with aiogram+asyncpg+postgresql. I have already explicitly written a class for __enter__ to be defined as I received an error of it being undefined, though now I have a problem of it being unable to be awaited. When I make it…
Anna
  • 101
  • 8