Skip to content

Instantly share code, notes, and snippets.

@k4ml
Last active November 2, 2015 12:25
Show Gist options
  • Save k4ml/43ee9a308c6070e5c27d to your computer and use it in GitHub Desktop.
Save k4ml/43ee9a308c6070e5c27d to your computer and use it in GitHub Desktop.
Sending message to channel
#!/usr/bin/env python
# encoding: utf-8
__author__ = 'kamal@belajar.github.io'
import sys
import telegram
def main(token, message):
bot = telegram.Bot(token) # Telegram Bot Authorization Token
try:
bot.sendMessage(chat_id='@infomy', text=message)
except Exception as e:
print e
bot.sendMessage(chat_id=chat_id, text='Error')
if __name__ == '__main__':
main(sys.argv[1], sys.argv[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment