aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/fun/fun.py
diff options
context:
space:
mode:
authorGravatar TizzySaurus <[email protected]>2022-10-26 23:13:25 +0100
committerGravatar GitHub <[email protected]>2022-10-26 22:13:25 +0000
commit9d87134225d9232c337583ead8860e22770bfede (patch)
tree1cf1be002e0f140dff7c4e66ca023868878784b0 /bot/exts/fun/fun.py
parentBump sentry-sdk from 1.10.0 to 1.10.1 (#1130) (diff)
Add ability to use replied message's content as `.randomcase` argument. (#1129)
Co-authored-by: Xithrius <[email protected]>
Diffstat (limited to 'bot/exts/fun/fun.py')
-rw-r--r--bot/exts/fun/fun.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/bot/exts/fun/fun.py b/bot/exts/fun/fun.py
index 779db977..8056b033 100644
--- a/bot/exts/fun/fun.py
+++ b/bot/exts/fun/fun.py
@@ -6,9 +6,10 @@ from pathlib import Path
from typing import Literal
import pyjokes
+from botcore.utils.commands import clean_text_or_reply
from discord import Embed
from discord.ext import commands
-from discord.ext.commands import BadArgument, Cog, Context, clean_content
+from discord.ext.commands import BadArgument, Cog, Context
from bot.bot import Bot
from bot.constants import Client, Colours, Emojis
@@ -60,13 +61,14 @@ class Fun(Cog):
raise BadArgument(f"`{Client.prefix}roll` only supports between 1 and 6 rolls.")
@commands.command(name="randomcase", aliases=("rcase", "randomcaps", "rcaps",))
- async def randomcase_command(self, ctx: Context, *, text: clean_content(fix_channel_mentions=True)) -> None:
- """Randomly converts the casing of a given `text`."""
+ async def randomcase_command(self, ctx: Context, *, text: str | None) -> None:
+ """Randomly converts the casing of a given `text`, or the replied message."""
def conversion_func(text: str) -> str:
"""Randomly converts the casing of a given string."""
return "".join(
char.upper() if round(random.random()) else char.lower() for char in text
)
+ text = await clean_text_or_reply(ctx, text)
text, embed = await messages.get_text_and_embed(ctx, text)
# Convert embed if it exists
if embed is not None: