fix(aurora): fixed removerole and addrole being broken if used without a duration set
Some checks failed
Actions / Build Documentation (MkDocs) (pull_request) Successful in 33s
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 49s

This commit is contained in:
Seaswimmer 2024-08-13 23:59:36 -04:00
parent 86c0cadd82
commit 6aaef7d3b2
Signed by: cswimr
GPG key ID: 3813315477F26F82
2 changed files with 5 additions and 5 deletions

View file

@ -46,7 +46,7 @@ class Aurora(commands.Cog):
This cog stores all of its data in an SQLite database.""" This cog stores all of its data in an SQLite database."""
__author__ = ["Seaswimmer"] __author__ = ["Seaswimmer"]
__version__ = "3.0.0-indev6" __version__ = "3.0.0-indev7"
__documentation__ = "https://seacogs.coastalcommits.com/aurora/" __documentation__ = "https://seacogs.coastalcommits.com/aurora/"
async def red_delete_data_for_user(self, *, requester, user_id: int): async def red_delete_data_for_user(self, *, requester, user_id: int):

View file

@ -158,7 +158,7 @@ class AddRole(Type):
return None return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member, role: Role, silent: bool, duration: str = None, reason: str = None): async def handler(cls, ctx: commands.Context, target: Member, role: Role, silent: bool, duration: str | None = None, reason: str | None = None):
addrole_whitelist = await config.guild(ctx.guild).addrole_whitelist() addrole_whitelist = await config.guild(ctx.guild).addrole_whitelist()
if not addrole_whitelist: if not addrole_whitelist:
@ -192,7 +192,7 @@ class AddRole(Type):
return return
response = await ctx.send( response = await ctx.send(
content=f"{target.mention} has {cls.embed_desc}{role.mention} role{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time != 'NULL' else ''}!\n**Reason** - `{reason}`" content=f"{target.mention} has {cls.embed_desc}{role.mention} role{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time else ''}!\n**Reason** - `{reason}`"
) )
if silent is False: if silent is False:
@ -331,7 +331,7 @@ class RemoveRole(Type):
return None return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member, role: Role, silent: bool, duration: str | None = None, reason: str = None): async def handler(cls, ctx: commands.Context, target: Member, role: Role, silent: bool, duration: str | None = None, reason: str | None = None):
addrole_whitelist = await config.guild(ctx.guild).addrole_whitelist() addrole_whitelist = await config.guild(ctx.guild).addrole_whitelist()
if not addrole_whitelist: if not addrole_whitelist:
@ -365,7 +365,7 @@ class RemoveRole(Type):
return return
response = await ctx.send( response = await ctx.send(
content=f"{target.mention} has {cls.embed_desc}{role.mention} role removed{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time != 'NULL' else ''}!\n**Reason** - `{reason}`" content=f"{target.mention} has {cls.embed_desc}{role.mention} role removed{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time else ''}!\n**Reason** - `{reason}`"
) )
if silent is False: if silent is False: