Compare commits

..

2 Commits

Author SHA1 Message Date
Jerome A
7f4fcdd957
Merge 24c1e3c598 into ac3829f508 2024-04-14 23:58:05 +08:00
TSRBerry
ac3829f508
remind: Add message references and don't remove reminder confirmations (#97)
* Don't remove reminder confirmation messages

* Add message references to reminders
2024-04-14 15:34:12 +02:00

View File

@ -39,8 +39,15 @@ class Remind(Cog):
@commands.command(aliases=["remindme"])
async def remind(self, ctx, when: str, *, text: str = "something"):
"""Reminds you about something."""
ref_message = None
if ctx.message.reference is not None:
ref_message = await ctx.channel.fetch_message(
ctx.message.reference.message_id
)
if ctx.guild:
await ctx.message.delete()
current_timestamp = time.time()
expiry_timestamp = self.bot.parse_time(when)
@ -58,6 +65,9 @@ class Remind(Cog):
)
safe_text = await commands.clean_content().convert(ctx, str(text))
if ref_message is not None:
safe_text += f"\nMessage reference: {ref_message.jump_url}"
added_on = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S (UTC)")
add_job(
@ -68,12 +78,10 @@ class Remind(Cog):
expiry_timestamp,
)
msg = await ctx.send(
await ctx.send(
f"{ctx.author.mention}: I'll remind you in "
f"DMs about `{safe_text}` in {duration_text}."
)
await asyncio.sleep(5)
await msg.delete()
async def setup(bot):