We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6927707 + f215f71 commit 6f642c4Copy full SHA for 6f642c4
examples/timeout.py
@@ -0,0 +1,24 @@
1
+import datetime
2
+
3
+import discord
4
5
+bot = discord.Bot()
6
7
8
+@bot.command()
9
+async def timeout(ctx, member: discord.Member, minutes: int):
10
+ """Apply a timeout to a member"""
11
12
+ duration = datetime.timedelta(minutes=minutes)
13
+ await member.timeout_for(duration)
14
+ await ctx.reply(f"Member timed out for {minutes} minutes.")
15
16
+ """
17
+ The method used above is a shortcut for
18
19
+ until = discord.utils.utcnow() + datetime.timedelta(minutes=minutes)
20
+ await member.timeout(until)
21
22
23
24
+bot.run("TOKEN")
0 commit comments