-
-
Save anonymous/e846db4c42363f8d75c2 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 | |
""" | |
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