Answer the question
In order to leave comments, you need to log in
How to implement these tasks in Python?
Today I started making my second Telegram bot, I write naturally in Python, without using third-party libraries.
During the development process, I encountered some tasks, I coped with most of them, but some remained beyond my little knowledge in this area.
1 Task
You have the following code:
@bot.message_handler(commands = ['url'])
def url(message):
markup = types.InlineKeyboardMarkup()
btn_my_site= types.InlineKeyboardButton(text='Написать ей', url='https://habrahabr.ru')
markup.add(btn_my_site)
bot.send_photo(message.chat.id, get("https://im0-tub-ru.yandex.net/i?id=ad7b5dc2baef00695b93f71305f81888-l&n=13").content, reply_markup=main4())
bot.send_message(message.chat.id, "Татьяна, 22 года.", reply_markup = markup)
@bot.message_handler(content_types=['text'])
def cont(message):
if message.text == 'Смотреть анкеты':
bot.send_message(message.chat.id,"Текст", reply_markup=markup)
Answer the question
In order to leave comments, you need to log in
bot.send_photo(message.chat.id, get("https://im0-tub-ru.yandex.net/i?id=ad7b5dc2baef00695b93f71305f81888-l&n=13").content, reply_markup=main4())
bot.send_message(message.chat.id, "Татьяна, 22 года.", reply_markup = markup)
<a href="тут ссылка на картинку">‍</a>
1 Task: As you can see from your code, you didn't try or search Google for anything, because if you just because if you went to the documentation for the method bot.send_photo
of the library that you DO NOT USE, you would see the caption argument or similar, and reply_markup and you wouldn't have such questions.
2 Task: Well, just send this message in the same way as in the handler above, what's the problem then?
<? header("Location: /путь к файлу");?>
Well, don't forget about http"s" header
if ($str) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: /");
exit();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question