From df82e6268d395fc52e1bcddb5317405d591b3bf0 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Tue, 5 Feb 2019 01:54:40 +0300 Subject: [PATCH] Add a new type of log channels: modlog --- cogs/lockdown.py | 4 ++-- cogs/logs.py | 4 ++-- cogs/mod.py | 20 ++++++++++---------- cogs/mod_reacts.py | 4 ++-- cogs/mod_userlog.py | 8 ++++---- cogs/verification.py | 2 +- config_template.py | 1 + 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/cogs/lockdown.py b/cogs/lockdown.py index 8bade64..798ed5e 100644 --- a/cogs/lockdown.py +++ b/cogs/lockdown.py @@ -27,7 +27,7 @@ class Lockdown: Defaults to current channel.""" if not channel: channel = ctx.channel - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) if channel.id in config.community_channels: roles = [config.named_roles["community"], @@ -61,7 +61,7 @@ class Lockdown: """Unlocks speaking in current channel, staff only.""" if not channel: channel = ctx.channel - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) if ctx.channel.id in config.community_channels: roles = [config.named_roles["community"], diff --git a/cogs/logs.py b/cogs/logs.py index 0bb149b..8e38c7c 100644 --- a/cogs/logs.py +++ b/cogs/logs.py @@ -101,7 +101,7 @@ class Logs: async def on_member_ban(self, guild, member): await self.bot.wait_until_ready() - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) msg = f"ā›” **Ban**: {member.mention} | "\ f"{self.bot.escape_message(member)}\n"\ f"šŸ· __User ID__: {member.id}" @@ -109,7 +109,7 @@ class Logs: async def on_member_unban(self, guild, user): await self.bot.wait_until_ready() - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) msg = f"āš ļø **Unban**: {user.mention} | "\ f"{self.bot.escape_message(user)}\n"\ f"šŸ· __User ID__: {user.id}" diff --git a/cogs/mod.py b/cogs/mod.py index c92f116..01d0b60 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -54,7 +54,7 @@ class Mod: "it is recommended to use `.mute [reason]`"\ " as the reason is automatically sent to the user." - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) await log_channel.send(chan_message) await ctx.send(f"{target.mention} can no longer speak.") add_restriction(target.id, config.mute_role) @@ -73,7 +73,7 @@ class Mod: f"{target.mention} | {safe_name}\n"\ f"šŸ· __User ID__: {target.id}\n" - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) await log_channel.send(chan_message) await ctx.send(f"{target.mention} can now speak again.") remove_restriction(target.id, config.mute_role) @@ -120,7 +120,7 @@ class Mod: "`.kick [reason]`"\ " as the reason is automatically sent to the user." - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) await log_channel.send(chan_message) @commands.guild_only() @@ -164,7 +164,7 @@ class Mod: ", it is recommended to use `.ban [reason]`"\ " as the reason is automatically sent to the user." - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) await log_channel.send(chan_message) await ctx.send(f"{safe_name} is now b&. šŸ‘") @@ -200,7 +200,7 @@ class Mod: ", it is recommended to use "\ "`.hackban [reason]`." - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) await log_channel.send(chan_message) await ctx.send(f"{safe_name} is now b&. šŸ‘") @@ -233,7 +233,7 @@ class Mod: ", it is recommended to use `.ban [reason]`"\ " as the reason is automatically sent to the user." - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) await log_channel.send(chan_message) @commands.guild_only() @@ -246,7 +246,7 @@ class Mod: return await ctx.send("No such role! Available roles: " + ','.join(config.named_roles)) - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) target_role = ctx.guild.get_role(config.named_roles[role]) if target_role in target.roles: @@ -269,7 +269,7 @@ class Mod: return await ctx.send("No such role! Available roles: " + ','.join(config.named_roles)) - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) target_role = ctx.guild.get_role(config.named_roles[role]) if target_role not in target.roles: @@ -287,7 +287,7 @@ class Mod: @commands.command(aliases=["clear"]) async def purge(self, ctx, limit: int, channel: discord.TextChannel = None): """Clears a given number of messages, staff only.""" - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) if not channel: channel = ctx.channel await channel.purge(limit=limit) @@ -307,7 +307,7 @@ class Mod: return await ctx.send("I can't warn this user as " "they're a member of staff.") - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) warn_count = userlog(target.id, ctx.author, reason, "warns", target.name) diff --git a/cogs/mod_reacts.py b/cogs/mod_reacts.py index fb81ec4..2577807 100644 --- a/cogs/mod_reacts.py +++ b/cogs/mod_reacts.py @@ -16,7 +16,7 @@ class ModReact: channel: discord.TextChannel = None, limit: int = 50): """Clears reacts from a given user in the given channel, staff only.""" - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) if not channel: channel = ctx.channel count = 0 @@ -39,7 +39,7 @@ class ModReact: limit: int = 50, channel: discord.TextChannel = None): """Clears all reacts in a given channel, staff only. Use with care.""" - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) if not channel: channel = ctx.channel count = 0 diff --git a/cogs/mod_userlog.py b/cogs/mod_userlog.py index a36e317..6fc9752 100644 --- a/cogs/mod_userlog.py +++ b/cogs/mod_userlog.py @@ -132,7 +132,7 @@ class ModUserlog: async def clearevent(self, ctx, target: discord.Member, event="warns"): """Clears all events of given type for a user, staff only.""" - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) msg = self.clear_event_from_id(str(target.id), event) safe_name = await commands.clean_content().convert(ctx, str(target)) await ctx.send(msg) @@ -146,7 +146,7 @@ class ModUserlog: @commands.command(aliases=["clearwarnsid"]) async def cleareventid(self, ctx, target: int, event="warns"): """Clears all events of given type for a userid, staff only.""" - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) msg = self.clear_event_from_id(str(target), event) await ctx.send(msg) msg = f"šŸ—‘ **Cleared {event}**: {ctx.author.mention} cleared"\ @@ -159,7 +159,7 @@ class ModUserlog: async def delevent(self, ctx, target: discord.Member, idx: int, event="warns"): """Removes a specific event from a user, staff only.""" - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) del_event = self.delete_event_from_id(str(target.id), idx, event) event_name = userlog_event_types[event].lower() # This is hell. @@ -178,7 +178,7 @@ class ModUserlog: @commands.command(aliases=["delwarnid"]) async def deleventid(self, ctx, target: int, idx: int, event="warns"): """Removes a specific event from a userid, staff only.""" - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) del_event = self.delete_event_from_id(str(target), idx, event) event_name = userlog_event_types[event].lower() # This is hell. diff --git a/cogs/verification.py b/cogs/verification.py index 0960a43..1847047 100644 --- a/cogs/verification.py +++ b/cogs/verification.py @@ -127,7 +127,7 @@ class Verification: msg = f"šŸ—‘ **Reset**: {ctx.author.mention} cleared {limit} messages "\ f" in {ctx.channel.mention}" msg += f"\nšŸ’¬ __Current challenge location__: under rule {rule_choice}" - log_channel = self.bot.get_channel(config.log_channel) + log_channel = self.bot.get_channel(config.modlog_channel) await log_channel.send(msg) # find rule that puts us over 2,000 characters, if any diff --git a/config_template.py b/config_template.py index 5f01639..ab23e3b 100644 --- a/config_template.py +++ b/config_template.py @@ -38,6 +38,7 @@ staff_role_ids = [526384077679624192, # Team role in NotSwitched log_channel = 526377735908491284 # Log channel in NotSwitched botlog_channel = 529070401704296460 # Botlog channel in NotSwitched +modlog_channel = 542114169244221452 # #mod-logs channel in ReSwitched welcome_channel = 526372470752673792 # newcomers channel in NotSwitched community_channels = [526378423468425236] # Channels requiring community role