Answer the question
In order to leave comments, you need to log in
How to implement sending music in Telegramm bot?
def Music(message):
for filename in os.listdir("GeometryDash"):
audio = open(f"GeometryDash\{filename}", "rb")
bot.send_audio(message.chat.id, audio,timeout=60)
Answer the question
In order to leave comments, you need to log in
Check filename and only submit if filename has the correct extension.
Something like this:
def Music(message):
for filename in os.listdir("GeometryDash"):
if filename.endswith('.mp3') or filename.endswith('m4a'):
audio = open(f"GeometryDash\{filename}", "rb")
bot.send_audio(message.chat.id, audio,timeout=60)
def Music
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question