fix(nerdify): please work

This commit is contained in:
Seaswimmer 2023-12-28 19:01:34 -05:00
parent a759cf2a49
commit 375fffd134
Signed by untrusted user: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -27,21 +27,21 @@ class Nerdify(commands.Cog):
messages = [message async for message in ctx.channel.history(limit=2)] messages = [message async for message in ctx.channel.history(limit=2)]
# [0] is the command, [1] is the message before the command # [0] is the command, [1] is the message before the command
text = messages[1].content or "I can't translate that!" text = messages[1].content or "I can't translate that!"
await type_message( await self.type_message(
ctx.channel, ctx.channel,
nerdify_text(text), self.nerdify_text(text),
allowed_mentions=discord.AllowedMentions( allowed_mentions=discord.AllowedMentions(
everyone=False, users=False, roles=False everyone=False, users=False, roles=False
), ),
) )
def nerdify_text(self, text: str) -> str: def nerdify_text(self, text: str) -> str:
"""Convert text to nerd speak.""" """Convert text to nerd speak."""
return f"\"{text}\" 🤓" return f"\"{text}\" 🤓"
async def type_message( async def type_message(
destination: discord.abc.Messageable, content: str, **kwargs: Any # noqa: ANN401 destination: discord.abc.Messageable, content: str, **kwargs: Any # noqa: ANN401
) -> discord.Message | None: ) -> discord.Message | None:
"""Simulate typing and sending a message to a destination. """Simulate typing and sending a message to a destination.
Will send a typing indicator, wait a variable amount of time based on the length Will send a typing indicator, wait a variable amount of time based on the length