Answer the question
In order to leave comments, you need to log in
How to set the time of the mute, ban in the team?
There is a code when the bot stirs up a person for 5 minutes
@dp.message_handler(commands=['mute'])
async def mute(message: types.Message):
await message.bot.restrict_chat_member(message.chat.id, message.reply_to_message.from_user.id, until_date=time()+300)
number = message.get_args() * 3600 #нужно передать в until_date=time()
Answer the question
In order to leave comments, you need to log in
get_args() → Optional[str]
According to the documentation, get_args() returns the string that comes after the command, or None. Parsing this line is your concern. For example, like this:
1. assign the result of .get_args() to a variable and make sure it's not None.
2. strip spaces with .strip()
3. turn into int()/ float() and catch an exception if the string is not a number
4. use the resulting value.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question