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

View file

@ -1,6 +1,5 @@
from abc import ABC
from typing import List, Tuple
from abc import abstractmethod
from typing import Any, List, Tuple
from class_registry import AutoRegister, ClassRegistry
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)
class Type(ABC, AutoRegister(type_registry)):
class Type(object, metaclass=AutoRegister(type_registry)):
"""This is a base class for moderation types.
Attributes:
@ -29,6 +28,11 @@ class Type(ABC, AutoRegister(type_registry)):
embed_desc = "been "
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
def name(self) -> str:
"""Alias for the `string` attribute."""