fix(aurora): fixed a keyerror in the message_factory function and cleaned up some other problems
This commit is contained in:
parent
ac7d950aaa
commit
7b3608e264
3 changed files with 9 additions and 7 deletions
|
@ -651,7 +651,7 @@ class Unmute(Type):
|
|||
guild=ctx.guild,
|
||||
moderator=ctx.author,
|
||||
reason=reason,
|
||||
moderation_type="unmuted",
|
||||
moderation_type=cls(),
|
||||
response=response_message,
|
||||
)
|
||||
await target.send(embed=embed, file=get_icon(ctx.bot))
|
||||
|
@ -679,6 +679,7 @@ class Kick(Type):
|
|||
key="kick"
|
||||
string="kick"
|
||||
verb="kicked"
|
||||
removes_from_guild=True
|
||||
|
||||
def void(self) -> None:
|
||||
return None
|
||||
|
@ -740,6 +741,7 @@ class Ban(Type):
|
|||
key="ban"
|
||||
string="ban"
|
||||
verb="banned"
|
||||
removes_from_guild=True
|
||||
|
||||
def void(self) -> None:
|
||||
return None
|
||||
|
@ -824,6 +826,7 @@ class Tempban(Ban):
|
|||
key="tempban"
|
||||
string="tempban"
|
||||
verb="tempbanned"
|
||||
removes_from_guild=True
|
||||
|
||||
def void(self) -> None:
|
||||
return None
|
||||
|
@ -946,6 +949,7 @@ class Softban(Type):
|
|||
key="softban"
|
||||
string="softban"
|
||||
verb="softbanned"
|
||||
removes_from_guild=True
|
||||
|
||||
def void(self) -> None:
|
||||
return None
|
||||
|
@ -1019,6 +1023,7 @@ class Unban(Type):
|
|||
key="unban"
|
||||
string="unban"
|
||||
verb="unbanned"
|
||||
removes_from_guild=True
|
||||
|
||||
def void(self) -> None:
|
||||
return None
|
||||
|
|
|
@ -17,6 +17,7 @@ class Type(metaclass=AutoRegister(type_registry)):
|
|||
verb (str): The verb to use for this type.
|
||||
embed_desc (str): The string to use for embed descriptions.
|
||||
channel (bool): Whether this type targets channels or users. If this is `true` in a subclass, its overriden handler methods should be typed with `discord.abc.Messageable` instead of `discord.Member | discord.User`.
|
||||
removes_from_guild (bool): Whether this type's handler removes the target from the guild, or if the moderation is expected to occur whenever the user is not in the guild. This does not actually remove the target from the guild, the handler method is responsible for that.
|
||||
|
||||
Properties:
|
||||
name (str): The string to display for this type. This is the same as the `string` attribute.
|
||||
|
@ -27,6 +28,7 @@ class Type(metaclass=AutoRegister(type_registry)):
|
|||
verb = "typed"
|
||||
embed_desc = "been "
|
||||
channel = False
|
||||
removes_from_guild = False
|
||||
|
||||
@abstractmethod
|
||||
def void(self) -> Any:
|
||||
|
|
|
@ -42,12 +42,7 @@ async def message_factory(
|
|||
Returns:
|
||||
embed: The message embed.
|
||||
"""
|
||||
if response is not None and moderation_type.key not in [
|
||||
"kick",
|
||||
"ban",
|
||||
"tempban",
|
||||
"unban",
|
||||
]:
|
||||
if response is not None and not moderation_type.removes_from_guild:
|
||||
guild_name = f"[{guild.name}]({response.jump_url})"
|
||||
else:
|
||||
guild_name = guild.name
|
||||
|
|
Loading…
Reference in a new issue