A
A
Andrey Prenrek2021-02-12 17:28:17
Python
Andrey Prenrek, 2021-02-12 17:28:17

How to play audio stored in Google Drive?

def muxik(message):
  user=message.text
  if user=='2':
    bot.send_message(message.chat.id, 'Загружаю...')
    url =open('arabska_muxik.mp3', 'rb')
    bot.send_audio(message.chat.id, url)
  elif user=='53':
    bot.send_message(message.chat.id, 'Загружаю...')
    url = open('53.mp3', 'rb')
    bot.send_audio(message.chat.id, url)
  
  else:
    marku=types.ReplyKeyboardMarkup(resize_keyboard=True)
    bn1=types.KeyboardButton('/muxiks')
    marku.add(bn1)
    bot.send_message(message.chat.id, 'Какой песни нет в базе данных!', reply_markup=marku)

The whole code...

I need a code that gets the audio from the google drive by url and passes it to the bot, and the bot already sends it to the user.

Without saving audio in the folder with the code.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2021-02-12
@hottabxp

Without saving audio in the code folder

1) Or save the audio not in the folder with the code, but in another folder.
2) Or send the user a link.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question