Skip to content

Instantly share code, notes, and snippets.

@hoseinmontazer
Created August 19, 2015 09:42
Show Gist options
  • Save hoseinmontazer/60987cf96ab27b0b6d00 to your computer and use it in GitHub Desktop.
Save hoseinmontazer/60987cf96ab27b0b6d00 to your computer and use it in GitHub Desktop.
test-python
import telegram
bot = telegram.Bot(token='94659039:AAGxm7YBCKonO9DYtusYWBnbG1Ve8BjK3iM')
print bot.getMe()
updates = bot.getUpdates()
print [u.message.text for u in updates]
updates = bot.getUpdates()
print [u.message.photo for u in updates if u.message.photo]
chat_id = bot.getUpdates()[-1].message.chat_id
bot.sendMessage(chat_id=chat_id, text="I'm sorry Dave I'm afraid I can't do that.")
bot.sendMessage(chat_id=chat_id, text=telegram.Emoji.PILE_OF_POO)
bot.sendPhoto(chat_id=chat_id, photo='https://telegram.org/img/t_logo.png')
bot.sendVoice(chat_id=chat_id, voice=open('tests/telegram.ogg', 'rb'))
bot.sendChatAction(chat_id=chat_id, action=telegram.ChatAction.TYPING)
custom_keyboard = [[ telegram.Emoji.THUMBS_UP_SIGN, telegram.Emoji.THUMBS_DOWN_SIGN ]]
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
bot.sendMessage(chat_id=chat_id, text="Stay here, I'll be back.", reply_markup=reply_markup)
@Ara4Sh
Copy link

Ara4Sh commented Aug 19, 2015

قسمت voice رو کامنت کن
وقتی هم که بات مسیج نداشته باشه نمی تونه −۱ رو فچ کنه

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment