Skip to content

Instantly share code, notes, and snippets.

/TB

Created July 2, 2015 17:06
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 anonymous/e846db4c42363f8d75c2 to your computer and use it in GitHub Desktop.
Save anonymous/e846db4c42363f8d75c2 to your computer and use it in GitHub Desktop.
from twx.botapi import TelegramBot, ReplyKeyboardMarkup
"""
Setup the bot
"""
bot = TelegramBot('116456440:AAEys8uNPIONg-7nYWDb5Qob1K1KS2cuBjc')
bot.update_bot_info().wait()
print(bot.username)
"""
Send a message to a user
"""
#user_id = int(94660484)
#result = bot.send_message(user_id, "Testing The Code's!").wait()
#print(result)
"""
Get updates sent to the bot
"""
sent= False
updates = bot.get_updates().wait()
last=updates
for update in updates:
print(update)
last=updates
updates = bot.get_updates().wait()
user_id = update.message.sender.id
print(user_id)
if last != updates:
sent=False
if update.message.text=="/hello" and sent == False:
result = bot.send_message(user_id, "hello :)").wait()
print()
print(result)
print()
Sent=True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment