X
X
Xand0r2021-08-18 21:45:54
Python
Xand0r, 2021-08-18 21:45:54

Another message from the bot on first launch?

Is it possible without a database to make the bot write a different message at the first start, different from the permanent one. If so, how?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Loli E1ON, 2021-08-18
@E1ON

You can store a list of messages in an array and, when sending, simply select a random element from this list.

R
RusiDev, 2021-08-19
@RusiDev

Ready example for aiogram

import random as r

start_words = ["приветствую, ла ла ла", "доброго времени суток", "hello"]  // значения
s_words = r.choice(start_words) // выбирает рандомно слова

@dp.message_handler(commands=['start', 'help'])
async def send_hello(message: types.Message):
    await message.answer(s_words)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question