ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Общие вопросы программирования (https://forum.antichat.xyz/forumdisplay.php?f=206)
-   -   отправка сообщений по нажатию кнопки | TeleBot (https://forum.antichat.xyz/showthread.php?t=1490605)

akitanoname 01.10.2023 12:55

РЕЧЬ ИДЕТ ПРО TeleBot

как мне сделать так, что бы по нажатию кнопки которая создается







python:





Код:

types
.
KeyboardButton
(
)



, отправлялось сообщение не 1 раз, а постоянно при каждом нажатии​

Python_newbie 01.10.2023 13:46

Python:





Код:

import
telebot
from
telebot
import
types

token
=
"token"
bot
=
telebot
.
TeleBot
(
token
)
@bot.message_handler
(
commands
=
[
'start'
]
)
def
start_message
(
message
)
:
markup
=
types
.
ReplyKeyboardMarkup
(
resize_keyboard
=
True
)
item1
=
types
.
KeyboardButton
(
"Кнопка"
)
markup
.
add
(
item1
)
bot
.
send_message
(
message
.
chat
.
id
,
"Старт"
,
reply_markup
=
markup
)
bot
.
infinity_polling
(
)



Время: 07:02