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
|
||||
)
|
||||
return
|
||||
if len(reason) > 100:
|
||||
await ctx.send("Reason must be < 100 characters", hidden=True)
|
||||
return
|
||||
if not reason:
|
||||
reason = (
|
||||
"Mr. Stark is displeased with your presence. Please leave."
|
||||
|
@ -179,7 +182,9 @@ class AdminCog(commands.Cog):
|
|||
user: str,
|
||||
reason: str,
|
||||
):
|
||||
await ctx.defer()
|
||||
if len(reason) > 100:
|
||||
await ctx.send("Reason must be < 100 characters", hidden=True)
|
||||
return
|
||||
|
||||
orig_user = user
|
||||
discrim = None
|
||||
|
@ -244,7 +249,7 @@ class AdminCog(commands.Cog):
|
|||
database_ban_info = self.db.jarvis.bans.find_one(search)
|
||||
|
||||
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:
|
||||
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
|
||||
):
|
||||
active = bool(active)
|
||||
await ctx.defer()
|
||||
types = [0, "perm", "temp", "soft"]
|
||||
search = {"guild": ctx.guild.id}
|
||||
if active:
|
||||
|
@ -378,6 +382,9 @@ class AdminCog(commands.Cog):
|
|||
if user == self.bot.user:
|
||||
await ctx.send("I'm afraid I can't let you do that", hidden=True)
|
||||
return
|
||||
if len(reason) > 100:
|
||||
await ctx.send("Reason must be < 100 characters", hidden=True)
|
||||
return
|
||||
if not reason:
|
||||
reason = (
|
||||
"Mr. Stark is displeased with your presence. Please leave."
|
||||
|
@ -465,13 +472,15 @@ class AdminCog(commands.Cog):
|
|||
async def _mute(
|
||||
self, ctx: SlashContext, user: Member, reason: str, length: int = 30
|
||||
):
|
||||
await ctx.defer()
|
||||
if user == ctx.author:
|
||||
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", hidden=True)
|
||||
return
|
||||
if len(reason) > 100:
|
||||
await ctx.send("Reason must be < 100 characters", hidden=True)
|
||||
return
|
||||
mute_setting = self.db.jarvis.settings.find_one(
|
||||
{"guild": ctx.guild.id, "setting": "mute"}
|
||||
)
|
||||
|
@ -525,7 +534,6 @@ class AdminCog(commands.Cog):
|
|||
)
|
||||
@admin_or_permissions(mute_members=True)
|
||||
async def _unmute(self, ctx: SlashContext, user: Member):
|
||||
await ctx.defer()
|
||||
mute_setting = self.db.jarvis.settings.find_one(
|
||||
{"guild": ctx.guild.id, "setting": "mute"}
|
||||
)
|
||||
|
@ -613,7 +621,10 @@ class AdminCog(commands.Cog):
|
|||
duration: int = 10,
|
||||
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:
|
||||
channel = ctx.channel
|
||||
for role in ctx.guild.roles:
|
||||
|
@ -652,7 +663,6 @@ class AdminCog(commands.Cog):
|
|||
ctx: SlashContext,
|
||||
channel: Union[TextChannel, VoiceChannel] = None,
|
||||
):
|
||||
await ctx.defer()
|
||||
if not channel:
|
||||
channel = ctx.channel
|
||||
lock = self.db.jarvis.locks.find_one(
|
||||
|
@ -738,7 +748,6 @@ class AdminCog(commands.Cog):
|
|||
self,
|
||||
ctx: SlashContext,
|
||||
):
|
||||
await ctx.defer()
|
||||
channels = ctx.guild.channels
|
||||
roles = ctx.guild.roles
|
||||
updates = []
|
||||
|
@ -748,6 +757,7 @@ class AdminCog(commands.Cog):
|
|||
if not locks:
|
||||
await ctx.send("No lockdown detected.", hidden=True)
|
||||
return
|
||||
await ctx.defer()
|
||||
for channel in channels:
|
||||
for role in roles:
|
||||
try:
|
||||
|
@ -796,6 +806,9 @@ class AdminCog(commands.Cog):
|
|||
async def _warn(
|
||||
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()
|
||||
self.db.jarvis.warns.insert_one(
|
||||
{
|
||||
|
@ -1051,7 +1064,7 @@ class AdminCog(commands.Cog):
|
|||
async def _autopurge_update(
|
||||
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}
|
||||
)
|
||||
if not autopurge:
|
||||
|
|
Loading…
Add table
Reference in a new issue