fix(aurora): fixed a conditional statement and a pydantic issue
This commit is contained in:
parent
3f6aec0a82
commit
0b31e70089
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue