1 回答

TA貢獻(xiàn)1865條經(jīng)驗(yàn) 獲得超7個(gè)贊
檢查sendVoice的文檔- 它不使用名稱file_id,但voice
data = {'chat_id': '72600457', 'voice': 'AwADBAADPAYAAvFWCVFZFfPyZdGLfhYE'}
如果您使用文件 ID,那么您也可以POST使用GET
您應(yīng)該從服務(wù)器獲得響應(yīng)以查看有關(guān)錯(cuò)誤請(qǐng)求的信息
import requests
token = '<MY TOKEN>'
data = {'chat_id': '72600457', 'voice': 'AwADBAADPAYAAvFWCVFZFfPyZdGLfhYE'}
url = f'https://api.telegram.org/bot{token}/sendVoice'
#response = requests.post(url, data=data)
response = requests.get(url, params=data)
print(response.json())
順便說(shuō)一句:有模塊python-telegram-bot。GitHub: python-telegram-bot
添加回答
舉報(bào)