Command that sets a reminder for a specified duration from now.
Parameters: |
-
duration
(
int )
–
The duration of the reminder in minutes.
-
message
(
str )
–
The message to send as a reminder.
|
Example
!remindme 10 Take a break
/Users/caoma/Documents/Programming/GIT/SkyWizz/skywizz/cogs/reminder_commands.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 | @commands.cooldown(2, 30, commands.BucketType.user)
@commands.command(name='remindme')
async def remindme_command(self, ctx, duration: int, *, message: str):
"""
Command that sets a reminder for a specified duration from now.
Args:
duration: The duration of the reminder in minutes.
message: The message to send as a reminder.
Example:
`!remindme 10 Take a break`
"""
reminder_time = datetime.datetime.utcnow() + datetime.timedelta(
minutes=duration)
embed = embd.newembed(title=f"Reminder: {message}",
description=f"Set for {reminder_time.strftime('%Y-%m-%d %H:%M:%S')} UTC.",
)
embed.set_footer(text="Reminder set by {}".format(ctx.author.display_name))
await ctx.send(embed=embed)
await asyncio.sleep(duration * 60)
feedback_embed = embd.newembed(title="Reminder",
description=f"{message}")
feedback_embed.set_footer(text="Reminder sent by {}".format(self.bot.user.display_name))
await ctx.author.send(embed=feedback_embed)
|