diff --git a/jarvis/cogs/admin/ban.py b/jarvis/cogs/admin/ban.py index 455876b..d97382c 100644 --- a/jarvis/cogs/admin/ban.py +++ b/jarvis/cogs/admin/ban.py @@ -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): @@ -131,7 +131,7 @@ class BanCog(ModcaseCog): elif 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() @@ -173,6 +173,10 @@ class BanCog(ModcaseCog): dm=True, ) + active = True + if btype == "soft": + active = False + try: await user.send(embed=user_embed) except Exception: @@ -188,9 +192,6 @@ class BanCog(ModcaseCog): if btype != "temp": duration = None - active = True - if btype == "soft": - active = False @slash_command(name="unban", description="Unban a user") @slash_option(name="user", description="User to unban", opt_type=OptionTypes.STRING, required=True) diff --git a/jarvis/cogs/reddit.py b/jarvis/cogs/reddit.py index a6f3d40..399ae69 100644 --- a/jarvis/cogs/reddit.py +++ b/jarvis/cogs/reddit.py @@ -64,7 +64,7 @@ class RedditCog(Extension): images = [] title = post.title if len(title) > 256: - title = title[253] + "..." + title = title[:253] + "..." fields = [] content = "" og_post = None diff --git a/jarvis/cogs/util.py b/jarvis/cogs/util.py index 4a18dd9..dce6da3 100644 --- a/jarvis/cogs/util.py +++ b/jarvis/cogs/util.py @@ -60,6 +60,8 @@ class UtilCog(Extension): await ctx.send("https://tenor.com/view/fluffy-gabriel-iglesias-you-need-jesus-thats-what-you-need-pointing-up-gif-16385108") 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")