aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-04-23 02:59:30 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-04-23 02:59:30 +0300
commit9e03064e9c116b0dd2bcc65b149b7ac9ee389ff3 (patch)
treedfb295b69ab9031b4079b9fd3d4dbc44941edb13
parentAdds Link Suppressing Helper (diff)
Suppresses Links In Commands
Suppresses links in certain commands that can echo back user input. Signed-off-by: Hassan Abouelela <[email protected]>
-rw-r--r--bot/exts/easter/egg_decorating.py4
-rw-r--r--bot/exts/evergreen/catify.py3
-rw-r--r--bot/exts/evergreen/fun.py3
3 files changed, 8 insertions, 2 deletions
diff --git a/bot/exts/easter/egg_decorating.py b/bot/exts/easter/egg_decorating.py
index b18e6636..a847388d 100644
--- a/bot/exts/easter/egg_decorating.py
+++ b/bot/exts/easter/egg_decorating.py
@@ -10,6 +10,8 @@ import discord
from PIL import Image
from discord.ext import commands
+from bot.utils import helpers
+
log = logging.getLogger(__name__)
with open(Path("bot/resources/evergreen/html_colours.json"), encoding="utf8") as f:
@@ -65,7 +67,7 @@ class EggDecorating(commands.Cog):
if value:
colours[idx] = discord.Colour(value)
else:
- invalid.append(colour)
+ invalid.append(helpers.suppress_links(colour))
if len(invalid) > 1:
return await ctx.send(f"Sorry, I don't know these colours: {' '.join(invalid)}")
diff --git a/bot/exts/evergreen/catify.py b/bot/exts/evergreen/catify.py
index ae8d54b6..d8a7442d 100644
--- a/bot/exts/evergreen/catify.py
+++ b/bot/exts/evergreen/catify.py
@@ -6,6 +6,7 @@ from discord import AllowedMentions, Embed, Forbidden
from discord.ext import commands
from bot.constants import Cats, Colours, NEGATIVE_REPLIES
+from bot.utils import helpers
class Catify(commands.Cog):
@@ -74,7 +75,7 @@ class Catify(commands.Cog):
else:
string_list.insert(random.randint(0, len(string_list)), random.choice(Cats.cats))
- text = " ".join(string_list)
+ text = helpers.suppress_links(" ".join(string_list))
await ctx.send(
f">>> {text}",
allowed_mentions=AllowedMentions.none()
diff --git a/bot/exts/evergreen/fun.py b/bot/exts/evergreen/fun.py
index 101725da..7152d0cb 100644
--- a/bot/exts/evergreen/fun.py
+++ b/bot/exts/evergreen/fun.py
@@ -11,6 +11,7 @@ from discord.ext.commands import BadArgument, Bot, Cog, Context, MessageConverte
from bot import utils
from bot.constants import Client, Colours, Emojis
+from bot.utils import helpers
log = logging.getLogger(__name__)
@@ -83,6 +84,7 @@ class Fun(Cog):
if embed is not None:
embed = Fun._convert_embed(conversion_func, embed)
converted_text = conversion_func(text)
+ converted_text = helpers.suppress_links(converted_text)
# Don't put >>> if only embed present
if converted_text:
converted_text = f">>> {converted_text.lstrip('> ')}"
@@ -101,6 +103,7 @@ class Fun(Cog):
if embed is not None:
embed = Fun._convert_embed(conversion_func, embed)
converted_text = conversion_func(text)
+ converted_text = helpers.suppress_links(converted_text)
# Don't put >>> if only embed present
if converted_text:
converted_text = f">>> {converted_text.lstrip('> ')}"