Add a new type of log channels: modlog

This commit is contained in:
Ave Ozkal 2019-02-05 01:54:40 +03:00
parent d5cf2b5a96
commit df82e6268d
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
7 changed files with 22 additions and 21 deletions

View file

@ -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"],

View file

@ -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}"

View file

@ -54,7 +54,7 @@ class Mod:
"it is recommended to use `.mute <user> [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 <user> [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 <user> [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 <user> [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 <user> [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)

View file

@ -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

View file

@ -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.

View file

@ -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

View file

@ -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