Skip to content

Instantly share code, notes, and snippets.

@hoseinmontazer
Last active August 31, 2015 07:27
Show Gist options
  • Save hoseinmontazer/d1c3937b100b232eaa4e to your computer and use it in GitHub Desktop.
Save hoseinmontazer/d1c3937b100b232eaa4e to your computer and use it in GitHub Desktop.
test bot
import telegram
def main():
bot = telegram.Bot(token="128535145:AAG6gTZYlAjbIeQmy-r3ZtG_pnBpi7hJSAQ")
lui = bot.getUpdates()[-1].update_id
print lui
while True:
for updates in bot.getUpdates(offset=lui,timeout=10):
text = updates.message.text
chat_id = updates.message.chat.id
update_id = updates.update_id
custom_keyboard = [[ telegram.Emoji.THUMBS_UP_SIGN, telegram.Emoji.THUMBS_DOWN_SIGN ]]
# markup = types.ReplyKeyboardMarkup(row_width=2)
# markup.add('a', 'v', 'd')
# tb.send_message(chat_id, "Choose one letter:", reply_markup=markup)
markup = content_type.ReplyKeyboardMarkup()
markup.row('a', 'v')
markup.row('c', 'd', 'e')
tb.send_message(chat_id, "Choose one letter:", reply_markup=markup)
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
bot.sendMessage(chat_id=chat_id, text="Stay here, I'll be back.", reply_markup=reply_markup)
if text == "/Arash":
bot.sendMessage(chat_id=chat_id,text="Hello Creator welcome back")
lui = update_id + 1
else:
bot.sendMessage(chat_id=chat_id,text="Hello Stranger how can i help you?")
lui = update_id + 1
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment