Hi, I installed the telegram local bot server, logged

out my telegram bot from here and set base_url to http://localhost/bot in my bot Python code. When I start the local server in local mode and run the bot code I can upload files up to 50 mb through my local server. When the file is 60MB, I get a “file is too big” error. I’m sure I’m connected to the local server because when I shut it down the bot goes dead. Local servers are supposed to be able to upload up to 2 gig. I’m using send video to upload the file. I can’t find any similar problem on Google. Anyone have an idea what I’m missing?

# Create the Application and pass it your bot's token.

BASE_URL = "http://localhost:8081/bot"
BASE_FILE_URL = "http://localhost:8081/file/bot"

builder = Application.builder()
builder.token("6163585000:AAG48a4GragJzv1zLRWba_xxxxxxxx")
builder.local_mode(local_mode=True)
builder.base_url(BASE_URL)
builder.base_file_url(BASE_FILE_URL)
builder.read_timeout(30)
builder.write_timeout(60)
application = builder.build()


Code to upload file is:

# Send the file to the chat
with open(mp4_file, 'rb') as file:
await bot.send_video(chat_id=chat_id, video=file, read_timeout=60, write_timeout=60, connect_timeout=None)

I can’t see why it’s rejecting the 60MB file

13 ответов

22 просмотра

so I didn't quite understand, but telegram has a limit on sending files up to 50mb

akmalovichdev
how's that?

https://core.telegram.org/bots/api#using-a-local-bot-api-server

Hi, Could you share with us how has you logout your bot? I have been trying to do It without sucess.

Diego
Hi, Could you share with us how has you logout you...

https://docs.python-telegram-bot.org/en/stable/telegram.bot.html#telegram.Bot.logOut

Ducky-4Groups2 Автор вопроса
Яico X
https://docs.python-telegram-bot.org/en/stable/tel...

Thank you. Yes, that is how I detached my bot from telegram.org. I know I am running on a local server which has a file size limit of 2 gig so why am I getting an error with a 60 Mb file?

Ducky 4Groups2
Thank you. Yes, that is how I detached my bot fro...

You are connecting directly to the local bot api server? Or is there any reverse proxy/whatever in between? Also yu say "which has a file size limit of 2 gig". The local bot api server has an upload limit of 2GB, there is no limitation for the download size.

Important question: Does your bot work in general. From the few lines of code you posted, it seems like you never start the bot. This might have been intentional because you only wanted to post the most important code, but it could also been a mistake. Maybe upload a more complete code snippet to nekobin or pastebin.

Ducky-4Groups2 Автор вопроса
Яico X
Important question: Does your bot work in general....

Yes, I said that it works for files under 50 mb. It opens the file and uploads it to my channel. This is how I start the server. telegram-bot-api --api-id=0000000 --api-hash=xxxxxxxxxx --local --dir=d:\dtemp\botserver --temp-dir=d:\dtemp\botserver --log=d:\dtemp\botserver\apilog.log

Bot token posted partially

Похожие вопросы

Карта сайта