WIP: Refactor Aurora (3.0.0) #29
4 changed files with 14 additions and 10 deletions
|
@ -313,7 +313,7 @@ class Moderation(AuroraGuildModel):
|
|||
bot: Red,
|
||||
guild_id: int,
|
||||
moderator_id: int,
|
||||
moderation_type: str,
|
||||
moderation_type: Type,
|
||||
target_type: str,
|
||||
target_id: int,
|
||||
role_id: int | None = None,
|
||||
|
@ -373,7 +373,7 @@ class Moderation(AuroraGuildModel):
|
|||
case = {
|
||||
"moderation_id": moderation_id,
|
||||
"timestamp": timestamp.timestamp(),
|
||||
"moderation_type": moderation_type,
|
||||
"moderation_type": moderation_type.key,
|
||||
"target_type": target_type,
|
||||
"target_id": target_id,
|
||||
"moderator_id": moderator_id,
|
||||
|
|
|
@ -21,7 +21,8 @@ def get_icon(bot: Red) -> File:
|
|||
|
||||
@type_registry.register(key="ban")
|
||||
class Ban(Type):
|
||||
moderation_type="ban"
|
||||
key="ban"
|
||||
string="ban"
|
||||
verb="banned"
|
||||
|
||||
@classmethod
|
||||
|
@ -62,7 +63,7 @@ class Ban(Type):
|
|||
bot,
|
||||
ctx.guild.id,
|
||||
ctx.author.id,
|
||||
cls.moderation_type,
|
||||
cls(),
|
||||
'user',
|
||||
target.id,
|
||||
None,
|
||||
|
@ -99,7 +100,8 @@ class Ban(Type):
|
|||
|
||||
@type_registry.register(key="tempban")
|
||||
class Tempban(Ban):
|
||||
moderation_type="tempban"
|
||||
key="tempban"
|
||||
string="tempban"
|
||||
verb="tempbanned"
|
||||
|
||||
@classmethod
|
||||
|
@ -148,7 +150,7 @@ class Tempban(Ban):
|
|||
bot,
|
||||
ctx.guild.id,
|
||||
ctx.author.id,
|
||||
cls.moderation_type,
|
||||
cls(),
|
||||
'user',
|
||||
target.id,
|
||||
None,
|
||||
|
|
|
@ -6,13 +6,15 @@ from redbot.core import commands
|
|||
from redbot.core.bot import Red
|
||||
|
||||
|
||||
#@type_registry.register(key="type")
|
||||
class Type(object):
|
||||
moderation_type = None
|
||||
verb = None
|
||||
key = "type" # this should ALWAYS be the same as the registry key, and should NEVER be localized
|
||||
string = "type"
|
||||
verb = "typed"
|
||||
embed_desc = "been"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.moderation_type
|
||||
return self.string
|
||||
|
||||
@classmethod
|
||||
async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, **kwargs) -> 'Type': # pylint: disable=unused-argument
|
||||
|
|
|
@ -42,7 +42,7 @@ async def message_factory(
|
|||
Returns:
|
||||
embed: The message embed.
|
||||
"""
|
||||
if response is not None and moderation_type.moderation_type not in [
|
||||
if response is not None and moderation_type.key not in [
|
||||
"kick",
|
||||
"ban",
|
||||
"tempban",
|
||||
|
|
Loading…
Reference in a new issue