Various admin bugfixes, closes #56
This commit is contained in:
parent
19c9274f66
commit
02ce5b34a3
1 changed files with 22 additions and 9 deletions
|
@ -83,6 +83,9 @@ class AdminCog(commands.Cog):
|
||||||
"You cannot set a temp ban to < 0 hours.", hidden=True
|
"You cannot set a temp ban to < 0 hours.", hidden=True
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
if len(reason) > 100:
|
||||||
|
await ctx.send("Reason must be < 100 characters", hidden=True)
|
||||||
|
return
|
||||||
if not reason:
|
if not reason:
|
||||||
reason = (
|
reason = (
|
||||||
"Mr. Stark is displeased with your presence. Please leave."
|
"Mr. Stark is displeased with your presence. Please leave."
|
||||||
|
@ -179,7 +182,9 @@ class AdminCog(commands.Cog):
|
||||||
user: str,
|
user: str,
|
||||||
reason: str,
|
reason: str,
|
||||||
):
|
):
|
||||||
await ctx.defer()
|
if len(reason) > 100:
|
||||||
|
await ctx.send("Reason must be < 100 characters", hidden=True)
|
||||||
|
return
|
||||||
|
|
||||||
orig_user = user
|
orig_user = user
|
||||||
discrim = None
|
discrim = None
|
||||||
|
@ -244,7 +249,7 @@ class AdminCog(commands.Cog):
|
||||||
database_ban_info = self.db.jarvis.bans.find_one(search)
|
database_ban_info = self.db.jarvis.bans.find_one(search)
|
||||||
|
|
||||||
if not discord_ban_info and not database_ban_info:
|
if not discord_ban_info and not database_ban_info:
|
||||||
await ctx.send(f"Unable to find user {orig_user}")
|
await ctx.send(f"Unable to find user {orig_user}", hidden=True)
|
||||||
|
|
||||||
elif discord_ban_info:
|
elif discord_ban_info:
|
||||||
await self.discord_apply_unban(ctx, discord_ban_info.user, reason)
|
await self.discord_apply_unban(ctx, discord_ban_info.user, reason)
|
||||||
|
@ -311,7 +316,6 @@ class AdminCog(commands.Cog):
|
||||||
self, ctx: SlashContext, type: int = 0, active: int = 1
|
self, ctx: SlashContext, type: int = 0, active: int = 1
|
||||||
):
|
):
|
||||||
active = bool(active)
|
active = bool(active)
|
||||||
await ctx.defer()
|
|
||||||
types = [0, "perm", "temp", "soft"]
|
types = [0, "perm", "temp", "soft"]
|
||||||
search = {"guild": ctx.guild.id}
|
search = {"guild": ctx.guild.id}
|
||||||
if active:
|
if active:
|
||||||
|
@ -378,6 +382,9 @@ class AdminCog(commands.Cog):
|
||||||
if user == self.bot.user:
|
if user == self.bot.user:
|
||||||
await ctx.send("I'm afraid I can't let you do that", hidden=True)
|
await ctx.send("I'm afraid I can't let you do that", hidden=True)
|
||||||
return
|
return
|
||||||
|
if len(reason) > 100:
|
||||||
|
await ctx.send("Reason must be < 100 characters", hidden=True)
|
||||||
|
return
|
||||||
if not reason:
|
if not reason:
|
||||||
reason = (
|
reason = (
|
||||||
"Mr. Stark is displeased with your presence. Please leave."
|
"Mr. Stark is displeased with your presence. Please leave."
|
||||||
|
@ -465,13 +472,15 @@ class AdminCog(commands.Cog):
|
||||||
async def _mute(
|
async def _mute(
|
||||||
self, ctx: SlashContext, user: Member, reason: str, length: int = 30
|
self, ctx: SlashContext, user: Member, reason: str, length: int = 30
|
||||||
):
|
):
|
||||||
await ctx.defer()
|
|
||||||
if user == ctx.author:
|
if user == ctx.author:
|
||||||
await ctx.send("You cannot mute yourself.", hidden=True)
|
await ctx.send("You cannot mute yourself.", hidden=True)
|
||||||
return
|
return
|
||||||
if user == self.bot.user:
|
if user == self.bot.user:
|
||||||
await ctx.send("I'm afraid I can't let you do that", hidden=True)
|
await ctx.send("I'm afraid I can't let you do that", hidden=True)
|
||||||
return
|
return
|
||||||
|
if len(reason) > 100:
|
||||||
|
await ctx.send("Reason must be < 100 characters", hidden=True)
|
||||||
|
return
|
||||||
mute_setting = self.db.jarvis.settings.find_one(
|
mute_setting = self.db.jarvis.settings.find_one(
|
||||||
{"guild": ctx.guild.id, "setting": "mute"}
|
{"guild": ctx.guild.id, "setting": "mute"}
|
||||||
)
|
)
|
||||||
|
@ -525,7 +534,6 @@ class AdminCog(commands.Cog):
|
||||||
)
|
)
|
||||||
@admin_or_permissions(mute_members=True)
|
@admin_or_permissions(mute_members=True)
|
||||||
async def _unmute(self, ctx: SlashContext, user: Member):
|
async def _unmute(self, ctx: SlashContext, user: Member):
|
||||||
await ctx.defer()
|
|
||||||
mute_setting = self.db.jarvis.settings.find_one(
|
mute_setting = self.db.jarvis.settings.find_one(
|
||||||
{"guild": ctx.guild.id, "setting": "mute"}
|
{"guild": ctx.guild.id, "setting": "mute"}
|
||||||
)
|
)
|
||||||
|
@ -613,7 +621,10 @@ class AdminCog(commands.Cog):
|
||||||
duration: int = 10,
|
duration: int = 10,
|
||||||
channel: Union[TextChannel, VoiceChannel] = None,
|
channel: Union[TextChannel, VoiceChannel] = None,
|
||||||
):
|
):
|
||||||
await ctx.defer()
|
await ctx.defer(hidden=True)
|
||||||
|
if len(reason) > 100:
|
||||||
|
await ctx.send("Reason must be < 100 characters", hidden=True)
|
||||||
|
return
|
||||||
if not channel:
|
if not channel:
|
||||||
channel = ctx.channel
|
channel = ctx.channel
|
||||||
for role in ctx.guild.roles:
|
for role in ctx.guild.roles:
|
||||||
|
@ -652,7 +663,6 @@ class AdminCog(commands.Cog):
|
||||||
ctx: SlashContext,
|
ctx: SlashContext,
|
||||||
channel: Union[TextChannel, VoiceChannel] = None,
|
channel: Union[TextChannel, VoiceChannel] = None,
|
||||||
):
|
):
|
||||||
await ctx.defer()
|
|
||||||
if not channel:
|
if not channel:
|
||||||
channel = ctx.channel
|
channel = ctx.channel
|
||||||
lock = self.db.jarvis.locks.find_one(
|
lock = self.db.jarvis.locks.find_one(
|
||||||
|
@ -738,7 +748,6 @@ class AdminCog(commands.Cog):
|
||||||
self,
|
self,
|
||||||
ctx: SlashContext,
|
ctx: SlashContext,
|
||||||
):
|
):
|
||||||
await ctx.defer()
|
|
||||||
channels = ctx.guild.channels
|
channels = ctx.guild.channels
|
||||||
roles = ctx.guild.roles
|
roles = ctx.guild.roles
|
||||||
updates = []
|
updates = []
|
||||||
|
@ -748,6 +757,7 @@ class AdminCog(commands.Cog):
|
||||||
if not locks:
|
if not locks:
|
||||||
await ctx.send("No lockdown detected.", hidden=True)
|
await ctx.send("No lockdown detected.", hidden=True)
|
||||||
return
|
return
|
||||||
|
await ctx.defer()
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
for role in roles:
|
for role in roles:
|
||||||
try:
|
try:
|
||||||
|
@ -796,6 +806,9 @@ class AdminCog(commands.Cog):
|
||||||
async def _warn(
|
async def _warn(
|
||||||
self, ctx: SlashContext, user: User, reason: str, duration: int = 24
|
self, ctx: SlashContext, user: User, reason: str, duration: int = 24
|
||||||
):
|
):
|
||||||
|
if len(reason) > 100:
|
||||||
|
await ctx.send("Reason must be < 100 characters", hidden=True)
|
||||||
|
return
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
self.db.jarvis.warns.insert_one(
|
self.db.jarvis.warns.insert_one(
|
||||||
{
|
{
|
||||||
|
@ -1051,7 +1064,7 @@ class AdminCog(commands.Cog):
|
||||||
async def _autopurge_update(
|
async def _autopurge_update(
|
||||||
self, ctx: SlashContext, channel: TextChannel, delay: int
|
self, ctx: SlashContext, channel: TextChannel, delay: int
|
||||||
):
|
):
|
||||||
autopurge = self.db.jarvis.autopurge.find(
|
autopurge = self.db.jarvis.autopurge.find_one(
|
||||||
{"guild": ctx.guild.id, "channel": channel.id}
|
{"guild": ctx.guild.id, "channel": channel.id}
|
||||||
)
|
)
|
||||||
if not autopurge:
|
if not autopurge:
|
||||||
|
|
Loading…
Add table
Reference in a new issue