Fix issues in remindme
This commit is contained in:
parent
393487946c
commit
e9f6021c63
1 changed files with 8 additions and 3 deletions
|
@ -25,7 +25,7 @@ from naff.models.naff.application_commands import (
|
||||||
|
|
||||||
from jarvis.utils import build_embed
|
from jarvis.utils import build_embed
|
||||||
|
|
||||||
valid = re.compile(r"[\w\s\-\\/.!@#$%^*()+=<>:,\u0080-\U000E0FFF]*")
|
valid = re.compile(r"[\w\s\-\\/.!@#$%^*()+=<>:'\",\u0080-\U000E0FFF]*")
|
||||||
time_pattern = re.compile(r"(\d+\.?\d?[s|m|h|d|w]{1})\s?", flags=re.IGNORECASE)
|
time_pattern = re.compile(r"(\d+\.?\d?[s|m|h|d|w]{1})\s?", flags=re.IGNORECASE)
|
||||||
invites = re.compile(
|
invites = re.compile(
|
||||||
r"(?:https?://)?(?:www.)?(?:discord.(?:gg|io|me|li)|discord(?:app)?.com/invite)/([^\s/]+?)(?=\b)", # noqa: E501
|
r"(?:https?://)?(?:www.)?(?:discord.(?:gg|io|me|li)|discord(?:app)?.com/invite)/([^\s/]+?)(?=\b)", # noqa: E501
|
||||||
|
@ -84,8 +84,8 @@ class RemindmeCog(Extension):
|
||||||
await ctx.send_modal(modal)
|
await ctx.send_modal(modal)
|
||||||
try:
|
try:
|
||||||
response = await self.bot.wait_for_modal(modal, author=ctx.author.id, timeout=60 * 5)
|
response = await self.bot.wait_for_modal(modal, author=ctx.author.id, timeout=60 * 5)
|
||||||
message = response.responses.get("message")
|
message = response.responses.get("message").strip()
|
||||||
delay = response.responses.get("delay")
|
delay = response.responses.get("delay").strip()
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
return
|
return
|
||||||
if len(message) > 500:
|
if len(message) > 500:
|
||||||
|
@ -100,6 +100,11 @@ class RemindmeCog(Extension):
|
||||||
elif not valid.fullmatch(message):
|
elif not valid.fullmatch(message):
|
||||||
await response.send("Hey, you should probably make this readable", ephemeral=True)
|
await response.send("Hey, you should probably make this readable", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
elif len(message) == 0:
|
||||||
|
await response.send(
|
||||||
|
"Hey, you should probably add content to your reminder", ephemeral=True
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
base_settings = {
|
base_settings = {
|
||||||
"PREFER_DATES_FROM": "future",
|
"PREFER_DATES_FROM": "future",
|
||||||
|
|
Loading…
Add table
Reference in a new issue