Skip to content

Instantly share code, notes, and snippets.

@RustemB
Created May 15, 2020 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save RustemB/3121e353863ac966e4922428660fa157 to your computer and use it in GitHub Desktop.
Save RustemB/3121e353863ac966e4922428660fa157 to your computer and use it in GitHub Desktop.
tgme
#!/usr/bin/env python3
import urllib.request as ur
import urllib.parse as up
from sys import argv
WEBHOOK_URL = "https://api.telegram.org"
BOT_API = "HERE_YORS_BOT_TOKEN_FROM_BOTFATHER"
DATA = up.urlencode({
'text': argv[1],
'chat_id': YOUR_ID,
})
with ur.urlopen("{}/bot{}/sendMessage?{}".format(WEBHOOK_URL, BOT_API, DATA)) as _: pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment