Fix pre-commit messages

This commit is contained in:
Zeva Rose 2023-01-13 23:36:06 -07:00
commit 57e1da932b
3 changed files with 16 additions and 11 deletions

View file

@ -24,7 +24,7 @@ from jarvis.utils import build_embed
from jarvis.utils.cogs import ModcaseCog
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):
@ -128,10 +128,10 @@ class BanCog(ModcaseCog):
if btype == "temp" and duration < 0:
await ctx.send("You cannot set a temp ban to < 0 hours.", ephemeral=True)
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)
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)
return
if len(reason) > 100:
@ -146,11 +146,11 @@ class BanCog(ModcaseCog):
if times := time_pattern.findall(delete_history):
for t in times:
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:
await ctx.send("Delete history cannot be greater than 7 days (604800 seconds)", ephemeral=True)
return
if delete_history > 604800:
await ctx.send("Delete history cannot be greater than 7 days (604800 seconds)", ephemeral=True)
return
await ctx.defer()
@ -179,6 +179,10 @@ class BanCog(ModcaseCog):
dm=True,
)
active = True
if btype == "soft":
active = False
try:
await user.send(embed=user_embed)
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```"
await ctx.send(message)
return
else:
discord_ban_info = results[0]
discord_ban_info = results[0]
# If we don't have the ban information in Discord,
# try to find the relevant information in the database.

View file

@ -57,14 +57,14 @@ class RedditCog(Extension):
Args:
post: Post to build embeds
"""
url = "https://reddit.com" + post.permalink
url = f"https://redd.it/{post.id}"
await post.author.load()
author_url = f"https://reddit.com/u/{post.author.name}"
author_icon = post.author.icon_img
images = []
title = post.title
if len(title) > 256:
title = title[253] + "..."
title = title[:253] + "..."
fields = []
content = ""
og_post = None

View file

@ -63,6 +63,8 @@ class UtilCog(Extension):
)
elif ctx.author.id == 215564028615852033:
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:
await ctx.send("Not at this time, thank you for offering")