feat(docs): adding documentation for some cogs

This commit is contained in:
SeaswimmerTheFsh 2024-01-04 18:03:34 -05:00
parent f2b983ea52
commit b5c27b2ed7
Signed by untrusted user: cswimr
GPG key ID: 1EBC234EEDA901AE
4 changed files with 140 additions and 3 deletions

View file

@ -21,7 +21,15 @@ class Nerdify(commands.Cog):
@commands.command(aliases=["nerd"])
async def nerdify(self, ctx: commands.Context, *, text: Optional[str] = None) -> None:
"""Nerdify the replied to message, previous message, or your own text."""
"""Nerdify the replied to message, previous message, or your own text.
Example:
``[p]nerdify hello world!``
> "hello world!" :nerd:
Args:
text: The text to nerdify. If not provided, the bot will try to nerdify either the previous message or the replied to message, if the invocation message is a reply.
"""
if not text:
if hasattr(ctx.message, "reference") and ctx.message.reference:
with suppress(
@ -43,7 +51,13 @@ class Nerdify(commands.Cog):
)
def nerdify_text(self, text: str) -> str:
"""Convert text to nerd speak."""
"""Convert text to nerd speak.
Args:
text: The text to convert.
Returns:
The converted text."""
return f"\"{text}\" 🤓"
async def type_message(
@ -53,6 +67,14 @@ class Nerdify(commands.Cog):
Will send a typing indicator, wait a variable amount of time based on the length
of the text (to simulate typing speed), then send the message.
Args:
destination: The [destination](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.Messageable) to send the message to.
content: The content of the message to send.
**kwargs: Any keyword arguments to pass to the [destination.send](https://discordpy.readthedocs.io/en/stable/api.html#discord.TextChannel.send) function.
Returns:
The message sent, or None if an error occurred.
"""
content = common_filters.filter_urls(content)
with suppress(discord.HTTPException):