Telegram – convert PIL.Image to IOBase class
I have a bot that creates a qr code and I want it to send qr code to the user without saving it to the hard drive I create qr code like this: import qrcode qr_code_img = qrcode.make('some data') #…
I have a bot that creates a qr code and I want it to send qr code to the user without saving it to the hard drive I create qr code like this: import qrcode qr_code_img = qrcode.make('some data') #…
Trying to do a shopping cart in 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= {us_id}') connection.commit() types of column's: user_id | bigint…
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…
import logging from aiogram import Bot, Dispatcher, executor, types API_TOKEN = '...' # Configure logging logging.basicConfig(level=logging.INFO) # Initialize bot and dispatcher bot = Bot(token=API_TOKEN) dp = Dispatcher(bot) @dp.message_handler(commands=['start', 'help']) async def send_welcome(message: types.Message): """ This handler will be called when…
I need to check if a message sender is in a "special" list, to allow only special users to use some commands. I used IDFilter for it. But this "special" list may be changed, and I need these changes to…
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' object…
I'm trying to make multiple different message handlers, is this an acceptable way to register multiple ones?: import asyncio from aiogram import Bot, Dispatcher, types from settings import BOT_TOKEN async def start_handler(event: types.Message): await event.answer( f"Hello, {event.from_user.get_mention(as_html=True)} 👋!", parse_mode=types.ParseMode.HTML, )…
I'm developing telegram bot. My bot helps users to remember their things to do. So the thing is there are many types of such things to do which user can create: everyday, every week, few times a day, once a…
I have a chat id and a message id. I want to find out whether this message exists or not. So far the only way I can figure out to do it is a nasty hack (try to delete or…
When the GPS on the phone is disabled, the user can manually select any point on the map. How can I remove this option to send location? The variable res handles the distance between two points. I will be very…