Add a new type of log channels: modlog
This commit is contained in:
parent
d5cf2b5a96
commit
df82e6268d
7 changed files with 22 additions and 21 deletions
|
@ -27,7 +27,7 @@ class Lockdown:
|
||||||
Defaults to current channel."""
|
Defaults to current channel."""
|
||||||
if not channel:
|
if not channel:
|
||||||
channel = ctx.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:
|
if channel.id in config.community_channels:
|
||||||
roles = [config.named_roles["community"],
|
roles = [config.named_roles["community"],
|
||||||
|
@ -61,7 +61,7 @@ class Lockdown:
|
||||||
"""Unlocks speaking in current channel, staff only."""
|
"""Unlocks speaking in current channel, staff only."""
|
||||||
if not channel:
|
if not channel:
|
||||||
channel = ctx.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:
|
if ctx.channel.id in config.community_channels:
|
||||||
roles = [config.named_roles["community"],
|
roles = [config.named_roles["community"],
|
||||||
|
|
|
@ -101,7 +101,7 @@ class Logs:
|
||||||
|
|
||||||
async def on_member_ban(self, guild, member):
|
async def on_member_ban(self, guild, member):
|
||||||
await self.bot.wait_until_ready()
|
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} | "\
|
msg = f"⛔ **Ban**: {member.mention} | "\
|
||||||
f"{self.bot.escape_message(member)}\n"\
|
f"{self.bot.escape_message(member)}\n"\
|
||||||
f"🏷 __User ID__: {member.id}"
|
f"🏷 __User ID__: {member.id}"
|
||||||
|
@ -109,7 +109,7 @@ class Logs:
|
||||||
|
|
||||||
async def on_member_unban(self, guild, user):
|
async def on_member_unban(self, guild, user):
|
||||||
await self.bot.wait_until_ready()
|
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} | "\
|
msg = f"⚠️ **Unban**: {user.mention} | "\
|
||||||
f"{self.bot.escape_message(user)}\n"\
|
f"{self.bot.escape_message(user)}\n"\
|
||||||
f"🏷 __User ID__: {user.id}"
|
f"🏷 __User ID__: {user.id}"
|
||||||
|
|
20
cogs/mod.py
20
cogs/mod.py
|
@ -54,7 +54,7 @@ class Mod:
|
||||||
"it is recommended to use `.mute <user> [reason]`"\
|
"it is recommended to use `.mute <user> [reason]`"\
|
||||||
" as the reason is automatically sent to the user."
|
" 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 log_channel.send(chan_message)
|
||||||
await ctx.send(f"{target.mention} can no longer speak.")
|
await ctx.send(f"{target.mention} can no longer speak.")
|
||||||
add_restriction(target.id, config.mute_role)
|
add_restriction(target.id, config.mute_role)
|
||||||
|
@ -73,7 +73,7 @@ class Mod:
|
||||||
f"{target.mention} | {safe_name}\n"\
|
f"{target.mention} | {safe_name}\n"\
|
||||||
f"🏷 __User ID__: {target.id}\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 log_channel.send(chan_message)
|
||||||
await ctx.send(f"{target.mention} can now speak again.")
|
await ctx.send(f"{target.mention} can now speak again.")
|
||||||
remove_restriction(target.id, config.mute_role)
|
remove_restriction(target.id, config.mute_role)
|
||||||
|
@ -120,7 +120,7 @@ class Mod:
|
||||||
"`.kick <user> [reason]`"\
|
"`.kick <user> [reason]`"\
|
||||||
" as the reason is automatically sent to the user."
|
" 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 log_channel.send(chan_message)
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
@ -164,7 +164,7 @@ class Mod:
|
||||||
", it is recommended to use `.ban <user> [reason]`"\
|
", it is recommended to use `.ban <user> [reason]`"\
|
||||||
" as the reason is automatically sent to the user."
|
" 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 log_channel.send(chan_message)
|
||||||
await ctx.send(f"{safe_name} is now b&. 👍")
|
await ctx.send(f"{safe_name} is now b&. 👍")
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class Mod:
|
||||||
", it is recommended to use "\
|
", it is recommended to use "\
|
||||||
"`.hackban <user> [reason]`."
|
"`.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 log_channel.send(chan_message)
|
||||||
await ctx.send(f"{safe_name} is now b&. 👍")
|
await ctx.send(f"{safe_name} is now b&. 👍")
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ class Mod:
|
||||||
", it is recommended to use `.ban <user> [reason]`"\
|
", it is recommended to use `.ban <user> [reason]`"\
|
||||||
" as the reason is automatically sent to the user."
|
" 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 log_channel.send(chan_message)
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
@ -246,7 +246,7 @@ class Mod:
|
||||||
return await ctx.send("No such role! Available roles: " +
|
return await ctx.send("No such role! Available roles: " +
|
||||||
','.join(config.named_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])
|
target_role = ctx.guild.get_role(config.named_roles[role])
|
||||||
|
|
||||||
if target_role in target.roles:
|
if target_role in target.roles:
|
||||||
|
@ -269,7 +269,7 @@ class Mod:
|
||||||
return await ctx.send("No such role! Available roles: " +
|
return await ctx.send("No such role! Available roles: " +
|
||||||
','.join(config.named_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])
|
target_role = ctx.guild.get_role(config.named_roles[role])
|
||||||
|
|
||||||
if target_role not in target.roles:
|
if target_role not in target.roles:
|
||||||
|
@ -287,7 +287,7 @@ class Mod:
|
||||||
@commands.command(aliases=["clear"])
|
@commands.command(aliases=["clear"])
|
||||||
async def purge(self, ctx, limit: int, channel: discord.TextChannel = None):
|
async def purge(self, ctx, limit: int, channel: discord.TextChannel = None):
|
||||||
"""Clears a given number of messages, staff only."""
|
"""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:
|
if not channel:
|
||||||
channel = ctx.channel
|
channel = ctx.channel
|
||||||
await channel.purge(limit=limit)
|
await channel.purge(limit=limit)
|
||||||
|
@ -307,7 +307,7 @@ class Mod:
|
||||||
return await ctx.send("I can't warn this user as "
|
return await ctx.send("I can't warn this user as "
|
||||||
"they're a member of staff.")
|
"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,
|
warn_count = userlog(target.id, ctx.author, reason,
|
||||||
"warns", target.name)
|
"warns", target.name)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class ModReact:
|
||||||
channel: discord.TextChannel = None,
|
channel: discord.TextChannel = None,
|
||||||
limit: int = 50):
|
limit: int = 50):
|
||||||
"""Clears reacts from a given user in the given channel, staff only."""
|
"""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:
|
if not channel:
|
||||||
channel = ctx.channel
|
channel = ctx.channel
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -39,7 +39,7 @@ class ModReact:
|
||||||
limit: int = 50,
|
limit: int = 50,
|
||||||
channel: discord.TextChannel = None):
|
channel: discord.TextChannel = None):
|
||||||
"""Clears all reacts in a given channel, staff only. Use with care."""
|
"""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:
|
if not channel:
|
||||||
channel = ctx.channel
|
channel = ctx.channel
|
||||||
count = 0
|
count = 0
|
||||||
|
|
|
@ -132,7 +132,7 @@ class ModUserlog:
|
||||||
async def clearevent(self, ctx, target: discord.Member,
|
async def clearevent(self, ctx, target: discord.Member,
|
||||||
event="warns"):
|
event="warns"):
|
||||||
"""Clears all events of given type for a user, staff only."""
|
"""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)
|
msg = self.clear_event_from_id(str(target.id), event)
|
||||||
safe_name = await commands.clean_content().convert(ctx, str(target))
|
safe_name = await commands.clean_content().convert(ctx, str(target))
|
||||||
await ctx.send(msg)
|
await ctx.send(msg)
|
||||||
|
@ -146,7 +146,7 @@ class ModUserlog:
|
||||||
@commands.command(aliases=["clearwarnsid"])
|
@commands.command(aliases=["clearwarnsid"])
|
||||||
async def cleareventid(self, ctx, target: int, event="warns"):
|
async def cleareventid(self, ctx, target: int, event="warns"):
|
||||||
"""Clears all events of given type for a userid, staff only."""
|
"""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)
|
msg = self.clear_event_from_id(str(target), event)
|
||||||
await ctx.send(msg)
|
await ctx.send(msg)
|
||||||
msg = f"🗑 **Cleared {event}**: {ctx.author.mention} cleared"\
|
msg = f"🗑 **Cleared {event}**: {ctx.author.mention} cleared"\
|
||||||
|
@ -159,7 +159,7 @@ class ModUserlog:
|
||||||
async def delevent(self, ctx, target: discord.Member, idx: int,
|
async def delevent(self, ctx, target: discord.Member, idx: int,
|
||||||
event="warns"):
|
event="warns"):
|
||||||
"""Removes a specific event from a user, staff only."""
|
"""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)
|
del_event = self.delete_event_from_id(str(target.id), idx, event)
|
||||||
event_name = userlog_event_types[event].lower()
|
event_name = userlog_event_types[event].lower()
|
||||||
# This is hell.
|
# This is hell.
|
||||||
|
@ -178,7 +178,7 @@ class ModUserlog:
|
||||||
@commands.command(aliases=["delwarnid"])
|
@commands.command(aliases=["delwarnid"])
|
||||||
async def deleventid(self, ctx, target: int, idx: int, event="warns"):
|
async def deleventid(self, ctx, target: int, idx: int, event="warns"):
|
||||||
"""Removes a specific event from a userid, staff only."""
|
"""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)
|
del_event = self.delete_event_from_id(str(target), idx, event)
|
||||||
event_name = userlog_event_types[event].lower()
|
event_name = userlog_event_types[event].lower()
|
||||||
# This is hell.
|
# This is hell.
|
||||||
|
|
|
@ -127,7 +127,7 @@ class Verification:
|
||||||
msg = f"🗑 **Reset**: {ctx.author.mention} cleared {limit} messages "\
|
msg = f"🗑 **Reset**: {ctx.author.mention} cleared {limit} messages "\
|
||||||
f" in {ctx.channel.mention}"
|
f" in {ctx.channel.mention}"
|
||||||
msg += f"\n💬 __Current challenge location__: under rule {rule_choice}"
|
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)
|
await log_channel.send(msg)
|
||||||
|
|
||||||
# find rule that puts us over 2,000 characters, if any
|
# find rule that puts us over 2,000 characters, if any
|
||||||
|
|
|
@ -38,6 +38,7 @@ staff_role_ids = [526384077679624192, # Team role in NotSwitched
|
||||||
|
|
||||||
log_channel = 526377735908491284 # Log channel in NotSwitched
|
log_channel = 526377735908491284 # Log channel in NotSwitched
|
||||||
botlog_channel = 529070401704296460 # Botlog 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
|
welcome_channel = 526372470752673792 # newcomers channel in NotSwitched
|
||||||
|
|
||||||
community_channels = [526378423468425236] # Channels requiring community role
|
community_channels = [526378423468425236] # Channels requiring community role
|
||||||
|
|
Loading…
Reference in a new issue