C
C
CVFHFU2019-07-05 09:11:54
Python
CVFHFU, 2019-07-05 09:11:54

How to get rid of an error when sending a photo to a telegram bot?

Hello, I have a problem with sending photos by telegram bot. I use the telebot library. I immediately want to apologize if the question is stupid, or if the question is incorrectly formatted (I ask a question on the Internet for the first time).
Here is the code:
bot.massage_handler(content_types = ['text'])
def massage_photo(massage):
if massage.text == "photo 1" or "photo1":
photo = open('E:/Bot/photo/photo1. jpg', 'rb')
tb.send_photo(443519574, photo)
tb.send_photo(443519574, "FILEID")
Error: invalid syntax.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RayOtto, 2019-07-05
@RayOtto

Something was written wrong

The error it gives is: invalid syntax.

I think there is an error in
if massage.text == "photo 1" or "photo 1":

Try
if massage.text == "фото 1" or massage.text == "фото1"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question