Показать сообщение отдельно

  #3  
Старый 21.04.2024, 14:15
лимаров
Участник форума
Регистрация: 09.01.2022
Сообщений: 105
С нами: 2286618

Репутация: 23
По умолчанию

123:





Код:
import
telebot
import
webbrowser
import
types

bot
=
telebot
.
TeleBot
(
'6874714175:AAFQKXXXXXXXXXXXXUelTp_bZcGgpyHUPUl0'
)
markup
=
types
.
ReplyKeyboardMarkup
(
resize_keyboard
=
True
)
btn1
=
types
.
KeyboardButton
(
"👋 Поздороваться"
)
btn2
=
types
.
KeyboardButton
(
"❓ Задать вопрос"
)
markup
.
add
(
btn1
,
btn2
)
bot
.
send_message
(
message
.
chat
.
id
,
text
=
"Привет, {0.first_name}! Я бот помощник"
.
format
(
message
.
from_user
)
,
reply_markup
=
markup
)
@bot.message_handler
(
content_types
=
[
'text'
]
)
def
func
(
message
)
:
if
(
message
.
text
==
"👋 Поздороваться"
)
:
bot
.
send_message
(
message
.
chat
.
id
,
text
=
"Привеет.. Спасибо что читаешь статью!)"
)
elif
(
message
.
text
==
"❓ Задать вопрос"
)
:
markup
=
types
.
ReplyKeyboardMarkup
(
resize_keyboard
=
True
)
btn1
=
types
.
KeyboardButton
(
"Как меня зовут?"
)
btn2
=
types
.
KeyboardButton
(
"Что я могу?"
)
back
=
types
.
KeyboardButton
(
"Вернуться в главное меню"
)
markup
.
add
(
btn1
,
btn2
,
back
)
bot
.
send_message
(
message
.
chat
.
id
,
text
=
"Задай мне вопрос"
,
reply_markup
=
markup
)
elif
(
message
.
text
==
"Как меня зовут?"
)
:
bot
.
send_message
(
message
.
chat
.
id
,
"У меня нет имени.."
)
elif
message
.
text
==
"Что я могу?"
:
bot
.
send_message
(
message
.
chat
.
id
,
text
=
"Поздороваться с читателями"
)
elif
(
message
.
text
==
"Вернуться в главное меню"
)
:
markup
=
types
.
ReplyKeyboardMarkup
(
resize_keyboard
=
True
)
button1
=
types
.
KeyboardButton
(
"👋 Поздороваться"
)
button2
=
types
.
KeyboardButton
(
"❓ Задать вопрос"
)
markup
.
add
(
button1
,
button2
)
bot
.
send_message
(
message
.
chat
.
id
,
text
=
"Вы вернулись в главное меню"
,
reply_markup
=
markup
)
else
:
bot
.
send_message
(
message
.
chat
.
id
,
text
=
"На такую комманду я не запрограммировал.."
)
bot
.
polling
(
none_stop
=
True
)
 
Ответить с цитированием