message- параметр, в который приходит сообщение из декоратора, в принципе, название можно дать любое.
: types.Message- аннотация типов, для читаемости кода
не могу понять зачем он нужена как обрабатывать тогда входящие сообщения, если они никуда не приходят?
\n
text = 'Модель: ....\nГод: .....\nАКБ: ....'
bot.send_message(message.from_user.id, text)
'''
text = '''Модель: .............
Год: ...............
АКБ: ............'''
bot.send_message(message.from_user.id, text)
secret = '43d2yIyIVM'
username = 'user'
bot.remove_webhook()
time.sleep(1)
bot.set_webhook(url='https://{}.pythonanywhere.com/{}'.format(username, secret))
app = Flask(__name__)
@app.route('/{}'.format(secret), methods=["POST"])
def webhook():
bot.process_new_updates([telebot.types.Update.de_json(request.stream.read().decode("utf-8"))])
return 'ok', 200
for tovar in tovars:
photo = open(tovar[3], 'rb')
caption = f"Назва: {tovar[1]}.\nОпис: {tovar[2]}.\nЦіна: {tovar[6]} грн."
tovarKeyboard=types.InlineKeyboardMarkup()
tovarKeyboard.add(types.InlineKeyboardButton(text="Перейти до товару на сайті", url=tovar[4]))
bot.send_photo(call.message.chat.id, photo, caption, reply_markup=tovarKeyboard)
Bots talking to each other could potentially get stuck in unwelcome loops. To avoid this, we decided that bots will not be able to see messages from other bots regardless of mode.
@bot.message_handler(content_types=['video'])
def command_handle_video(message):
bot.send_message(message.chat.id, message.video.file_id)
d = open('/home/roman/Изображения/123.png', 'rb')
bot.send_media_group('айди канала',
[InputMediaPhoto(d, caption='описание видео'),
InputMediaVideo(message.video.file_id)])
если я отправляю одну фотографию без сжатия - то ничего не происходит
если я отправляю например 4 фотографии, то функция def handle_docs_photo(message): сохраняет каждый раз на одну фотографию меньше, в данном случае 3 фото