Answer the question
In order to leave comments, you need to log in
How to make welcome bot telegram?
Hello everyone, I use aiogram. So I decided to write a chat bot to welcome new members. How can I do this without a database? here is the code that doesn't work
async def new_member(message: types.Message):
button = types.InlineKeyboardButton(text=btn_text, callback_data=f"{message.from_user.id}:reg")
kb = types.InlineKeyboardMarkup().add(button)
await message.answer(message_text, reply_markup=kb)
async def send_register(call: types.CallbackQuery):
await call.answer(text="Спасибо, что воспользовались ботом!", show_alert=True)
async def query_handler(message: types.Message, call: types.CallbackQuery, regexp: re.Match):
if call.from_user.id != int(regexp.group(1)):
name = message.new_chat_members[0].first_name
await call.answer(text=f"Вы не {name}", show_alert=True)
def register_start_handler(dp: Dispatcher):
dp.register_message_handler(new_member, content_types=["new_chat_members"])
dp.register_callback_query_handler(callback=send_register)
dp.register_callback_query_handler(callback=query_handler, regexp=r"(\d+):reg")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question