Skip to content

How can I send the user to a timeout? #8232

Discussion options

You must be logged in to vote

Timing out a Member

Implementing a timeout on a discord.Member is pretty simple. Please note you can not timeout an instance of discord.User because users are not guild specific. You have two methods you can call to timeout the member.

  1. Member.timeout.
  2. Member.edit with the timed_out_until parameter.

Small Example

@bot.command()
@commands.has_permissions(moderate_members=True)
async def timeout(ctx: commands.Context, member: discord.Member):
    await member.timeout(datetime.timedelta(hours=1), reason=f"Requested by {ctx.author}")
    await ctx.send(f"I've timed out {member.mention} for 1 hour.")

How do I remove the timeout on the Member?

Call either of the two methods above with the until

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@IIDarkNessYT
Comment options

Answer selected by IIDarkNessYT
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants