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

How to pass Python object to a class before it's initialization

I'm researching aiogram module for Telegram bots. Handlers for messages from Telegram are decorated with @dp..... wrappers where dp = Dispatcher(). All examples in docs are about one file code. So, it works as follows: ... dp =…
Igor
  • 43
  • 5
0
votes
0 answers

aiogram handlers stop working after subprocess logging

i don't understand but if i run the jar file and it prints the initial logs, all the handlers stop working handlers are still working until all the initial logs come to me in tg async def main(): server_path = '../servers_community/cree' …
0
votes
0 answers

The bot responds to its own messages endlessly

Writing a bot for tech support.When I send a question, the bot forwards it to the channel and starts forwarding it too. And so it goes on endlessly. Example(User-user who sent the bot a question, Bot1-bot who answers the user, Bot2-bot who writes in…
agfn
  • 29
  • 2
0
votes
0 answers

problem: Unresolved attribute reference 'register_next_step_handler' for class 'Dispatcher'

elif message.text == "awf": message = await bot.send_message(message.chat.id, "wegw4") await dp.register_next_step_handler(message, start_2) I just started studying aiogram today, so I can't even suggest how to solve this problem
0
votes
2 answers

How to get bot's username in aiogram?

For the sake of studying the capabilities of the Telegram API, the question arose, how to get the @username of a bot in a telegram using aiogram? I tried username = bot.get_me().username but gives the following error: AttributeError: 'coroutine'…
0
votes
0 answers

Telegram bot on mac

We wrote a bot on Windows, everything works fine, put it on the mac, gives an error connecting to the host, we do not understand what is the matter. I attach the text of the program below. Screenshots with errors too. import re import os import…
0
votes
1 answer

Imports error during Docker container startup

When I run docker-compose.yml on windows, an error comes up, even though everything in the code is correct. With packages exactly no errors, all checked 2 times, perhaps the problem with the imports, which begin with a dot, but then how to replace…
auem
  • 45
  • 7
0
votes
0 answers

I can't check if the user has subscribed to the channel, python aiogram

@dp.callback_query_handler(text='look_sub') async def look(call: tp.CallbackQuery): user_channel_status = await bot.get_chat_member(chat_id='-100118155xxxx', user_id=call.from_user.id) if user_channel_status["status"] != 'left': …
Horizon
  • 1
  • 1
0
votes
1 answer

Localization of tg bot i18n aiogram 2.25 does not work

Can't implement translation of messages to other languages with i18n on aiogram 2.25 The whole bot works, only without translation, but in the usual language. Here is a link to the repository, maybe someone can help, I've been sitting on this for a…
0
votes
1 answer

For some reason, my bot replies to all messages in the group, although it should only respond to messages mentioning it

He must reply to all messages in private, but in the group he must reply to messages in which he is mentioned and ignore all others. But for some reason it doesn't work and he still replies to all messages. Here is my code: import openai import…
FoorA
  • 3
  • 2
0
votes
1 answer

How to make telegram bot multiuserable? Meaning that multiple users could use the bot simultaneously. #python #aiogram

I have developed a telegram bot on Python using Aiogram 2.3 that offers user to play "Truth or Dare" game. Bot works pretty good with one user, but when 2+ users start using bot in the same time, global variables, states, localisation becomes a…
0
votes
0 answers

How get in aiogram 2 message from user with in text links and bolds with use fsm

My code worked and send messages to all users, but when i send message with font or in text links, aiogram fsm machine don't seen that. What i need to do? import logging from aiogram import Bot, Dispatcher, executor, types from…
RaY
  • 1
  • 1
0
votes
1 answer

Aiogram. Im getting a "message" is not defined error, and i understand why, but when i add message: types.Message to my func args it needs 2 arguments

Aiogram. Im getting a "message" is not defined error, and I understand why, but when I add message: types.Message to my func args it now needs 2 arguments but my func inly gets one, so what do i do? @dp.callback_query_handler() async def…
0
votes
0 answers

Error in telegram bot using Openai. (AttributeError: 'NoneType' object has no attribute 'text')

I want the bot to play the role of someone. every time the user sends messages, they will be saved and the bot will know the context. But an error occurs: prompt = reply_to_message.text ^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no…
FoorA
  • 3
  • 2
0
votes
0 answers

cannot save a file to the postgres using psycopg2.Binary()

I'm writing a tg bot. I need to save user's photo to the database. I use this code: def parse_photo(file_path: str): with urllib.request.urlopen(f"https://api.telegram.org/file/bot{os.getenv('TOKEN')}/{file_path}") as f: html = f.read() …
pizhlo
  • 107
  • 6