misc(moderation): improved code structure
All checks were successful
Pylint / Pylint (push) Successful in 50s

This commit is contained in:
Seaswimmer 2023-09-24 16:33:13 -04:00
parent 944204a441
commit 60493fbd77
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -28,7 +28,7 @@ class Moderation(commands.Cog):
connection = mysql.connector.connect(host=db_host,user=db_user,password=db_password,database=db)
return connection
def create_server_table(self, server):
def create_server_table(self, server: revolt.Server):
database = Moderation.mysql_connect(self)
cursor = database.cursor()
try:
@ -84,7 +84,7 @@ class Moderation(commands.Cog):
cursor.close()
print("Tempban Handler run successful!")
def mysql_log(self, ctx: commands.Context, moderation_type, target_id, duration, reason):
def mysql_log(self, ctx: commands.Context, moderation_type: str, target_id: str, duration, reason:str ):
timestamp = int(time.time())
if duration != "NULL":
end_timedelta = datetime.fromtimestamp(timestamp) + duration
@ -229,7 +229,7 @@ class Moderation(commands.Cog):
@commands.command(aliases=["tdc"])
async def timedeltaconvert(self, ctx, *, duration):
async def timedeltaconvert(self, ctx: commands.Context, *, duration: str):
required_role = utils.get(ctx.server.roles, id=required_role_id)
if required_role not in ctx.author.roles:
await ctx.message.reply("You do not have permission to use this command!")