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
1
vote
1 answer

How to track the event of adding and removing a bot to the channel?

I have a Telegram Bot on aiogram, and I want to be notified when my bot is added or removed from channels. But my code only works on groups. What needs to be done to work on channels as well? And here is the code: import logging from aiogram import…
Phoenix
  • 11
  • 1
1
vote
1 answer

handle replied message aiogram

How can I do this: I got my tgbot using aiogram and I need this bot to handle replied messages. For example: A user in chat replied some message and the bot should handle the users message and also the message that user replied. I've…
Artem
  • 13
  • 1
  • 4
1
vote
1 answer

Telegram-bot replies to messages from specific user in group chat (aiogram)

I want my bot to reply to a certain person in chat every time he writes (in fact every 2 hrs, like regular cuddling) e.g. User1: Good morning everyone User2: Good morning Bot: (reply to User2): Have a nice day! Now i can send messages to group…
Jenny
  • 11
  • 4
1
vote
1 answer

Python aiogram: state switch

I am learning aiogram, and trying to get some messages as args for funtion call. As I learned from internet I should use State Machine First I ask for some args and change state, to catch next message @dp.message_handler(text='Parse',…
ThePigeonKing
  • 54
  • 1
  • 8
1
vote
1 answer

Problems in telegram bot commands

I'm creating a bot that sends math problems in image format. I wanted to create two two functions for different commands, so that one command only sends one genre of question, while the other sends another genre. Example: /random sends general…
Jhon Oliver
  • 149
  • 6
1
vote
1 answer

aiogram Why code has expired for different users with the same api_i and api_hash?

I working on python telegram bot that allow login telegram client using registered user and then do some actions using user credentials ... ... But I got the following error: ERROR: The confirmation code has expired (caused by SignInRequest) I use…
Denis Kotov
  • 857
  • 2
  • 10
  • 29
1
vote
1 answer

aiogram: How to group, format and send multiple dictionaries

You need to send separate messages schedule for different days. Here is an example input: raspisanie = [{'week_day': 'Monday, 'name': 'Lesson 1', 'time': '8:30'}, {'week_day': 'Tuesday', name: 'Lesson 1', 'time': '8:30'}, {'week_day': 'Tuesday',…
1
vote
1 answer

asyncpg + aiogram. cannot perform operation: another operation is in progress

How I can fix it? I played with it a lot and for a long time, but nothing came of it. sql_db.py: import asyncio import asyncpg LOG_PG = {"database": 'test_bot', "user": 'misha', "password": '1234', "host":…
Misha
  • 11
  • 4
1
vote
2 answers

Accept a request to subscribe to a private telegram channel via aiogram

There is a task to confirm subscription requests in the telegram channel using a bot. If anyone knows how to do this through aiogram or telethon
kirill833
  • 23
  • 1
  • 5
1
vote
1 answer

How to reset state in aiogram FSM without resetting data

I am developing a telegram bot using Python 3.9.7 and aiogram 2.16, at the end of my function I want to reset the user's state without deleting the stored data. I tried using state.finish() but this method removes all saved data from storage Here's…
Ccorrilab
  • 13
  • 4
1
vote
1 answer

How to execute definite handler-function in aiogram (Telegram API)?

I have got a Telegram-bot in AIOgram. My aim in this bot is to run it and if user writes secret phrase - bot must send secret message. My code in main.py file: from aiogram.dispatcher.filters import Text from aiogram.dispatcher import…
1
vote
1 answer

How to implement automatic reloading of the python aiogram bot?

I am creating a telegram bot in python using aiogram. I want to prescribe a condition under which the bot will reboot. Tell me how to implement using the code to restart the bot on aiogram? Thank you in advance for your help! The bot works on a VPS…
1
vote
1 answer

Set chat permissions via telegram bot

I want to add a function to the bot "change chat permissions" and I can't figure out how to do it. Using an aiogram lib with postgresql database (psycopg2) Python 3.9.5 aiogram==2.14.3 Callback handler (for example: call.data =…
rvbsm
  • 13
  • 6
1
vote
2 answers

How can aiogram bot request user's location?

Are there ways for an aiogram bot to request a user action which would send user's location to the bot? User action could be for instance: InlineKeyboardButton, or ReplyKeyboardButton. Thanks!
Roger Hache
  • 405
  • 1
  • 5
  • 17
0
votes
2 answers

Data is not entered into the table using psycopg2

I tried to do a shopping cart in the telegram bot using psycopg2 and aiogram, but the data does not appear in the "korzina" column code: connection.cursor(f'INSERT INTO bot_users(korzina) VALUES({id_tovara}) FROM bot_user WHERE user_id= …