aiogram

What am i doing wrong in python bot?

What am i doing wrong in python bot? Question: I don’t understand what is my mistake. Can someone show me the correct code My code: @dp.message_handler(content_types=[‘text’]) async def Text(update): dl = downloader.tiktok_downloader() global last_use meseg = update.message.text getvid = dl.musicaldown(url=meseg,output_name=’video.mp4′) if getvid: bot.send_video() return if getvid == False: getvid = dl.ttscraper(url=meseg, output_name="video.mp4") if getvid: bot.send_videoo() …

Total answers: 1

FSM – aiogram | How to get file?

FSM – aiogram | How to get file? Question: @dp.message_handler(text_contains=’Send file’) async def start_bots(msg): await bot.send_message(msg.from_user.id, ‘Ok, send me a file’) await HZ.getFile.set() @dp.message_handler(state=HZ.getFile) async def getID(msg: types.Message, state: FSMContext): file_id = msg.document.file_id file = await bot.get_file(file_id) file_path = file.file_path print(file_path) await state.finish() It doesn’t cares my file, how to download file when user sent …

Total answers: 1

convert PIL.Image to IOBase class

convert PIL.Image to IOBase class Question: 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’) # in handler used # qrcode.make(message.text’) print(type(qr_code_img)) # <class ‘qrcode.image.pil.PilImage’> …

Total answers: 1

How to get a telegram bot work in a channel?

How to get a telegram bot work in a channel? Question: I can’t get it to work through properties like command or just content_types. No errors show up. @dp.message_handler(commands=["start"]) async def start(msg:Message): if msg.chat.type == ChatType.CHANNEL: await msg.answer(msg) I made so bot sent a message to the channel. Still nothing. P.S It works with getUpdates …

Total answers: 1

Message handlers aren't invoked in aiogram bot on webhooks

Message handlers aren't invoked in aiogram bot on webhooks Question: I’m launching an aiogram bot on webhooks locally using ngrok tunnel, but instead of proper responses, the bot returns 200 OK with almost nothing in response body, thus a user doesn’t see anything in a chat. Bot’s main.py driver looks like this: from aiogram import …

Total answers: 1

How to make an asynchronous time counter/trigger?

How to make an asynchronous time counter/trigger? Question: I am writing a telegram bot using aiogram. The bot will be used by a lot of people and the bot has an order module. The task of this module is to create orders that must be closed on time. For example, the bot requests the date …

Total answers: 1

Set chat permissions via telegram bot

Set chat permissions via telegram bot Question: 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 = "defaultchat-can_send_media_messages") @dp.callback_query_handler(lambda call: "defaultchat" == call.data.split(‘-‘)[0]) async def deafultChatCallbacks(call: types.callback_query): …

Total answers: 1