Answer the question
In order to leave comments, you need to log in
Why tg bot hangs up after sending audio?
I started getting acquainted with Telegram bots, for a start I decided to learn how to send and receive all types of messages.
I got to sending the audio and ran into this problem:
If you ask the bot to upload a song, then in response, with a rather long delay, it will send an mp3 file that is in the project and will continue to work if you ask it to upload photos, stickers or files (.txt), but as soon as I ask him to upload the song again, he will instantly lie down, and pycharm will write to me:
Below I attach a piece of code for sending an audio file:
audio = open(r'song_name.mp3', 'rb')
@bot.message_handler(content_types=['text'])
def send_text(message):
elif message.text.lower() == 'скинь песню':
bot.send_document(message.chat.id, audio)
audio.close
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question