-
-
Save Surye/5811881ee923a361cd1d to your computer and use it in GitHub Desktop.
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
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