Answer the question
In order to leave comments, you need to log in
Telegram Bot Api does not return the right to send a message?
The chat bot is an administrator and has full rights. After disabling the ability to send messages to users, the bot using the telegram api cannot enable the ability to send messages, a successful result is sent, but nothing happens
url = f'https://api.telegram.org/bot{token}/setChatPermissions?chat_id=-1001386422499'
prm = {
'can_send_messages' : True,
'can_send_media_messages' : True,
'can_send_polls' : True,
'can_send_other_messages' : True,
'can_add_web_page_previews' : True,
'can_invite_users' : True
}
r = requests.post(url, params = prm)
print(r.text)
Answer the question
In order to leave comments, you need to log in
It is necessary to use a structure of this kind. chat_id and permissions have strong names and are passed as POST data.
Something like this should work:
prm = {
'can_send_messages' : True,
'can_send_media_messages' : True,
'can_send_polls' : True,
'can_send_other_messages' : True,
'can_add_web_page_previews' : True,
'can_invite_users' : True
}
payload = {
'chat_id': -1001386422499,
'permissions': prm
}
requests.post(url, data=payload)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question