From ae1d32b485e6672bd6a676e3ffb56511e111fe5e Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 11 Jul 2021 16:27:34 -0600 Subject: [PATCH 1/8] Change lock/lockdown to affect voice channels, closes #41, closes #42 --- jarvis/cogs/admin.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/jarvis/cogs/admin.py b/jarvis/cogs/admin.py index 782c275..ee4a1e2 100644 --- a/jarvis/cogs/admin.py +++ b/jarvis/cogs/admin.py @@ -1,8 +1,9 @@ import re from datetime import datetime, timedelta +from typing import Union import pymongo -from discord import Member, Role, TextChannel, User +from discord import Member, Role, TextChannel, User, VoiceChannel from discord.ext import commands from discord.utils import find, get from discord_slash import SlashContext, cog_ext @@ -556,24 +557,30 @@ class AdminCog(commands.Cog): async def _lock_channel( self, - channel: TextChannel, + channel: Union[TextChannel, VoiceChannel], role: Role, admin: User, reason: str, allow_send=False, ): overrides = channel.overwrites_for(role) - overrides.send_messages = allow_send + if isinstance(channel, TextChannel): + overrides.send_messages = allow_send + elif isinstance(channel, VoiceChannel): + overrides.speak = allow_send await channel.set_permissions(role, overwrite=overrides, reason=reason) async def _unlock_channel( self, - channel: TextChannel, + channel: Union[TextChannel, VoiceChannel], role: Role, admin: User, ): overrides = channel.overwrites_for(role) - overrides.send_messages = None + if isinstance(channel, TextChannel): + overrides.send_messages = None + elif isinstance(channel, VoiceChannel): + overrides.speak = None await channel.set_permissions(role, overwrite=overrides) @cog_ext.cog_slash( @@ -607,7 +614,7 @@ class AdminCog(commands.Cog): ctx: SlashContext, reason: str, duration: int = 10, - channel: TextChannel = None, + channel: Union[TextChannel, VoiceChannel] = None, ): await ctx.defer() if not channel: @@ -647,7 +654,7 @@ class AdminCog(commands.Cog): async def _unlock( self, ctx: SlashContext, - channel: TextChannel = None, + channel: Union[TextChannel, VoiceChannel] = None, ): await ctx.defer() if not channel: From 7ffbc3eba5c6da93687942d889f7333c6d131625 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 11 Jul 2021 16:33:11 -0600 Subject: [PATCH 2/8] Limit titles in JokeCog to 256, pushes anything past that into description, closes #35 --- jarvis/cogs/jokes.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/jarvis/cogs/jokes.py b/jarvis/cogs/jokes.py index e448756..1c8c94e 100644 --- a/jarvis/cogs/jokes.py +++ b/jarvis/cogs/jokes.py @@ -84,6 +84,21 @@ class JokeCog(commands.Cog): else: body += " " + word + desc = "" + title = result["title"] + if len(title) > 256: + new_title = "" + limit = False + for word in title.split(" "): + if len(new_title) + len(word) + 1 > 253 and not limit: + new_title += "..." + desc = "..." + limit = True + if not limit: + new_title += word + " " + else: + desc += word + " " + body_chunks.append(Field("​", body, False)) fields = body_chunks @@ -94,8 +109,8 @@ class JokeCog(commands.Cog): # ), fields.append(Field("ID", result["id"])) embed = build_embed( - title=result["title"], - description="", + title=title, + description=desc, fields=fields, url=f"https://reddit.com/r/jokes/comments/{result['id']}", timestamp=datetime.fromtimestamp(result["created_utc"]), From 8a7a2a63fff7ac4c72be5d339e2cbebbf6cbdcdc Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 11 Jul 2021 16:51:31 -0600 Subject: [PATCH 3/8] Add autopurge command --- jarvis/__init__.py | 5 ++ jarvis/cogs/admin.py | 107 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) diff --git a/jarvis/__init__.py b/jarvis/__init__.py index 7c4cddc..dea4964 100644 --- a/jarvis/__init__.py +++ b/jarvis/__init__.py @@ -159,6 +159,11 @@ async def on_message(message: Message): text=f"{message.author.name}#{message.author.discriminator} | {message.author.id}" ) await message.channel.send(embed=embed) + autopurge = db.jarvis.autopurge.find_one( + {"guild": message.guild.id, "channel": message.channel.id} + ) + if autopurge: + await message.delete(delay=autopurge["delay"]) await jarvis.process_commands(message) diff --git a/jarvis/cogs/admin.py b/jarvis/cogs/admin.py index ee4a1e2..4aa34d5 100644 --- a/jarvis/cogs/admin.py +++ b/jarvis/cogs/admin.py @@ -890,6 +890,7 @@ class AdminCog(commands.Cog): ) ], ) + @commands.has_permissions(administrator=True) async def _roleping_block(self, ctx: SlashContext, role: Role): roles = self.db.jarvis.settings.find_one( {"guild": ctx.guild.id, "setting": "roleping"} @@ -922,6 +923,7 @@ class AdminCog(commands.Cog): ) ], ) + @commands.has_permissions(administrator=True) async def _roleping_allow(self, ctx: SlashContext, role: Role): roles = self.db.jarvis.settings.find_one( {"guild": ctx.guild.id, "setting": "roleping"} @@ -941,6 +943,111 @@ class AdminCog(commands.Cog): ) await ctx.send(f"Role `{role.name}` removed blocklist.") + @cog_ext.cog_subcommand( + base="autopurge", + name="add", + description="Automatically purge messages after x seconds", + guild_ids=[418094694325813248, 578757004059738142, 862402786116763668], + options=[ + create_option( + name="channel", + description="Channel to autopurge", + option_type=7, + required=True, + ), + create_option( + name="delay", + description="Seconds to keep message before purge, default 30", + option_type=4, + required=False, + ), + ], + ) + @admin_or_permissions(manage_messages=True) + async def _autopurge_add( + self, ctx: SlashContext, channel: TextChannel, delay: int = 30 + ): + autopurge = self.db.jarvis.autopurge.find( + {"guild": ctx.guild.id, "channel": channel.id} + ) + if autopurge: + await ctx.send("Autopurge already exists.") + return + autopurge = { + "guild": ctx.guild.id, + "channel": channel.id, + "admin": ctx.author.id, + "delay": delay, + "time": datetime.utcnow(), + } + self.db.jarvis.autopurge.insert_one(autopurge) + await ctx.send( + f"Autopurge set up on {channel.mention}, " + + f"delay is {delay} seconds" + ) + + @cog_ext.cog_subcommand( + base="autopurge", + name="remove", + description="Remove an autopurge", + guild_ids=[418094694325813248, 578757004059738142, 862402786116763668], + options=[ + create_option( + name="channel", + description="Channel to remove from autopurge", + option_type=7, + required=True, + ), + ], + ) + @admin_or_permissions(manage_messages=True) + async def _autopurge_remove(self, ctx: SlashContext, channel: TextChannel): + autopurge = self.db.jarvis.autopurge.find( + {"guild": ctx.guild.id, "channel": channel.id} + ) + if not autopurge: + await ctx.send("Autopurge does not exist.") + return + self.db.jarvis.autopurge.delete_one({"_id": autopurge["_id"]}) + await ctx.send(f"Autopurge removed from {channel.mention}.") + + @cog_ext.cog_subcommand( + base="autopurge", + name="update", + description="Update autopurge on a channel", + guild_ids=[418094694325813248, 578757004059738142, 862402786116763668], + options=[ + create_option( + name="channel", + description="Channel to update", + option_type=7, + required=True, + ), + create_option( + name="delay", + description="New time to save", + option_type=4, + required=True, + ), + ], + ) + @admin_or_permissions(manage_messages=True) + async def _autopurge_update( + self, ctx: SlashContext, channel: TextChannel, delay: int + ): + autopurge = self.db.jarvis.autopurge.find( + {"guild": ctx.guild.id, "channel": channel.id} + ) + if not autopurge: + await ctx.send("Autopurge does not exist.") + return + self.db.jarvis.autopurge.update_one( + {"_id": autopurge["_id"]}, {"$set": {"delay": delay}} + ) + await ctx.send( + f"Autopurge delay updated to {delay} seconds on {channel.mention}." + ) + def setup(bot): bot.add_cog(AdminCog(bot)) From 8eaba5899263ec291b8c131dbc80e5e8b9135939 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 11 Jul 2021 16:54:07 -0600 Subject: [PATCH 4/8] Limit autoreact to TextChannels, closes #40 --- jarvis/cogs/autoreact.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jarvis/cogs/autoreact.py b/jarvis/cogs/autoreact.py index 6e6ad6c..1e1f431 100644 --- a/jarvis/cogs/autoreact.py +++ b/jarvis/cogs/autoreact.py @@ -4,7 +4,7 @@ from datetime import datetime from discord import TextChannel from discord.ext import commands from discord.utils import find -from discord_slash import cog_ext +from discord_slash import SlashContext, cog_ext from discord_slash.utils.manage_commands import create_option import jarvis @@ -35,7 +35,10 @@ class AutoReactCog(commands.Cog): ], ) @commands.has_permissions(administrator=True) - async def _autoreact_create(self, ctx, channel: TextChannel): + async def _autoreact_create(self, ctx: SlashContext, channel: TextChannel): + if not isinstance(channel, TextChannel): + await ctx.send("Channel must be a text channel", hidden=True) + return exists = self.db.jarvis.autoreact.find_one( {"guild": ctx.guild.id, "channel": channel.id} ) From 1e0056f339bf7e5c5e43462464c9d3729dc947a8 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 11 Jul 2021 17:02:33 -0600 Subject: [PATCH 5/8] Make error replies hidden --- jarvis/cogs/admin.py | 48 +++++++++++++++++++++++----------------- jarvis/cogs/autoreact.py | 34 +++++++++++++++++++--------- jarvis/cogs/ctc2.py | 2 +- jarvis/cogs/dbrand.py | 2 +- jarvis/cogs/dev.py | 17 +++++++++----- jarvis/cogs/jokes.py | 4 +++- jarvis/cogs/starboard.py | 21 +++++++++++++----- jarvis/cogs/util.py | 4 ++-- 8 files changed, 84 insertions(+), 48 deletions(-) diff --git a/jarvis/cogs/admin.py b/jarvis/cogs/admin.py index 4aa34d5..8d44ebb 100644 --- a/jarvis/cogs/admin.py +++ b/jarvis/cogs/admin.py @@ -74,13 +74,15 @@ class AdminCog(commands.Cog): length: int = 4, ): if not user or user == ctx.author: - await ctx.send("You cannot ban yourself.") + await ctx.send("You cannot ban yourself.", hidden=True) return if user == self.bot.user: - await ctx.send("I'm afraid I can't let you do that") + await ctx.send("I'm afraid I can't let you do that", hidden=True) return if type == "temp" and length < 0: - await ctx.send("You cannot set a temp ban to < 0 hours.") + await ctx.send( + "You cannot set a temp ban to < 0 hours.", hidden=True + ) return if not reason: reason = ( @@ -374,10 +376,10 @@ class AdminCog(commands.Cog): @admin_or_permissions(kick_members=True) async def _kick(self, ctx: SlashContext, user: User, reason=None): if not user or user == ctx.author: - await ctx.send("You cannot kick yourself.") + await ctx.send("You cannot kick yourself.", hidden=True) return if user == self.bot.user: - await ctx.send("I'm afraid I can't let you do that") + await ctx.send("I'm afraid I can't let you do that", hidden=True) return if not reason: reason = ( @@ -421,7 +423,7 @@ class AdminCog(commands.Cog): @admin_or_permissions(manage_messages=True) async def _purge(self, ctx: SlashContext, amount: int = 10): if amount < 1: - await ctx.send("Amount must be >= 1") + await ctx.send("Amount must be >= 1", hidden=True) return await ctx.defer() channel = ctx.channel @@ -470,17 +472,18 @@ class AdminCog(commands.Cog): ): await ctx.defer() if user == ctx.author: - await ctx.send("You cannot mute yourself.") + await ctx.send("You cannot mute yourself.", hidden=True) return if user == self.bot.user: - await ctx.send("I'm afraid I can't let you do that") + await ctx.send("I'm afraid I can't let you do that", hidden=True) return mute_setting = self.db.jarvis.settings.find_one( {"guild": ctx.guild.id, "setting": "mute"} ) if not mute_setting: await ctx.send( - "Please configure a mute role with /settings mute first" + "Please configure a mute role with /settings mute first", + hidden=True, ) return role = get(ctx.guild.roles, id=mute_setting["value"]) @@ -535,7 +538,8 @@ class AdminCog(commands.Cog): if not mute_setting: await ctx.send( "Please configure a mute role with " - + "/settings mute first." + + "/settings mute first.", + hidden=True, ) return @@ -543,7 +547,7 @@ class AdminCog(commands.Cog): if role in user.roles: await user.remove_roles(role, reason="Unmute") else: - await ctx.send("User is not muted.") + await ctx.send("User is not muted.", hidden=True) return self.db.jarvis.mutes.update_many( @@ -663,7 +667,7 @@ class AdminCog(commands.Cog): {"guild": ctx.guild.id, "channel": channel.id, "active": True} ) if not lock: - await ctx.send(f"{channel.mention} not locked.") + await ctx.send(f"{channel.mention} not locked.", hidden=True) return for role in ctx.guild.roles: try: @@ -752,7 +756,7 @@ class AdminCog(commands.Cog): self.db.jarvis.locks.find({"guild": ctx.guild.id, "active": True}) ) if not locks: - await ctx.send("No lockdown detected.") + await ctx.send("No lockdown detected.", hidden=True) return for channel in channels: for role in roles: @@ -772,7 +776,7 @@ class AdminCog(commands.Cog): ) if updates: self.db.jarvis.locks.bulk_write(updates) - await ctx.send(f"Server unlocked") + await ctx.send("Server unlocked") @cog_ext.cog_slash( name="warn", @@ -899,7 +903,9 @@ class AdminCog(commands.Cog): roles = {"guild": ctx.guild.id, "setting": "roleping", "value": []} if role.id in roles["value"]: - await ctx.send(f"Role `{role.name}` already in blocklist.") + await ctx.send( + f"Role `{role.name}` already in blocklist.", hidden=True + ) return roles["value"].append(role.id) self.db.jarvis.settings.update_one( @@ -929,11 +935,13 @@ class AdminCog(commands.Cog): {"guild": ctx.guild.id, "setting": "roleping"} ) if not roles: - await ctx.send("No blocklist configured.") + await ctx.send("No blocklist configured.", hidden=True) return if role.id not in roles["value"]: - await ctx.send(f"Role `{role.name}` not in blocklist.") + await ctx.send( + f"Role `{role.name}` not in blocklist.", hidden=True + ) return roles["value"].delete(role.id) self.db.jarvis.settings.update_one( @@ -971,7 +979,7 @@ class AdminCog(commands.Cog): {"guild": ctx.guild.id, "channel": channel.id} ) if autopurge: - await ctx.send("Autopurge already exists.") + await ctx.send("Autopurge already exists.", hidden=True) return autopurge = { "guild": ctx.guild.id, @@ -1006,7 +1014,7 @@ class AdminCog(commands.Cog): {"guild": ctx.guild.id, "channel": channel.id} ) if not autopurge: - await ctx.send("Autopurge does not exist.") + await ctx.send("Autopurge does not exist.", hidden=True) return self.db.jarvis.autopurge.delete_one({"_id": autopurge["_id"]}) await ctx.send(f"Autopurge removed from {channel.mention}.") @@ -1039,7 +1047,7 @@ class AdminCog(commands.Cog): {"guild": ctx.guild.id, "channel": channel.id} ) if not autopurge: - await ctx.send("Autopurge does not exist.") + await ctx.send("Autopurge does not exist.", hidden=True) return self.db.jarvis.autopurge.update_one( {"_id": autopurge["_id"]}, {"$set": {"delay": delay}} diff --git a/jarvis/cogs/autoreact.py b/jarvis/cogs/autoreact.py index 1e1f431..a2d49db 100644 --- a/jarvis/cogs/autoreact.py +++ b/jarvis/cogs/autoreact.py @@ -43,7 +43,9 @@ class AutoReactCog(commands.Cog): {"guild": ctx.guild.id, "channel": channel.id} ) if exists: - await ctx.send(f"Autoreact already exists for {channel.mention}.") + await ctx.send( + f"Autoreact already exists for {channel.mention}.", hidden=True + ) return autoreact = { @@ -75,9 +77,11 @@ class AutoReactCog(commands.Cog): {"guild": channel.guild.id, "channel": channel.id} ) if exists: - await ctx.send(f"Autoreact remove from {channel.mention}") + await ctx.send(f"Autoreact removed from {channel.mention}") else: - await ctx.send(f"Autoreact not found on {channel.mention}") + await ctx.send( + f"Autoreact not found on {channel.mention}", hidden=True + ) @cog_ext.cog_subcommand( base="autoreact", @@ -107,13 +111,16 @@ class AutoReactCog(commands.Cog): if not custom_emoji and not standard_emoji: await ctx.send( "Please use either an emote from this server" - + " or a unicode emoji." + + " or a unicode emoji.", + hidden=True, ) return if custom_emoji: emoji_id = int(custom_emoji.group(1)) if not find(lambda x: x.id == emoji_id, ctx.guild.emojis): - await ctx.send("Please use a custom emote from this server.") + await ctx.send( + "Please use a custom emote from this server.", hidden=True + ) return exists = self.db.jarvis.autoreact.find_one( {"guild": ctx.guild.id, "channel": channel.id} @@ -126,12 +133,14 @@ class AutoReactCog(commands.Cog): return if emote in exists["reactions"]: await ctx.send( - f"Emote already added to {channel.mention} autoreactions." + f"Emote already added to {channel.mention} autoreactions.", + hidden=True, ) return - if len(exists["reactions"]) >= 20: + if len(exists["reactions"]) >= 5: await ctx.send( - "Max number of reactions hit. Remove a different one to add this one" + "Max number of reactions hit. Remove a different one to add this one", + hidden=True, ) return exists["reactions"].append(emote) @@ -169,12 +178,14 @@ class AutoReactCog(commands.Cog): if not exists: await ctx.send( "Please create autoreact first with " - + f"/autoreact create {channel.mention}" + + f"/autoreact create {channel.mention}", + hidden=True, ) return if emote not in exists["reactions"]: await ctx.send( - f"{emote} not used in {channel.mention} autoreactions." + f"{emote} not used in {channel.mention} autoreactions.", + hidden=True, ) return exists["reactions"].remove(emote) @@ -206,7 +217,8 @@ class AutoReactCog(commands.Cog): if not exists: await ctx.send( "Please create autoreact first with " - + f"/autoreact create {channel.mention}" + + f"/autoreact create {channel.mention}", + hidden=True, ) return message = "" diff --git a/jarvis/cogs/ctc2.py b/jarvis/cogs/ctc2.py index 185813b..5c5729f 100644 --- a/jarvis/cogs/ctc2.py +++ b/jarvis/cogs/ctc2.py @@ -33,7 +33,7 @@ class CTCCog(commands.Cog): async def _pw(self, ctx, guess: str): guessed = self.db.ctc2.guesses.find_one({"guess": guess}) if guessed: - await ctx.send("Already guessed, dipshit.") + await ctx.send("Already guessed, dipshit.", hidden=True) return result = await self._session.post(self.url, data=guess) message = "" diff --git a/jarvis/cogs/dbrand.py b/jarvis/cogs/dbrand.py index ecafc12..12b8317 100644 --- a/jarvis/cogs/dbrand.py +++ b/jarvis/cogs/dbrand.py @@ -118,7 +118,7 @@ class DbrandCog(commands.Cog): guild_ids=[862402786116763668, 578757004059738142], description="(not)extortion", ) - async def _buy(self, ctx): + async def _extort(self, ctx): await ctx.send( "Be (not)extorted here: " + self.base_url + "not-extortion" ) diff --git a/jarvis/cogs/dev.py b/jarvis/cogs/dev.py index 7729089..37d6d86 100644 --- a/jarvis/cogs/dev.py +++ b/jarvis/cogs/dev.py @@ -76,7 +76,8 @@ class DevCog(commands.Cog): if method not in supported_hashes: algo_txt = ", ".join(f"`{x}`" for x in supported_hashes) await ctx.send( - "Unsupported hash algorithm. Supported:\n" + algo_txt + "Unsupported hash algorithm. Supported:\n" + algo_txt, + hidden=True, ) return if not data and len(ctx.message.attachments) == 0: @@ -119,14 +120,14 @@ class DevCog(commands.Cog): async def _uuid(self, ctx, version: str = None, data: str = None): if not version: - await ctx.send("Supported UUID versions: 3, 4, 5") + await ctx.send("Supported UUID versions: 3, 4, 5", hidden=True) return if version not in ["3", "4", "5"]: - await ctx.send("Supported UUID versions: 3, 4, 5") + await ctx.send("Supported UUID versions: 3, 4, 5", hidden=True) return version = int(version) if version in [3, 5] and not data: - await ctx.send(f"UUID{version} requires data.") + await ctx.send(f"UUID{version} requires data.", hidden=True) return if version == 4: await ctx.send(f"UUID4: `{uuid.uuid4()}`") @@ -233,7 +234,9 @@ class DevCog(commands.Cog): if method not in self.base64_methods: methods = ", ".join(f"`{x}`" for x in self.base64_methods) await ctx.send( - "Usage: encode \nSupported methods:\n" + methods + "Usage: encode \nSupported methods:\n" + + methods, + hidden=True, ) return method = getattr(base64, method + "encode") @@ -256,7 +259,9 @@ class DevCog(commands.Cog): if method not in self.base64_methods: methods = ", ".join(f"`{x}`" for x in self.base64_methods) await ctx.send( - "Usage: decode \nSupported methods:\n" + methods + "Usage: decode \nSupported methods:\n" + + methods, + hidden=True, ) return method = getattr(base64, method + "decode") diff --git a/jarvis/cogs/jokes.py b/jarvis/cogs/jokes.py index 1c8c94e..409bb3b 100644 --- a/jarvis/cogs/jokes.py +++ b/jarvis/cogs/jokes.py @@ -58,7 +58,9 @@ class JokeCog(commands.Cog): )[0] if result is None: - await ctx.send("Humor module failed. Please try again later.") + await ctx.send( + "Humor module failed. Please try again later.", hidden=True + ) return emotes = re.findall(r"(&#x[a-fA-F0-9]*;)", result["body"]) for match in emotes: diff --git a/jarvis/cogs/starboard.py b/jarvis/cogs/starboard.py index 1b61d65..325ef15 100644 --- a/jarvis/cogs/starboard.py +++ b/jarvis/cogs/starboard.py @@ -66,14 +66,17 @@ class StarboardCog(commands.Cog): async def _create(self, ctx, target: TextChannel): if target not in ctx.guild.channels: await ctx.send( - "Target channel not in guild. Choose an existing channel." + "Target channel not in guild. Choose an existing channel.", + hidden=True, ) return exists = self.db.jarvis.starboard.find_one( {"target": target.id, "guild": ctx.guild.id} ) if exists: - await ctx.send(f"Starboard already exists at {target.mention}.") + await ctx.send( + f"Starboard already exists at {target.mention}.", hidden=True + ) return self.db.jarvis.starboard.insert_one( @@ -110,9 +113,13 @@ class StarboardCog(commands.Cog): ) if deleted: self.db.jarvis.stars.delete_many({"starboard": target.id}) - await ctx.send(f"Starboard deleted from {target.mention}.") + await ctx.send( + f"Starboard deleted from {target.mention}.", hidden=True + ) else: - await ctx.send(f"Starboard not found in {target.mention}.") + await ctx.send( + f"Starboard not found in {target.mention}.", hidden=True + ) @cog_ext.cog_subcommand( base="star", @@ -157,7 +164,8 @@ class StarboardCog(commands.Cog): if not exists: await ctx.send( f"Starboard does not exist in {starboard.mention}. " - + "Please create it first" + + "Please create it first", + hidden=True, ) return @@ -174,7 +182,8 @@ class StarboardCog(commands.Cog): if exists: await ctx.send( - f"Message already sent to Starboard {starboard.mention}" + f"Message already sent to Starboard {starboard.mention}", + hidden=True, ) return diff --git a/jarvis/cogs/util.py b/jarvis/cogs/util.py index 2888dbe..89e1631 100644 --- a/jarvis/cogs/util.py +++ b/jarvis/cogs/util.py @@ -73,7 +73,7 @@ class UtilCog(commands.Cog): async def _rcauto(self, ctx: SlashContext, text: str): to_send = "" if len(text) == 1 and not re.match(r"^[A-Z0-9-()$@!?^'#. ]$", text): - await ctx.send("Please use ASCII characters.") + await ctx.send("Please use ASCII characters.", hidden=True) return for letter in text.upper(): if letter == " ": @@ -85,7 +85,7 @@ class UtilCog(commands.Cog): else: to_send += f"<:{names[id]}:{id}>" if len(to_send) > 2000: - await ctx.send("Too long.") + await ctx.send("Too long.", hidden=True) else: await ctx.send(to_send) From 23aa336ad57a0833ebc9c77eddabd673e1033316 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 11 Jul 2021 17:06:54 -0600 Subject: [PATCH 6/8] Remove useless edits from modlog, references #43 --- jarvis/cogs/modlog.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jarvis/cogs/modlog.py b/jarvis/cogs/modlog.py index 696cc33..9ac3209 100644 --- a/jarvis/cogs/modlog.py +++ b/jarvis/cogs/modlog.py @@ -358,6 +358,8 @@ class ModlogCog(commands.Cog): {"guild": after.guild.id, "setting": "modlog"} ) if modlog: + if before.content == after.content: + return channel = before.guild.get_channel(modlog["value"]) fields = [ Field( From 126916837f1381c7188d647b18498568a4c72c69 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 11 Jul 2021 17:11:15 -0600 Subject: [PATCH 7/8] Also reference kwargs for modlog command invoke, closes #43 --- jarvis/cogs/modlog.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/jarvis/cogs/modlog.py b/jarvis/cogs/modlog.py index 9ac3209..8af9b0d 100644 --- a/jarvis/cogs/modlog.py +++ b/jarvis/cogs/modlog.py @@ -427,12 +427,26 @@ class ModlogCog(commands.Cog): channel = ctx.guild.get_channel(modlog["value"]) fields = [ Field("Command", ctx.name), - Field( - "Args", - " ".join(ctx.args) if ctx.args else "N/A", - False, - ), ] + if ctx.args: + fields.append( + Field( + "Args", + " ".join(ctx.args), + False, + ) + ) + if ctx.kwargs: + kwargs_string = " ".join( + f"{k}: {ctx.kwargs[k]}" for k in ctx.kwargs + ) + fields.append( + Field( + "Keyword Args", + kwargs_string, + False, + ) + ) if ctx.subcommand_name: fields.insert(1, Field("Subcommand", ctx.subcommand_name)) embed = build_embed( From 7774e6541bd03dbbe492dba48926c149044c4a2a Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 11 Jul 2021 17:13:51 -0600 Subject: [PATCH 8/8] Clarify if bans are active on bans list, closes #39 --- jarvis/cogs/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jarvis/cogs/admin.py b/jarvis/cogs/admin.py index 8d44ebb..618660f 100644 --- a/jarvis/cogs/admin.py +++ b/jarvis/cogs/admin.py @@ -351,7 +351,8 @@ class AdminCog(commands.Cog): if len(ban_messages) == 0: message = "No bans matched the criteria." else: - message = "Bans:\n```\n" + "\n".join(ban_messages) + "\n```" + message = "Active " if active else "Inactive " + message += "Bans:\n```\n" + "\n".join(ban_messages) + "\n```" await ctx.send(message) @cog_ext.cog_slash(