Skip to content

Instantly share code, notes, and snippets.

@Surye
Forked from anonymous/TB
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Surye/5811881ee923a361cd1d to your computer and use it in GitHub Desktop.
Save Surye/5811881ee923a361cd1d 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
"""
offset_id = 0
while True:
updates = bot.get_updates(offset=offset_id).wait()
for update in updates:
offset_id = update.update_id+1
print(update)
user_id = update.message.sender.id
print(user_id)
if update.message.text=="/hello":
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