fix(aurora): make silent an optional argument in Aurora.moderate()
All checks were successful
Actions / Build Documentation (MkDocs) (pull_request) Successful in 31s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 55s

This commit is contained in:
Seaswimmer 2024-08-23 14:54:06 -04:00
parent 5459392d7e
commit 5934506c8a
Signed by: cswimr
GPG key ID: 3813315477F26F82

View file

@ -46,7 +46,7 @@ class Aurora(commands.Cog):
This cog stores all of its data in an SQLite database.""" This cog stores all of its data in an SQLite database."""
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"] __author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
__version__ = "3.0.0-indev23" __version__ = "3.0.0-indev24"
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs" __git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
__documentation__ = "https://seacogs.coastalcommits.com/aurora/" __documentation__ = "https://seacogs.coastalcommits.com/aurora/"
@ -114,16 +114,16 @@ class Aurora(commands.Cog):
self.handle_expiry.cancel() self.handle_expiry.cancel()
@staticmethod @staticmethod
async def moderate(ctx: Union[commands.Context, discord.Interaction], target: discord.Member | discord.User | discord.abc.Messageable, silent: bool | None, permissions: List[str], moderation_type: Type | str, **kwargs) -> None | Type: async def moderate(ctx: Union[commands.Context, discord.Interaction], target: discord.Member | discord.User | discord.abc.Messageable, permissions: List[str], moderation_type: Type | str, silent: bool | None = None, **kwargs) -> None | Type:
"""This function is used to moderate users. """This function is used to moderate users.
It checks if the target can be moderated, then calls the handler method of the moderation type specified. It checks if the target can be moderated, then calls the handler method of the moderation type specified.
Args: Args:
ctx (Union[commands.Context, discord.Interaction]): The context of the command. If this is a `discord.Interaction` object, it will be converted to a `commands.Context` object. Additionally, if the interaction orignated from a context menu, the `ctx.author` attribute will be overriden to `interaction.user`. ctx (Union[commands.Context, discord.Interaction]): The context of the command. If this is a `discord.Interaction` object, it will be converted to a `commands.Context` object. Additionally, if the interaction orignated from a context menu, the `ctx.author` attribute will be overriden to `interaction.user`.
target (discord.Member, discord.User, discord.abc.Messageable): The target user or channel to moderate. target (discord.Member, discord.User, discord.abc.Messageable): The target user or channel to moderate.
silent (bool | None): Whether to send the moderation action to the target.
permissions (List[str]): The permissions required to moderate the target. permissions (List[str]): The permissions required to moderate the target.
moderation_type (Type): The moderation type (handler) to use. See `aurora.models.moderation_types` for some examples. moderation_type (Type): The moderation type (handler) to use. See `aurora.models.moderation_types` for some examples.
silent (bool, optional): Whether or not to message the target. Defaults to None.
**kwargs: The keyword arguments to pass to the handler method. **kwargs: The keyword arguments to pass to the handler method.
""" """
if isinstance(moderation_type, str): if isinstance(moderation_type, str):