Last active
November 2, 2015 12:25
-
-
Save k4ml/43ee9a308c6070e5c27d to your computer and use it in GitHub Desktop.
Sending message to channel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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