#how to timeout a member with await timeout()

1 messages · Page 1 of 1 (latest)

steel heart
#

i don't understand how you can timeout a member with this function and also choose for how much user will be timeouted

steel heart
#

i don't understand how can i specify a duration

jade jasper
#
@bot.slash_command(description="Timeout Member")
async def test_command(inter:disnake.ApplicationCommandInteraction, target:disnake.Member):
    await target.timeout(duration=500.0)
    await inter.send(f"Put {target.display_name} on a 500seconds timeout")
#

Or you can use datetimes instead

odd sapphire
#

The docs explain it pretty well..

jade jasper
# steel heart i don't understand how can i specify a duration

I assume you tried to do member.timeout(60) which normally would make sense. However if you look in the docs at the definition
await timeout(*, duration=..., until=..., reason=None)
This is a python thing. See the asterisk ( * )? It collects all positional arguments. In essence what it means when you have a * alone in the start of a function is that you must use keyword arguments. In this case target.timeout(duration=500.0)

steel heart
#

thanks