From 5f630cd13294cfcb74f760791f2ecf8a1e88cdb4 Mon Sep 17 00:00:00 2001 From: Andrew Brown <92134285+andrewj-brown@users.noreply.github.com> Date: Wed, 8 Nov 2023 18:32:53 +1000 Subject: [PATCH] fix yelling types and remove arbitrary web request (#177) * fix yelling types and remove arbitrary web request * style. also take 2 * of all the days for my typechecker to stop fucking working * i'm capitulating * fixed capitulation --- uqcsbot/yelling.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/uqcsbot/yelling.py b/uqcsbot/yelling.py index abbe005..5a6ee04 100644 --- a/uqcsbot/yelling.py +++ b/uqcsbot/yelling.py @@ -3,8 +3,6 @@ from discord.ext import commands from random import choice, random import re -from urllib.request import urlopen -from urllib.error import URLError from uqcsbot.bot import UQCSBot from uqcsbot.cog import UQCSBotCog @@ -48,7 +46,8 @@ async def wrapper( if not Yelling.contains_lowercase(text): await func(cogself, *args, **kwargs) return - await interaction.response.send_message( + + await interaction.response.send_message( # type: ignore str(discord.utils.get(bot.emojis, name="disapproval") or "") ) if isinstance(interaction.user, discord.Member): @@ -167,12 +166,6 @@ def clean_text(self, message: str) -> str: # slightly more permissive version of discord's url regex, matches absolutely anything between http(s):// and whitespace for url in re.findall(r"https?:\/\/[^\s]+", text, flags=re.UNICODE): - try: - resp = urlopen(url) - except (ValueError, URLError): - continue - if 400 <= resp.code <= 499: - continue text = text.replace(url, url.upper()) text = text.replace(">", ">").replace("<", "<").replace("&", "&")