fix(aurora): hopefully fixed a pydantic schema error
Some checks failed
Actions / Build Documentation (MkDocs) (pull_request) Failing after 27s
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 42s

This commit is contained in:
Seaswimmer 2024-07-12 15:28:39 -04:00
parent e2b0fc999a
commit ad0d981888
Signed by: cswimr
GPG key ID: 3813315477F26F82
2 changed files with 47 additions and 4 deletions

View file

@ -32,6 +32,9 @@ class Note(Type):
verb="noted" verb="noted"
embed_desc="received a " embed_desc="received a "
def void(self) -> None:
return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str) -> 'Note': async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str) -> 'Note':
response = await ctx.send( response = await ctx.send(
@ -90,6 +93,9 @@ class Warn(Type):
string="warn" string="warn"
verb="warned" verb="warned"
def void(self) -> None:
return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str) -> 'Warn': async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str) -> 'Warn':
response = await ctx.send( response = await ctx.send(
@ -149,6 +155,9 @@ class AddRole(Type):
verb="added a role to" verb="added a role to"
embed_desc="been given the " embed_desc="been given the "
def void(self) -> 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, reason: str = None):
addrole_whitelist = await config.guild(ctx.guild).addrole_whitelist() addrole_whitelist = await config.guild(ctx.guild).addrole_whitelist()
@ -282,6 +291,9 @@ class RemoveRole(Type):
verb="removed a role from" verb="removed a role from"
embed_desc="had the " embed_desc="had the "
def void(self) -> 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, reason: str = None):
addrole_whitelist = await config.guild(ctx.guild).addrole_whitelist() addrole_whitelist = await config.guild(ctx.guild).addrole_whitelist()
@ -446,6 +458,9 @@ class Mute(Type):
string="mute" string="mute"
verb="muted" verb="muted"
def void(self) -> None:
return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member, silent: bool, duration: str, reason: str = None): async def handler(cls, ctx: commands.Context, target: Member, silent: bool, duration: str, reason: str = None):
if target.is_timed_out() is True: if target.is_timed_out() is True:
@ -563,6 +578,9 @@ class Unmute(Type):
string="unmute" string="unmute"
verb="unmuted" verb="unmuted"
def void(self) -> None:
return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member, silent: bool, reason: str = None): async def handler(cls, ctx: commands.Context, target: Member, silent: bool, reason: str = None):
if target.is_timed_out() is False: if target.is_timed_out() is False:
@ -622,6 +640,9 @@ class Kick(Type):
string="kick" string="kick"
verb="kicked" verb="kicked"
def void(self) -> None:
return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str = None) -> 'Kick': async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str = None) -> 'Kick':
"""Kick a user.""" """Kick a user."""
@ -680,6 +701,9 @@ class Ban(Type):
string="ban" string="ban"
verb="banned" verb="banned"
def void(self) -> None:
return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str = None, delete_messages: app_commands.Choice | None = None) -> 'Ban': async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str = None, delete_messages: app_commands.Choice | None = None) -> 'Ban':
"""Ban a user.""" """Ban a user."""
@ -760,6 +784,9 @@ class Tempban(Ban):
string="tempban" string="tempban"
verb="tempbanned" verb="tempbanned"
def void(self) -> None:
return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, duration: str, reason: str = None, delete_messages: app_commands.Choice | None = None) -> 'Ban': async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, duration: str, reason: str = None, delete_messages: app_commands.Choice | None = None) -> 'Ban':
"""Ban a user.""" """Ban a user."""
@ -871,6 +898,9 @@ class Softban(Type):
string="softban" string="softban"
verb="softbanned" verb="softbanned"
def void(self) -> None:
return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str = None, delete_messages: app_commands.Choice | None = None) -> 'Softban': async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str = None, delete_messages: app_commands.Choice | None = None) -> 'Softban':
"""Softban a user.""" """Softban a user."""
@ -941,6 +971,9 @@ class Unban(Type):
string="unban" string="unban"
verb="unbanned" verb="unbanned"
def void(self) -> None:
return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str = None) -> 'Unban': async def handler(cls, ctx: commands.Context, target: Member | User, silent: bool, reason: str = None) -> 'Unban':
"""Unban a user.""" """Unban a user."""
@ -992,6 +1025,9 @@ class Slowmode(Type):
verb="set the slowmode in" verb="set the slowmode in"
channel=True channel=True
def void(self) -> None:
return None
@classmethod @classmethod
async def handler(cls, ctx: commands.Context, target: Messageable, silent: bool, duration: str, reason: str) -> 'Slowmode': # pylint: disable=unused-argument async def handler(cls, ctx: commands.Context, target: Messageable, silent: bool, duration: str, reason: str) -> 'Slowmode': # pylint: disable=unused-argument
"""Set the slowmode in a channel.""" """Set the slowmode in a channel."""
@ -1030,3 +1066,6 @@ class Lockdown(Type):
string="lockdown" string="lockdown"
verb="locked down" verb="locked down"
channel=True channel=True
def void(self) -> None:
return None

View file

@ -1,6 +1,5 @@
from abc import abstractmethod
from abc import ABC from typing import Any, List, Tuple
from typing import List, Tuple
from class_registry import AutoRegister, ClassRegistry from class_registry import AutoRegister, ClassRegistry
from discord import Interaction, Member, User from discord import Interaction, Member, User
@ -9,7 +8,7 @@ from redbot.core import commands
type_registry: List['Type'] = ClassRegistry(attr_name='key', unique=True) type_registry: List['Type'] = ClassRegistry(attr_name='key', unique=True)
class Type(ABC, AutoRegister(type_registry)): class Type(object, metaclass=AutoRegister(type_registry)):
"""This is a base class for moderation types. """This is a base class for moderation types.
Attributes: Attributes:
@ -29,6 +28,11 @@ class Type(ABC, AutoRegister(type_registry)):
embed_desc = "been " embed_desc = "been "
channel = False channel = False
@abstractmethod
def void(self) -> Any:
"""This method should be overridden by any child classes. This is a placeholder to allow for automatic class registration."""
raise NotImplementedError
@property @property
def name(self) -> str: def name(self) -> str:
"""Alias for the `string` attribute.""" """Alias for the `string` attribute."""