This commit is contained in:
Zeva Rose 2021-07-19 13:08:33 -06:00
parent 52ecdfc9f5
commit 9288da2899

View file

@ -70,7 +70,7 @@ class AdminCog(commands.Cog):
user: User = None, user: User = None,
reason: str = None, reason: str = None,
type: str = "perm", type: str = "perm",
length: int = 4, duration: int = 4,
): ):
if not user or user == ctx.author: if not user or user == ctx.author:
await ctx.send("You cannot ban yourself.", hidden=True) await ctx.send("You cannot ban yourself.", hidden=True)
@ -78,7 +78,7 @@ 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 type == "temp" and length < 0: if type == "temp" and duration < 0:
await ctx.send( await ctx.send(
"You cannot set a temp ban to < 0 hours.", hidden=True "You cannot set a temp ban to < 0 hours.", hidden=True
) )
@ -103,8 +103,8 @@ class AdminCog(commands.Cog):
time = datetime.now() time = datetime.now()
expiry = None expiry = None
if mtype == "temp": if mtype == "temp":
user_message += f"\nDuration: {length} hours" user_message += f"\nDuration: {duration} hours"
expiry = time + timedelta(hours=length) expiry = time + timedelta(hours=duration)
await user.send(user_message) await user.send(user_message)
await ctx.guild.ban(user, reason=reason) await ctx.guild.ban(user, reason=reason)
@ -115,7 +115,7 @@ class AdminCog(commands.Cog):
+ f" Reason:\n{reason}" + f" Reason:\n{reason}"
) )
if type != "temp": if type != "temp":
length = None duration = None
active = True active = True
if type == "soft": if type == "soft":
active = False active = False
@ -130,7 +130,7 @@ class AdminCog(commands.Cog):
"time": datetime.now(), "time": datetime.now(),
"guild": ctx.guild.id, "guild": ctx.guild.id,
"type": type, "type": type,
"length": length, "duration": duration,
"expiry": expiry, "expiry": expiry,
"active": active, "active": active,
} }
@ -461,8 +461,8 @@ class AdminCog(commands.Cog):
required=True, required=True,
), ),
create_option( create_option(
name="length", name="duration",
description="Mute length", description="Mute duration",
option_type=4, option_type=4,
required=False, required=False,
), ),
@ -470,7 +470,7 @@ class AdminCog(commands.Cog):
) )
@admin_or_permissions(mute_members=True) @admin_or_permissions(mute_members=True)
async def _mute( async def _mute(
self, ctx: SlashContext, user: Member, reason: str, length: int = 30 self, ctx: SlashContext, user: Member, reason: str, duration: int = 30
): ):
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)
@ -496,10 +496,10 @@ class AdminCog(commands.Cog):
await user.add_roles(role, reason=reason) await user.add_roles(role, reason=reason)
time = datetime.now() time = datetime.now()
expiry = None expiry = None
if length < 0: if duration < 0:
length = -1 duration = -1
if length >= 0: if duration >= 0:
expiry = time + timedelta(minutes=length) expiry = time + timedelta(minutes=duration)
self.db.jarvis.mutes.insert_one( self.db.jarvis.mutes.insert_one(
{ {
"user": user.id, "user": user.id,
@ -507,9 +507,9 @@ class AdminCog(commands.Cog):
"admin": ctx.author.id, "admin": ctx.author.id,
"time": time, "time": time,
"guild": ctx.guild.id, "guild": ctx.guild.id,
"length": length, "duration": duration,
"expiry": expiry, "expiry": expiry,
"active": True if length >= 0 else False, "active": True if duration >= 0 else False,
} }
) )
self.db.jarvis.mutes.update_many( self.db.jarvis.mutes.update_many(