(Reminders): Small UI improvements.
This commit is contained in:
@@ -34,12 +34,11 @@ async def cmd_remindme(ctx, flags):
|
|||||||
Usage``:
|
Usage``:
|
||||||
{prefix}remindme in <duration> to <task>
|
{prefix}remindme in <duration> to <task>
|
||||||
{prefix}remindme every <duration> to <task>
|
{prefix}remindme every <duration> to <task>
|
||||||
|
|
||||||
{prefix}reminders
|
{prefix}reminders
|
||||||
{prefix}reminders --clear
|
{prefix}reminders --clear
|
||||||
{prefix}reminders --remove <ids>
|
{prefix}reminders --remove
|
||||||
Description:
|
Description:
|
||||||
Ask LionBot to remind you about important tasks.
|
Ask {ctx.client.user.name} to remind you about important tasks.
|
||||||
Examples``:
|
Examples``:
|
||||||
{prefix}remindme in 2h 20m, Revise chapter 1
|
{prefix}remindme in 2h 20m, Revise chapter 1
|
||||||
{prefix}remindme every hour, Drink water!
|
{prefix}remindme every hour, Drink water!
|
||||||
@@ -58,6 +57,7 @@ async def cmd_remindme(ctx, flags):
|
|||||||
|
|
||||||
live = Reminder.fetch(*(row.reminderid for row in rows))
|
live = Reminder.fetch(*(row.reminderid for row in rows))
|
||||||
|
|
||||||
|
if not ctx.args:
|
||||||
lines = []
|
lines = []
|
||||||
num_field = len(str(len(live) - 1))
|
num_field = len(str(len(live) - 1))
|
||||||
for i, reminder in enumerate(live):
|
for i, reminder in enumerate(live):
|
||||||
@@ -110,6 +110,12 @@ async def cmd_remindme(ctx, flags):
|
|||||||
live[index].reminderid
|
live[index].reminderid
|
||||||
for index in parse_ranges(message.content) if index < len(live)
|
for index in parse_ranges(message.content) if index < len(live)
|
||||||
]
|
]
|
||||||
|
else:
|
||||||
|
to_delete = [
|
||||||
|
live[index].reminderid
|
||||||
|
for index in parse_ranges(ctx.args) if index < len(live)
|
||||||
|
]
|
||||||
|
|
||||||
if not to_delete:
|
if not to_delete:
|
||||||
return await ctx.error_reply("Nothing to delete!")
|
return await ctx.error_reply("Nothing to delete!")
|
||||||
|
|
||||||
@@ -247,7 +253,10 @@ async def cmd_remindme(ctx, flags):
|
|||||||
name="{}'s reminders".format(ctx.author.display_name),
|
name="{}'s reminders".format(ctx.author.display_name),
|
||||||
icon_url=ctx.author.avatar_url
|
icon_url=ctx.author.avatar_url
|
||||||
).set_footer(
|
).set_footer(
|
||||||
text="For examples and usage see {}help reminders".format(ctx.best_prefix)
|
text=(
|
||||||
|
"Click a reminder twice to jump to the context!\n"
|
||||||
|
"For more usage and examples see {}help reminders"
|
||||||
|
).format(ctx.best_prefix)
|
||||||
)
|
)
|
||||||
|
|
||||||
await ctx.reply(embed=embed)
|
await ctx.reply(embed=embed)
|
||||||
|
|||||||
@@ -75,7 +75,19 @@ class Reminder:
|
|||||||
trunc_content = content[:50] + '...' * (len(content) > 50)
|
trunc_content = content[:50] + '...' * (len(content) > 50)
|
||||||
|
|
||||||
if self.data.interval:
|
if self.data.interval:
|
||||||
repeat = "(Every `{}`)".format(strfdur(self.data.interval))
|
interval = self.data.interval
|
||||||
|
if interval == 24 * 60 * 60:
|
||||||
|
interval_str = "day"
|
||||||
|
elif interval == 60 * 60:
|
||||||
|
interval_str = "hour"
|
||||||
|
elif interval % (24 * 60 * 60) == 0:
|
||||||
|
interval_str = "`{}` days".format(interval // (24 * 60 * 60))
|
||||||
|
elif interval % 60 * 60 == 0:
|
||||||
|
interval_str = "`{}` hours".format(interval // (60 * 60))
|
||||||
|
else:
|
||||||
|
interval_str = "`{}`".format(strfdur(interval))
|
||||||
|
|
||||||
|
repeat = "(Every {})".format(interval_str)
|
||||||
else:
|
else:
|
||||||
repeat = ""
|
repeat = ""
|
||||||
|
|
||||||
|
|||||||
@@ -253,7 +253,10 @@ def parse_ranges(ranges_str, ignore_errors=False, separator=',', **kwargs):
|
|||||||
integers = [int(item) for item in numbers if item.isdigit()]
|
integers = [int(item) for item in numbers if item.isdigit()]
|
||||||
|
|
||||||
if not ignore_errors and len(integers) != len(numbers):
|
if not ignore_errors and len(integers) != len(numbers):
|
||||||
raise SafeCancellation("Couldn't parse the provided selection!")
|
raise SafeCancellation(
|
||||||
|
"Couldn't parse the provided selection!\n"
|
||||||
|
"Please provide comma separated numbers and ranges, e.g. `1, 5, 6-9`."
|
||||||
|
)
|
||||||
|
|
||||||
return integers
|
return integers
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user