MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / photo

Function photo

examples/conversationbot.py:70–80  ·  view source on GitHub ↗

Stores the photo and asks for a location.

(update: Update, context: ContextTypes.DEFAULT_TYPE)

Source from the content-addressed store, hash-verified

68
69
70async def photo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
71 """Stores the photo and asks for a location."""
72 user = update.message.from_user
73 photo_file = await update.message.photo[-1].get_file()
74 await photo_file.download_to_drive("user_photo.jpg")
75 logger.info("Photo of %s: %s", user.first_name, "user_photo.jpg")
76 await update.message.reply_text(
77 "Gorgeous! Now, send me your location please, or send /skip if you don't want to."
78 )
79
80 return LOCATION
81
82
83async def skip_photo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:

Callers

nothing calls this directly

Calls 3

download_to_driveMethod · 0.80
reply_textMethod · 0.80
get_fileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…