26 lines
998 B
Python
26 lines
998 B
Python
import discord
|
|
import asyncio
|
|
from discord.ext import commands
|
|
from discord import app_commands
|
|
|
|
from dotenv import load_dotenv
|
|
load_dotenv()
|
|
|
|
class remind(commands.Cog):
|
|
def __init__(self, bot):
|
|
self.bot = bot
|
|
|
|
@commands.Cog.listener()
|
|
async def on_ready(self):
|
|
print("Remind Online")
|
|
|
|
@app_commands.command(name="remind", description="Create a reminder")
|
|
async def remind(self, interaction: discord.Interaction, time: int, *, reminder: str):
|
|
em = discord.Embed(title="You will be reminded about: ", description=f"{reminder} in {time} hours", color=interaction.user.color)
|
|
await interaction.response.send_message(embed=em)
|
|
await asyncio.sleep(time*3600)
|
|
alert_em = discord.Embed(title="Reminder", description=f"{interaction.user.mention}, you asked me to remind you about: {reminder}", color=interaction.user.color)
|
|
await interaction.followup.send(embed=alert_em)
|
|
|
|
async def setup(bot):
|
|
await bot.add_cog(remind(bot)) |