I'm trying to create a discord bot which takes a date and time from the command and sends a message 1 minute before said date/time.
Below is a portion of the code I have written. The command works as expected right now but the task loop is not sending a message.
async def on_ready():
print("Our Bot is online!")
task_loop.start()
@bot.command()
async def cfg(ctx, ac: str, date: str):
print(datetime.now())
date = datetime.strptime(date, "%Y-%m-%d_%H:%M")
embed = discord.Embed(title="NOTIFICATION")
embed.add_field(name=ac + " test", value=date)
await ctx.send(embed=embed)
@tasks.loop(seconds=1)
async def task_loop():
if datetime.now() == date - timedelta(minutes=1):
print("test")
embed = discord.Embed(title="NOTIFICATION")
embed.add_field(name=ac + " blah blah blah", value="blah")
await ctx.send(content=f"{ctx.message.guild.default_role}", embed=embed)
else:
print("nope")