File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 7
7
8
8
@bot .command ()
9
9
async def timeout (ctx , member : discord .Member , minutes : int ):
10
- """Set timeout on a member"""
10
+ """Apply a timeout to a member"""
11
11
12
- now = discord .utils .utcnow () # get current time
13
- until = now + datetime .timedelta (minutes = minutes ) # add the duration
14
- await member .timeout (until = until )
15
- await ctx .respond (f"Member timed out for { minutes } minutes." )
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
+ """
16
22
17
23
18
24
bot .run ("TOKEN" )
You can’t perform that action at this time.
0 commit comments