Answer the question
In order to leave comments, you need to log in
Doesn't want to answer in groups, can you help?
Greetings. I need your help, I am writing a bot on the PyTelegramBotApi library, and I did a check for messages in private messages with the bot, but when these messages are written to the group, it does not respond to what is written in else. And when I write any other message to him in PM, he answers what is in else. I'll attach the code below
@bot.message_handler(content_types=['text'])
def raspisanya(message):
if message.chat.type == 'private':
if message.text == 'Понедельник':
photo = open('kartinki/pon.png', 'rb')
bot.send_photo(message.chat.id, photo, caption='Держите')
elif message.text == 'Вторник':
photo = open('kartinki/vt.png', 'rb')
bot.send_photo(message.chat.id, photo, caption='Держите')
elif message.text == 'Среда':
photo = open('kartinki/sreda.png', 'rb')
bot.send_photo(message.chat.id, photo, caption='Держите')
elif message.text == 'Четверг':
photo = open('kartinki/cht.png', 'rb')
bot.send_photo(message.chat.id, photo, caption='Держите')
elif message.text == 'Пятница':
photo = open('kartinki/pyt.png', 'rb')
bot.send_photo(message.chat.id, photo, caption='Держите')
elif message.text == 'Звонки':
photo = open('kartinki/zvonki.png', 'rb')
bot.send_photo(message.chat.id, photo, caption='Держите')
else:
sti = open('sticker/idinaxui.webp', 'rb')
bot.send_sticker(message.chat.id, sti)
bot.send_message(message.chat.id, 'Не отвечаю на данные сообщение в группах, пишите в личные сообщения.')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question