Skip to content

Instantly share code, notes, and snippets.

@Kylmakalle
Created May 7, 2017 15:02
Show Gist options
  • Save Kylmakalle/1132315523fee96c386b3330cdcdde13 to your computer and use it in GitHub Desktop.
Save Kylmakalle/1132315523fee96c386b3330cdcdde13 to your computer and use it in GitHub Desktop.
Script that checks bot possibility to delete messages
import requests
tokens = {
'123454321:abcdefghABCDEFGHIoqwe-123ejksdaaasd',
'987654321:xyzzyxABCabcTELEBOTadasd12389012nss',
'123456789:AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLL',
}
for token in tokens:
r = requests.get('https://api.telegram.org/bot{}/getMe'.format(token))
a = requests.get('https://api.telegram.org/bot{}/deletemessage?chat_id=-12345&message_id=123'.format(token))
if 'method not found' in a.text:
print(r.text.split('"username":')[1][:-2], "Can't delete")
else:
print(r.text.split('"username":')[1][:-2], 'Can delete')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment