From 375fffd134749836563e4a5ca1f6201c5fd8eebb Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 28 Dec 2023 19:01:34 -0500 Subject: [PATCH] fix(nerdify): please work --- nerdify/nerdify.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/nerdify/nerdify.py b/nerdify/nerdify.py index 1e27d8b..6993f4e 100644 --- a/nerdify/nerdify.py +++ b/nerdify/nerdify.py @@ -27,28 +27,28 @@ class Nerdify(commands.Cog): messages = [message async for message in ctx.channel.history(limit=2)] # [0] is the command, [1] is the message before the command text = messages[1].content or "I can't translate that!" - await type_message( + await self.type_message( ctx.channel, - nerdify_text(text), + self.nerdify_text(text), allowed_mentions=discord.AllowedMentions( everyone=False, users=False, roles=False ), ) -def nerdify_text(self, text: str) -> str: - """Convert text to nerd speak.""" - return f"\"{text}\" 🤓" + def nerdify_text(self, text: str) -> str: + """Convert text to nerd speak.""" + return f"\"{text}\" 🤓" -async def type_message( - destination: discord.abc.Messageable, content: str, **kwargs: Any # noqa: ANN401 -) -> discord.Message | None: - """Simulate typing and sending a message to a destination. + async def type_message( + destination: discord.abc.Messageable, content: str, **kwargs: Any # noqa: ANN401 + ) -> discord.Message | None: + """Simulate typing and sending a message to a destination. - 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. - """ - content = common_filters.filter_urls(content) - with suppress(discord.HTTPException): - async with destination.typing(): - await asyncio.sleep(max(0.25, min(2.5, len(content) * 0.01))) - return await destination.send(content=content, **kwargs) + 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. + """ + content = common_filters.filter_urls(content) + with suppress(discord.HTTPException): + async with destination.typing(): + await asyncio.sleep(max(0.25, min(2.5, len(content) * 0.01))) + return await destination.send(content=content, **kwargs)