Close #52
This commit is contained in:
parent
52ecdfc9f5
commit
9288da2899
1 changed files with 15 additions and 15 deletions
|
@ -70,7 +70,7 @@ class AdminCog(commands.Cog):
|
|||
user: User = None,
|
||||
reason: str = None,
|
||||
type: str = "perm",
|
||||
length: int = 4,
|
||||
duration: int = 4,
|
||||
):
|
||||
if not user or user == ctx.author:
|
||||
await ctx.send("You cannot ban yourself.", hidden=True)
|
||||
|
@ -78,7 +78,7 @@ 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 type == "temp" and length < 0:
|
||||
if type == "temp" and duration < 0:
|
||||
await ctx.send(
|
||||
"You cannot set a temp ban to < 0 hours.", hidden=True
|
||||
)
|
||||
|
@ -103,8 +103,8 @@ class AdminCog(commands.Cog):
|
|||
time = datetime.now()
|
||||
expiry = None
|
||||
if mtype == "temp":
|
||||
user_message += f"\nDuration: {length} hours"
|
||||
expiry = time + timedelta(hours=length)
|
||||
user_message += f"\nDuration: {duration} hours"
|
||||
expiry = time + timedelta(hours=duration)
|
||||
|
||||
await user.send(user_message)
|
||||
await ctx.guild.ban(user, reason=reason)
|
||||
|
@ -115,7 +115,7 @@ class AdminCog(commands.Cog):
|
|||
+ f" Reason:\n{reason}"
|
||||
)
|
||||
if type != "temp":
|
||||
length = None
|
||||
duration = None
|
||||
active = True
|
||||
if type == "soft":
|
||||
active = False
|
||||
|
@ -130,7 +130,7 @@ class AdminCog(commands.Cog):
|
|||
"time": datetime.now(),
|
||||
"guild": ctx.guild.id,
|
||||
"type": type,
|
||||
"length": length,
|
||||
"duration": duration,
|
||||
"expiry": expiry,
|
||||
"active": active,
|
||||
}
|
||||
|
@ -461,8 +461,8 @@ class AdminCog(commands.Cog):
|
|||
required=True,
|
||||
),
|
||||
create_option(
|
||||
name="length",
|
||||
description="Mute length",
|
||||
name="duration",
|
||||
description="Mute duration",
|
||||
option_type=4,
|
||||
required=False,
|
||||
),
|
||||
|
@ -470,7 +470,7 @@ class AdminCog(commands.Cog):
|
|||
)
|
||||
@admin_or_permissions(mute_members=True)
|
||||
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:
|
||||
await ctx.send("You cannot mute yourself.", hidden=True)
|
||||
|
@ -496,10 +496,10 @@ class AdminCog(commands.Cog):
|
|||
await user.add_roles(role, reason=reason)
|
||||
time = datetime.now()
|
||||
expiry = None
|
||||
if length < 0:
|
||||
length = -1
|
||||
if length >= 0:
|
||||
expiry = time + timedelta(minutes=length)
|
||||
if duration < 0:
|
||||
duration = -1
|
||||
if duration >= 0:
|
||||
expiry = time + timedelta(minutes=duration)
|
||||
self.db.jarvis.mutes.insert_one(
|
||||
{
|
||||
"user": user.id,
|
||||
|
@ -507,9 +507,9 @@ class AdminCog(commands.Cog):
|
|||
"admin": ctx.author.id,
|
||||
"time": time,
|
||||
"guild": ctx.guild.id,
|
||||
"length": length,
|
||||
"duration": duration,
|
||||
"expiry": expiry,
|
||||
"active": True if length >= 0 else False,
|
||||
"active": True if duration >= 0 else False,
|
||||
}
|
||||
)
|
||||
self.db.jarvis.mutes.update_many(
|
||||
|
|
Loading…
Add table
Reference in a new issue