电报聊天机器人无法发送发票

2024-05-17 03:21:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我的问题是sendInvoice HTTP get。 基本上,当我发出URL请求时,电报上不会显示任何内容,也不会在日志或控制台中收到任何类型的错误

所以我不知道为什么它不起作用

以下是代码(出于隐私原因,我放置了假令牌和聊天室id):

def __init__(self, config):
    self.token = "2880000618:AlnCmb0R9YNaR2xxxxxxxxxnixb6jnQYjNJ"
    self.base = "https://api.telegram.org/bot{}/".format(self.token)

def sendInvoice(self, chat_id, title, description, payload, provider_token, start_parameter, currency, prices):
    url = self.base + "sendInvoice?chat_id={}&title={}&description={}&payload={}&provider_token={}&start_parameter={}&currency={}&prices={}".format(chat_id, title, description, payload, provider_token, start_parameter, currency, prices)
    requests.get(url)

def someFunction():
    chat_id = 192837465
    prices = [{
        'label': "Donation",
        'amount': 500
        }]
    sendInvoice(chat_id, "Donation", "Donation of 5 eur", "12345", "500000468:TEST:zczMxxxxxViNjA2N", "pay", "EUR", prices);

提前感谢你的帮助


Tags: selftokenidparametertitledefdonationchat