from telegram.ext import (Updater, CommandHandler, CallbackQueryHandler) from telegram.ext import RegexHandler import logging # Enable logging logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) logger = logging.getLogger(__name__) def send_lennu(bot, update): update.message.reply_text(photo='https://fi-seiska-cdn-pro.seiska.fi/files/styles/article_page_image_770px_wide/s3/inline-images/2017/51/1_LENNU.jpg?itok=flG5nbOf') def main(): # Create the Updater and pass it your bot's token. updater = Updater("YOUR TOKEN") # Get the dispatcher to register handlers dp = updater.dispatcher # Add conversation handler with the states GENDER, PHOTO, LOCATION and BIO dp.add_handler(RegexHandler("sad", send_lennu)) # Start the Bot updater.start_polling() # Run the bot until you press Ctrl-C or the process receives SIGINT, # SIGTERM or SIGABRT. This should be used most of the time, since # start_polling() is non-blocking and will stop the bot gracefully. updater.idle() if __name__ == '__main__': main()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question