fix(aurora): fixed a conditional statement and a pydantic issue
Some checks failed
Actions / Build Documentation (MkDocs) (pull_request) Successful in 24s
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 33s

This commit is contained in:
Seaswimmer 2024-05-04 20:59:23 -04:00
parent 3f6aec0a82
commit 0b31e70089
Signed by: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -55,7 +55,7 @@ class Moderation(AuroraGuildModel):
return await PartialUser.from_id(self.bot, self.moderator_id) return await PartialUser.from_id(self.bot, self.moderator_id)
async def get_target(self) -> Union["PartialUser", "PartialChannel"]: async def get_target(self) -> Union["PartialUser", "PartialChannel"]:
if self.target_type == "user": if self.target_type == "USER":
return await PartialUser.from_id(self.bot, self.target_id) return await PartialUser.from_id(self.bot, self.target_id)
else: else:
return await PartialChannel.from_id(self.bot, self.target_id) return await PartialChannel.from_id(self.bot, self.target_id)
@ -157,8 +157,8 @@ class PartialChannel(AuroraGuildModel):
return cls(bot=bot, guild_id=channel.guild.id, id=channel.id, username=channel.name) return cls(bot=bot, guild_id=channel.guild.id, id=channel.id, username=channel.name)
except (NotFound, InvalidData, HTTPException, Forbidden) as e: except (NotFound, InvalidData, HTTPException, Forbidden) as e:
if e == Forbidden: if e == Forbidden:
return cls(bot=bot, guild_id=None, id=channel_id, name="Forbidden Channel") return cls(bot=bot, guild_id=0, id=channel_id, name="Forbidden Channel")
return cls(bot=bot, guild_id=None, id=channel_id, name="Deleted Channel") return cls(bot=bot, guild_id=0, id=channel_id, name="Deleted Channel")
class PartialRole(AuroraGuildModel): class PartialRole(AuroraGuildModel):
id: int id: int