M
M
Michael S.2021-08-02 12:34:30
Python
Michael S., 2021-08-02 12:34:30

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)

decorators i regul at the end

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")

Tell me how to do

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2021-08-02
@LazyTalent

Of course, a perversion, but you can use a radish https://redis.io/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question