Answer the question
In order to leave comments, you need to log in
How to make a button in telegram bot?
How to make a button in a telegram bot that, when the user clicks, will write a command on his behalf, for example / help, and not on behalf of the bot.
For example, this line of code writes on behalf of the bot /help
@dp.message_handler(Text(equals="Помощь"))
async def with_puree(message: types.Message):
await message.reply("/help")
Answer the question
In order to leave comments, you need to log in
you told him to respond like this to every message, yes, of course, he behaves like that)
regular button
from aiogram.types import ReplyKeyboardRemove, \
ReplyKeyboardMarkup, KeyboardButton
@dp.message_handler(commands=['start'])
async def process_start_command(message: types.Message):
button_hi = KeyboardButton('/help')
greet_kb = ReplyKeyboardMarkup()
greet_kb.add(button_hi)
await message.reply("Привет!", reply_markup=kb.greet_kb)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question