Discord.py - remind command with multiple time included - python

I'm trying to make a discord bot with a remind command. I would like the remind command to be able to do like ;remind 12.5m or ;remind 1h 12m 30s. but right now the remind command can only be used like ;remind 45m, ;remind 2h, ;remind 9m. basically the command only works if only one time is included. I'm not sure how to make the command work with multiple time included, can someone help me?
#client.command(case_insensitive=True, aliases=["reminder", "rm"])
async def remind(ctx, time, *, reminder="something"):
user = ctx.author.mention
channel = client.get_channel(12345678912345)
seconds = 0
log = discord.Embed(color=0xe9a9a9, timestamp=datetime.utcnow())
embed = discord.Embed(color=0xe9a9a9)
if time.lower().endswith("d"):
seconds += int(time[:-1]) * 60 * 60 * 24
counter = f"{seconds // 60 // 60 // 24} days"
if time.lower().endswith("h"):
seconds += int(time[:-1]) * 60 * 60
counter = f"{seconds // 60 // 60} hours"
if time.lower().endswith("m"):
seconds += int(time[:-1]) * 60
counter = f"{seconds // 60} minutes"
if time.lower().endswith("s"):
seconds += int(time[:-1])
counter = f"{seconds} seconds"
if seconds == 0 or seconds > 7776000:
await ctx.send("Please specify a valid time.")
if reminder is None:
await ctx.send("Please tell me what to remind you.")
else:
log.set_author(name=f"{ctx.author.display_name}#{ctx.author.discriminator} - Remind", icon_url=ctx.author.avatar_url)
log.set_footer(text=f"{counter} | {reminder}")
embed.add_field(
name="**Reminder**",
value=f"{user}, you asked me to remind you to `{reminder}` `{counter}` ago."
)
await ctx.send(f"Alright, I will remind you about `{reminder}` in `{counter}`.")
await asyncio.sleep(seconds)
await ctx.author.send(embed=embed)
await channel.send(embed=log)
return

When you do
remind(ctx, time, *, reminder='something')
The * bit is saying that when you call that function any parameters after that point have to be a named ones.
Instead if put the * in front of time then you are triggering a completely different behavior, and time will become a list of all of the different times given to you. Like so.
async def remind(ctx, *times, reminder="something"):
for time in times:
# move the code here
# Getting rid of the return statement at the end
However it will run each timer sequentially, waiting to count down the second one until the first one is finished. If you want to start all of the timers at once, since we're already using asyncio, there is a way we can easily accomplish this with asyncio.gather.
async def remind(ctx, *times, reminder="something"):
asyncio.gather(*[_remind(ctx, time, reminder) for time in times])
async def _remind(ctx, time, reminder):
# All of the code that was in your original remind runction
# would go here instead
Bytheway, once again the star (the one in async.gather) is acting in a different way.

Looks like you are using * for the reminder, meaning all provided times after the first one will be stored in your reminder variable. You can search the reminder variable for and valid times at the very start of the string.

Related

Discord Bot Looping Task from Command

Good afternoon all,
I should preface this post with the statement that I am pretty new to Python and know enough to get myself into trouble, but not enough to always get out of trouble...this is one of those instances I can't get out.
I am attempting to create a Discord Bot using discord.py that has the ultimate goal of being started from a command in Discord, starts counting the days since the start command was issued, and sends a message to Discord every morning with the count. I also would have a command to reset the count and another to cancel the counter.
For testing purposes, I have created code to count minutes instead of days and a task loop of only 10 seconds rather than a full day.
My problem is that I am attempting to use a discord.ext task for the loop, but I clearly don't know how to use it properly, and my research online has not made it any more clear to me. I'm hoping some folks here can steer me in the right direction. I have supplied my code below.
What I expect to happen when I execute my code:
I issue the $start arg command and the bot sends a message of "It has been X minutes"
Every 10 seconds the bot sends the same message until 1 minute has passed, then message reads "It has been X+1 minutes"
Continue looping until canceled
What actually happens:
I issue the $start arg command and the bot sends a message of "It has been X minutes"
Nothing else. No other messages or anything happens in Discord, no errors shown in the console.
The code is currently being hosted on replit.com, hence the keep_alive function using UpTimeRobot to keep the bot alive.
Something to note, I originally used asyncio.sleep() to just wait to send the new message. This worked fine for shorter periods (like a few minutes to hours) but even with UpTimeRobot doing its thing, I can't get 100% uptime of the Bot and I think whenever the bot went offline for a few minutes, it stopped my counter loop and that was that. This is what lead me to look into Tasks, as I read they can be used to continue loops on reconnection if the bot goes offline for a bit.
import discord
import os
import keep_alive
from datetime import date, datetime, time, timedelta
from discord.ext import commands, tasks
bot = commands.Bot(command_prefix="$")
init_count = 0
count = 0
channel_id = My_Channel_ID_Here
#bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
#tasks.loop(seconds=10, count=None, reconnect=True)
async def min_counter():
global count
global init_count
count = init_count
today = datetime.today()
now = datetime.today()
channel = bot.get_channel(channel_id)
if today.minute != now.minute:
# increment count by 1
count = count + 1
today = now
print('Count: ' + str(count))
await channel.send('It Has Been ' + str(count) + ' Minutes.') # Send message of minutes count
#bot.command() # Command to start the counter
async def start (ctx, arg: int): # arg is initial number of minutes to start with
global init_count
init_count = arg
await ctx.send('It Has Been ' + str(init_count) + ' Minutes.') # Send message of minutes count
min_counter.start()
#bot.command() # Command to reset counter
async def reset (ctx):
global count
count = 0
await ctx.send('It Has Been 0 Minutes.') # Send message that count is not zero
#bot.command() # Command to stop the counter
async def stop (ctx):
min_counter.cancel()
await ctx.send('Counter Stopped.')
keep_alive.keep_alive() # keep alive function call
bot.run(os.getenv('TOKEN')) # Discord bot private token call
Upon quick inspection you are looping the method min_counter() but every time it is called you are changing the values of now and today to datetime.today().
So when you go to compare the values here:
if today.minute != now.minute:
# increment count by 1
count = count + 1
today = now
print('Count: ' + str(count))
await channel.send('It Has Been ' + str(count) + ' Minutes.') # Send message of minutes count
This will always evaluate to False.
Easy Fix
Although I don't like the use of globals too much, here is how we could fix this keeping the style you have now.
Start the counter and initialize a variable named start_time in global scope:
#bot.command() # Command to start the counter
async def start (ctx, arg: int): # arg is initial number of minutes to start with
global init_count, start_time
start_time = datetime.today()
await ctx.send('It Has Been ' + str(init_count) + ' Minutes.') # Send message of minutes count
min_counter.start()
Then check if start_time is equal to now in the loop:
#tasks.loop(seconds=10, count=None, reconnect=True)
async def min_counter():
global count, start_time, init_count
now = datetime.today()
channel = bot.get_channel(channel_id)
if start_time != now:
# increment count by 1
count = count + 1
print('Count: ' + str(count))
await channel.send('It Has Been ' + str(count) + ' Minutes.') # Send message of minutes count
Let me know if everything works for you, I'd be happy to help further if needed.

How can i create a reminder command in discord.py?

I want to create a reminder command in discord.py, this command will remind a specific role that an event is coming. For that I saved in a first variable the hours when the event starts and in a second variable I subtracted the hours when the event starts and the minutes in advance.
Then I put the second variable in the async.io function so that the reminder is only given at that time.
For example if the event starts at 20:00 and the advance time is 2 the bot should remind at 19:58
But this does not work and I get the following error on the console:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.timedelta'
Heres the code I have:
#bot.command()
async def reminder(ctx, arg):
if arg == 'sap':
role = 839182749452992639
message = 'hello '
event_start_time = timedelta(hours=20, minutes=0)
advance_time = event_start_time - timedelta(minutes=2)
await asyncio.sleep(int(advance_time) * 60)
role = get(ctx.guild.roles, id=int(role))
for user in ctx.guild.members:
if role in user.roles:
userDM = await user.create_dm() if (user.dm_channel is None) else user.dm_channel
if userDM != None:
await userDM.send(message + user.name)
You cannot really cast a datetime.timedelta object into an integer, if you want to get the total seconds just use the total_seconds() method
await asyncio.sleep(advance_time.total_seconds()))
Your logic is off though, the function it’s not going to sleep till 19:58, but for 19 hours and 58 minutes, to fix it you have to subtract the current time to the desired time and get the seconds
now = datetime.now() # or utcnow
future = datetime(now.year, now.month, now.day, 19, 58)
delta = (future - now).total_seconds()
await asyncio.sleep(delta)
Your following lines will produce a timedelta object:
event_start_time = timedelta(hours=20, minutes=0)
advance_time = event_start_time - timedelta(minutes=2)
when you are trying to do int(advance_time) this produces your error, what you can do is to get the seconds directly from the timedelta object:
event_start_time = timedelta(hours=20, minutes=0)
advance_time = event_start_time - timedelta(minutes=2)
advance_time_seconds = advance_time.seconds
# you already have the difference in seconds, no need to multiply by 60
# can keep the int() so yo get and integer
await asyncio.sleep(int(advance_time))
I already made a similar command before, so try this:
Example usage
#client.command(name='timer', help='Create a timer.', usage='<time> [s|m|h] (<message>)')
async def timer(ctx, time, unit, *message):
if not message:
message = 'Time\'s up!'
else:
message = ' '.join(message)
time = int(time)
oldtime = time # time without unit calculation to seconds
if unit == 's':
pass
elif unit == 'm':
time *= 60
elif unit == 'h':
time *= 3600
else:
await ctx.send(':x: **ERROR**: Invalid unit.\nUnit can be \'s\' for seconds, \'m\' for minutes or \'h\' for hours.')
return
if time > 10000:
await ctx.send(':x: **ERROR**: Timer can\'t be longer than 10000 seconds.')
return
await ctx.send(f':white_check_mark: Creating a timer for **{oldtime}{unit}** with message \"**{message}**\"...\nYou will get mentioned/pinged.')
await asyncio.sleep(time)
await ctx.send(f'{ctx.author.mention} **{message}** (**{oldtime}{unit}** passed.)')

PyCharm couldn't find "utcnow" in "datetime" (Discord.py, Python 3.8)

I found this reminder command (on Stackoverflow) and I corrected some bits to go according to my cog. So there is this bit in the code which is utcnow and PyCharm can't find it in datetime
Code
#commands.command(case_insensitive=True, aliases=["remind", "remindme", "remind_me"])
#commands.bot_has_permissions(attach_files=True, embed_links=True)
async def reminder(self, ctx, time, *, reminder, counter):
print(time)
print(reminder)
user = ctx.message.author
embed = discord.Embed(color=0x55a7f7, timestamp=datetime.utcnow())
embed.set_footer(
text="If you have any questions, suggestions or bug reports, please join our support Discord Server: link hidden",
icon_url=f"{self.client.user.avatar_url}")
seconds = 0
if reminder is None:
embed.add_field(name='Warning',
value='Please specify what do you want me to remind you about.') # Error message
if time.lower().endswith("d"):
seconds += int(time[:-1]) * 60 * 60 * 24
counter = f"{seconds // 60 // 60 // 24} days"
if time.lower().endswith("h"):
seconds += int(time[:-1]) * 60 * 60
counter = f"{seconds // 60 // 60} hours"
elif time.lower().endswith("m"):
seconds += int(time[:-1]) * 60
counter = f"{seconds // 60} minutes"
elif time.lower().endswith("s"):
seconds += int(time[:-1])
counter = f"{seconds} seconds"
if seconds == 0:
embed.add_field(name='Warning',
value='Please specify a proper duration, send `reminder_help` for more information.')
elif seconds < 300:
embed.add_field(name='Warning',
value='You have specified a too short duration!\nMinimum duration is 5 minutes.')
elif seconds > 7776000:
embed.add_field(name='Warning',
value='You have specified a too long duration!\nMaximum duration is 90 days.')
else:
await ctx.send(f"Alright, I will remind you about {reminder} in {counter}.")
await asyncio.sleep(seconds)
await ctx.send(f"Hi, you asked me to remind you about {reminder} {counter} ago.")
return
await ctx.send(embed=embed)
First of all, make sure you are importing the datetime library:
import datetime
Depending on your import, the correct call to the datetime functions will be something like this:
datetime.datetime.utcnow()
This happens because you are actually importing a file like datetime.py and within it exists the class you want to use, called datetime.
For some reference, the whole call explained:
datetime - tells python to select in the datetime module
datetime - tells python to select the class datatime in that module
utcnow - tells python to select the method utcnow in that class
() - execute that module.

Reminder function: how to make it accept more than one value for the time argument?

So, I'm trying to create a reminder function using discord.py. This is my code:
#client.command(name = "reminder", brief = "I'll send a message to the future.",
description = "State what I have to remind you, as well as when and in which channel and I'll do it! "
"Write d for days, h for hours, m for minutes and s for seconds after the number and then "
"what you want to be remided of. For example: >reminder 1h 30m eat chocolate",
aliases = ["remind", "remindme", "remindto"])
async def reminder(ctx, time, *, reminder):
user = ctx.message.author
seconds = 0
if reminder is None:
ctx.send("Please, tell me what you want me to remind you about!")
if time.lower().endswith("d"):
seconds += float(time[:-1]) * 60 * 60 * 24
counter = f"{seconds // 60 // 60 // 24} days"
if time.lower().endswith("h"):
seconds += float(time[:-1]) * 60 * 60
counter = f"{seconds // 60 // 60} hours"
if time.lower().endswith("m"):
seconds += float(time[:-1]) * 60
counter = f"{seconds // 60} minutes"
if time.lower().endswith("s"):
seconds += float(time[:-1])
counter = f"{seconds} seconds"
if seconds == 0:
await ctx.send("You can't tell me that!")
else:
await ctx.send(f"Alright, I will remind you about {reminder} in {counter}.")
await asyncio.sleep(seconds)
await ctx.send(f"Hi, <#{user.id}>, you asked me to remind you about {reminder} {counter} ago.")
return
My issue is that I have no clue how to make it work when someone write more than one argument for "time". So for instance, if I call the function >reminder 1h 30min eat chocolate, it will remind me in 1h to "30min eat chocolate", instead of reminding me in 1h 30min. I don't know if there is a way to fix this (apart from writing 1.5h). Any input will be useful. Thanks a lot!
The message your user in inputting is "somewhere" split into parameters that then call the async method you posted. The "splitting" of the user input is NOT done in the code you showed.
If you want to handle '1d 3hours 52sec Check StackOverflow for answers.' as user input you need to change the way this message is split before calling async def reminder(ctx, time, *, reminder) with the split parameters.
You need to change it so that time gets provided as '1d 3hours 52sec' and reminder is provided as 'Check StackOverflow for answers.':
# correctly proivided params
reminder(ctx, "1d 3hours 52sec", *, reminder="Check StackOverflow for answers")
If you are unable to change this splitting behaviour, forbid spaces inside the time-component of the message the user uses:
It seems that your users text is currently split at spaces and the first is provided for time and the remainder as reminder message.
If you forbid spaces inside time-components you can change your method to parse the time correctly for inputs like '1d3hours52sec Check StackOverflow for answers.'.
This could be a -non async- implementation of a method that handles above messages:
Some helper methods and imports:
imort time
def format_seconds(secs):
# mildly adapted from source: https://stackoverflow.com/a/13756038/7505395
# by Adam Jacob Muller
"""Accepts an integer of seconds and returns a minimal string formatted into
'a years, b months, c days, d hours, e minutes, f seconds' as needed."""
periods = [
('year', 60*60*24*365),
('month', 60*60*24*30),
('day', 60*60*24),
('hour', 60*60),
('minute', 60),
('second', 1)
]
strings=[]
for period_name, period_seconds in periods:
if secs > period_seconds:
period_value , secs = divmod(secs, period_seconds)
has_s = 's' if period_value > 1 else ''
strings.append("%s %s%s" % (period_value, period_name, has_s))
return ", ".join(strings)
def convert_timestring_to_seconds(time):
"""Convert a math expression to integer,only allows [0..9+* ] as chars."""
if not all(c in "1234567890+* " for c in time):
raise Exception()
# this are seconds - using eval as we can be sure nothing harmful can be in it
# if you are paranoid, use https://stackoverflow.com/a/33030616/7505395 instead
count = eval(time)
if type(count) != int:
raise Exception()
return count
a mock for your methods context object:
class MockContext:
def __init__(self):
class User:
def __init__(self):
self.id = "mee-id"
def __str__(self):
return "mee"
class Message:
def __init__(self):
self.author = User()
self.message = Message()
self.send = print
and your changed-up method (non-async and mocked for minimal reproducible example purposes):
def reminder(ctx, time, *, reminder):
user = ctx.message.author
if not time:
ctx.send("Please, tell me WHEN you want me to remind you!")
return
elif not reminder:
ctx.send("Please, tell me WHAT you want me to remind you about!")
return
# order and 3.7+ is important - (else use the sorting one down below)
replacer = {"days":24*60*60, "hours":60*60, "minutes":60, "min":60,
"seconds":1, "sec":1, "d":24*60*60, "h":60, "m":60, "s":1}
safe_time = time # for error output we remember the original input for time
for unit in replacer: # or sorted(replacer, key=len, reverse=True) below 3.8
time = time.replace(unit, f"*{replacer[unit]}+")
time = time.rstrip("+")
try:
count = convert_timestring_to_seconds(time)
except Exception as ex:
ctx.send(f"Unable to understand the time of '{safe_time}'!", ex)
return
if count == 0:
ctx.send("You can't tell me that!")
else:
counter = format_seconds(count)
ctx.send(f"Alright, I will remind you about '{reminder}' in '{counter}'.")
import time
time.sleep(2)
ctx.send(f"Hi, <#{user.id}>, you asked me to remind you about '{reminder}' some '{counter}' ago.")
This is callable like so:
context_mock = MockContext()
reminder(context_mock, "1d5min270seconds", reminder = "abouth this")
reminder(context_mock, "1d5min270seconds", reminder = "")
reminder(context_mock, "", reminder = "")
reminder(context_mock, "buffalo", reminder = "abouth this")
and produces the following outputs:
# reminder(context_mock, "1d5min270seconds", reminder = "abouth this")
Alright, I will remind you about 'abouth this' in '1 day, 9 minutes, 30 seconds'.
<2s delay>
Hi, <#mee-id>, you asked me to remind you about 'abouth this' some '1 day, 9 minutes, 30 seconds' ago.
# reminder(context_mock, "1d5min270seconds", reminder = "")
Please, tell me WHAT you want me to remind you about!
# reminder(context_mock, "", reminder = "")
Please, tell me WHEN you want me to remind you!
# reminder(context_mock, "buffalo", reminder = "abouth this")
Unable to understand the time of 'buffalo'!
This is how I ended up fixing the issue:
async def reminder(ctx):
user = ctx.message.author
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel
#and type(msg.content) == int
await ctx.send("Oh my! Yes, tell me, what do you need to remember?")
reminder = await client.wait_for("message", check=check)
await ctx.send("Okay! When do you want me to remind you that? (d for days, h for hours, m for minutes, s for seconds)")
Time = await client.wait_for("message", check=check)
times = str(Time.content)
Times = times.split()
seconds = 0
for time in Times:
if time.lower().endswith("d"):
seconds += float(time[:-1]) * 60 * 60 * 24
counter = f"{seconds // 60 // 60 // 24} days"
if time.lower().endswith("h"):
seconds += float(time[:-1]) * 60 * 60
counter = f"{seconds // 60 // 60} hours"
if time.lower().endswith("m"):
seconds += float(time[:-1]) * 60
counter = f"{seconds // 60} minutes"
if time.lower().endswith("s"):
seconds += float(time[:-1])
counter = f"{seconds} seconds"
if seconds == 0:
await ctx.send("You can't tell me that!")
else:
await ctx.send(f"Alright, I will remind you about {reminder.content} in {times}.")
await asyncio.sleep(seconds)
await ctx.send(f"Hi, <#{user.id}>, you asked me to remind you about {reminder.content} some time ago. "
f"Don't forget about it!")
So, instead of messing with the arguments of the function, the bot will be asking the user for the reminder and the time separately.

Reminder Command Issue in discord.py

I am trying to make a discord bot reminder command, however, I am running through an issue.
When I do the command, it executes the sleep time perfectly, however, it doesn't show the reminder that I have set.
Example: When I do /reminder 5m Fix the server, it should send Alright, I will remind you about Fix the server in 5 minutes., However, it is sending this instead: Alright, I will remind you about {} in 5 minutes.
And also when I don't include the reminder argument it should send an error message, but it does nothing instead.
Here is my code:
#bot.command(case_insensitive = True, aliases = ["remind", "remindme", "remind_me"])
#commands.bot_has_permissions(attach_files = True, embed_links = True)
async def reminder(ctx, *time, **reminder):
user = ctx.message.author
embed = discord.Embed(title="Please specify a proper duration, send `reminder_help` for more information.", description="", color=0x55a7f7, timestamp=datetime.utcnow())
embed.set_footer(text="If you have any questions, suggestions or bug reports, please join our support Discord Server: link hidden", icon_url=f"{bot.user.avatar_url}")
embed2 = discord.Embed(title="Please specify what do you want me to remind you about.", description="", color=0x55a7f7, timestamp=datetime.utcnow())
embed2.set_footer(text="If you have any questions, suggestions or bug reports, please join our support Discord Server: link hidden", icon_url=f"{bot.user.avatar_url}")
embed3 = discord.Embed(title="You have specified a too long duration!\nMaximum duration is 90 days.", color=0x55a7f7, timestamp=datetime.utcnow())
embed3.set_footer(text="If you have any questions, suggestions or bug reports, please join our support Discord Server: link hidden", icon_url=f"{bot.user.avatar_url}")
embed4 = discord.Embed(title="You have specified a too short duration!\nMinimum duration is 5 minutes.", color=0x55a7f7, timestamp=datetime.utcnow())
embed4.set_footer(text="If you have any questions, suggestions or bug reports, please join our support Discord Server: link hidden", icon_url=f"{bot.user.avatar_url}")
seconds = 0
if reminder is None:
await ctx.send(embed=embed2) # Error message
return
for i in time:
if i.lower().endswith("d"):
seconds += int(i[:-1]) * 60 * 60 * 24
counter = f"{seconds//60//60//24} days"
if i.lower().endswith("h"):
seconds += int(i[:-1]) * 60 * 60
counter = f"{seconds//60//60} hours"
elif i.lower().endswith("m"):
seconds += int(i[:-1]) * 60
counter = f"{seconds//60} minutes"
elif i.lower().endswith("s"):
seconds += int(i[:-1])
counter = f"{seconds} seconds"
if seconds == 0:
await ctx.send(embed=embed) # Error message
return
elif seconds < 300:
await ctx.send(embed=embed4) # Error message
return
elif seconds > 7776000:
await ctx.send(embed=embed3) # Error message
return
else:
await ctx.send(f"Alright, I will remind you about {reminder} in {counter}.")
await asyncio.sleep(seconds)
await ctx.send(f"Hi, you asked me to remind you about {reminder} {counter} ago.")
Any help would be appreciated, thanks in advance.
I solved your question with changing a few thing"s" in your code. So here is the new code:
#client.command(case_insensitive = True, aliases = ["remind", "remindme", "remind_me"])
#commands.bot_has_permissions(attach_files = True, embed_links = True)
async def reminder(ctx, time, *, reminder):
print(time)
print(reminder)
user = ctx.message.author
embed = discord.Embed(color=0x55a7f7, timestamp=datetime.utcnow())
embed.set_footer(text="If you have any questions, suggestions or bug reports, please join our support Discord Server: link hidden", icon_url=f"{client.user.avatar_url}")
seconds = 0
if reminder is None:
embed.add_field(name='Warning', value='Please specify what do you want me to remind you about.') # Error message
if time.lower().endswith("d"):
seconds += int(time[:-1]) * 60 * 60 * 24
counter = f"{seconds // 60 // 60 // 24} days"
if time.lower().endswith("h"):
seconds += int(time[:-1]) * 60 * 60
counter = f"{seconds // 60 // 60} hours"
elif time.lower().endswith("m"):
seconds += int(time[:-1]) * 60
counter = f"{seconds // 60} minutes"
elif time.lower().endswith("s"):
seconds += int(time[:-1])
counter = f"{seconds} seconds"
if seconds == 0:
embed.add_field(name='Warning',
value='Please specify a proper duration, send `reminder_help` for more information.')
elif seconds < 300:
embed.add_field(name='Warning',
value='You have specified a too short duration!\nMinimum duration is 5 minutes.')
elif seconds > 7776000:
embed.add_field(name='Warning', value='You have specified a too long duration!\nMaximum duration is 90 days.')
else:
await ctx.send(f"Alright, I will remind you about {reminder} in {counter}.")
await asyncio.sleep(seconds)
await ctx.send(f"Hi, you asked me to remind you about {reminder} {counter} ago.")
return
await ctx.send(embed=embed)
First of all, I don't know what causes the problem but you use a for loop for no reason, it's unnecessary. Then you don't have to create embeds for 4 times, you can just use add_field. So it works now. If you still have problem, just comment.

Categories

Resources