Che*_*ean 1 python python-requests telegram-bot
如何使用开源 Python 库Requests将 MP3 音频文件发送到 Telegram Bot ?
我写了以下代码:
URL = 'api.telegram.org/bot'+TOKEN+'/sendAudio'
af = open("temp.mp3", 'rb')
params = {'chat_id' : 421087308, 'audio' : af}
req = requests.post(URL, params)
af.close()
Run Code Online (Sandbox Code Playgroud)
使用python 电报机器人包装器,您可以使用以下方法轻松完成:
bot.send_audio(chat_id=chat_id, audio=open('tests/test.mp3', 'rb'))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6389 次 |
| 最近记录: |