Fix pre-commit messages
This commit is contained in:
commit
57e1da932b
3 changed files with 16 additions and 11 deletions
|
@ -24,7 +24,7 @@ from jarvis.utils import build_embed
|
||||||
from jarvis.utils.cogs import ModcaseCog
|
from jarvis.utils.cogs import ModcaseCog
|
||||||
from jarvis.utils.permissions import admin_or_permissions
|
from jarvis.utils.permissions import admin_or_permissions
|
||||||
|
|
||||||
time_pattern = re.compile(r"(\d+\.?\d+?[s|m|h|d|w]{1})\s?", re.I)
|
time_pattern = re.compile(r"(\d+\.?(?:\d+)?[smhdw])\s?", re.I)
|
||||||
|
|
||||||
|
|
||||||
class BanCog(ModcaseCog):
|
class BanCog(ModcaseCog):
|
||||||
|
@ -128,10 +128,10 @@ class BanCog(ModcaseCog):
|
||||||
if btype == "temp" and duration < 0:
|
if btype == "temp" and duration < 0:
|
||||||
await ctx.send("You cannot set a temp ban to < 0 hours.", ephemeral=True)
|
await ctx.send("You cannot set a temp ban to < 0 hours.", ephemeral=True)
|
||||||
return
|
return
|
||||||
elif btype == "temp" and duration > 744:
|
if btype == "temp" and duration > 744:
|
||||||
await ctx.send("You cannot set a temp ban to > 1 month", ephemeral=True)
|
await ctx.send("You cannot set a temp ban to > 1 month", ephemeral=True)
|
||||||
return
|
return
|
||||||
if not time_pattern.match(delete_history):
|
if delete_history and not time_pattern.match(delete_history):
|
||||||
await ctx.send("Invalid time string, please follow example: 1w 3d 7h 5m 20s", ephemeral=True)
|
await ctx.send("Invalid time string, please follow example: 1w 3d 7h 5m 20s", ephemeral=True)
|
||||||
return
|
return
|
||||||
if len(reason) > 100:
|
if len(reason) > 100:
|
||||||
|
@ -146,11 +146,11 @@ class BanCog(ModcaseCog):
|
||||||
if times := time_pattern.findall(delete_history):
|
if times := time_pattern.findall(delete_history):
|
||||||
for t in times:
|
for t in times:
|
||||||
delta[units[t[-1]]] += float(t[:-1])
|
delta[units[t[-1]]] += float(t[:-1])
|
||||||
delete_history = int(timedelta(**delta).total_seconds)
|
delete_history = int(timedelta(**delta).total_seconds())
|
||||||
|
|
||||||
if delete_history > 604800:
|
if delete_history > 604800:
|
||||||
await ctx.send("Delete history cannot be greater than 7 days (604800 seconds)", ephemeral=True)
|
await ctx.send("Delete history cannot be greater than 7 days (604800 seconds)", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
|
|
||||||
|
@ -179,6 +179,10 @@ class BanCog(ModcaseCog):
|
||||||
dm=True,
|
dm=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
active = True
|
||||||
|
if btype == "soft":
|
||||||
|
active = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await user.send(embed=user_embed)
|
await user.send(embed=user_embed)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -237,8 +241,7 @@ class BanCog(ModcaseCog):
|
||||||
message = "More than one result. " f"Please use one of the following IDs:\n```{ab_message}\n```"
|
message = "More than one result. " f"Please use one of the following IDs:\n```{ab_message}\n```"
|
||||||
await ctx.send(message)
|
await ctx.send(message)
|
||||||
return
|
return
|
||||||
else:
|
discord_ban_info = results[0]
|
||||||
discord_ban_info = results[0]
|
|
||||||
|
|
||||||
# If we don't have the ban information in Discord,
|
# If we don't have the ban information in Discord,
|
||||||
# try to find the relevant information in the database.
|
# try to find the relevant information in the database.
|
||||||
|
|
|
@ -57,14 +57,14 @@ class RedditCog(Extension):
|
||||||
Args:
|
Args:
|
||||||
post: Post to build embeds
|
post: Post to build embeds
|
||||||
"""
|
"""
|
||||||
url = "https://reddit.com" + post.permalink
|
url = f"https://redd.it/{post.id}"
|
||||||
await post.author.load()
|
await post.author.load()
|
||||||
author_url = f"https://reddit.com/u/{post.author.name}"
|
author_url = f"https://reddit.com/u/{post.author.name}"
|
||||||
author_icon = post.author.icon_img
|
author_icon = post.author.icon_img
|
||||||
images = []
|
images = []
|
||||||
title = post.title
|
title = post.title
|
||||||
if len(title) > 256:
|
if len(title) > 256:
|
||||||
title = title[253] + "..."
|
title = title[:253] + "..."
|
||||||
fields = []
|
fields = []
|
||||||
content = ""
|
content = ""
|
||||||
og_post = None
|
og_post = None
|
||||||
|
|
|
@ -63,6 +63,8 @@ class UtilCog(Extension):
|
||||||
)
|
)
|
||||||
elif ctx.author.id == 215564028615852033:
|
elif ctx.author.id == 215564028615852033:
|
||||||
await ctx.send("As flattered as I am, I'm not into bestiality")
|
await ctx.send("As flattered as I am, I'm not into bestiality")
|
||||||
|
elif ctx.author.id == 256110768724901889:
|
||||||
|
await ctx.send("Haven't you broken me enough already?")
|
||||||
else:
|
else:
|
||||||
await ctx.send("Not at this time, thank you for offering")
|
await ctx.send("Not at this time, thank you for offering")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue