Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Local server and large file upload#4528

Unanswered
Occisor asked this question inQ&A
Discussion options

I can't figure out how to send large files.
I installed a local server and connected to it. The bot code is attached below.
TBA server startup parameters:
telegram-bot-api --http-port 8081 --dir=/var/lib/telegram-bot-api --temp-dir=/tmp/telegram-bot-api --username=telegram-bot-api --groupname=telegram-bot-api --local

import loggingfrom telegram import Updatefrom telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypesAPI_TOKEN = API_TOKENADMIN_ID = ADMIN_IDSERVER_URL = SERVER_URLasync def start(update: Update, context):    await update.message.reply_text("test")async def handle_file(update: Update, context):    await send_file_srv(context)async def send_file_srv(application: Application) -> None:    await application.bot.send_document(chat_id=ADMIN_ID, document=open('./test.zip', 'rb'))def main():    app = Application.builder().token(API_TOKEN).base_url(SERVER_URL).local_mode(True).build()    app.add_handler(CommandHandler("start", start))    app.add_handler(CommandHandler("send", handle_file))    app.run_polling()if __name__ == '__main__':    main()

I change the ./test.zip file for testing
If it is within (plus or minus) 100 megabytes. Then it loads normally, without errors. If the size is more than 100, then errors of this type begin:
telegram.error.TimedOut: Timed out
But the file still loads.
If the file size is about 300 or more, then the same errors are displayed several times, then they stop and the file does not load.
Please clarify, give an example of a bot that correctly sends large files.

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
1 participant
@Occisor

[8]ページ先頭

©2009-2025 Movatter.jp