From 7c9db7859a08da8eb95d3881252a114a3d66ad24 Mon Sep 17 00:00:00 2001 From: Luke R Date: Wed, 26 Feb 2025 17:12:02 -0800 Subject: [PATCH] Minifi the bigext function --- app/bot.py | 1 - app/cogs/cheeky_functions.py | 22 ++++++++++------------ app/core_utils.py | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/app/bot.py b/app/bot.py index 8c2633bd..054f5c49 100755 --- a/app/bot.py +++ b/app/bot.py @@ -41,7 +41,6 @@ async def on_ready(): message_id = 1099374735428681758 # Testing - # blap # channel_id = 932476007439552522 # message_id = 1236011522572943382 diff --git a/app/cogs/cheeky_functions.py b/app/cogs/cheeky_functions.py index bd101eee..f65fcc77 100755 --- a/app/cogs/cheeky_functions.py +++ b/app/cogs/cheeky_functions.py @@ -390,19 +390,17 @@ class Cheeky(commands.Cog): required=True, ) async def bigtext(self, ctx: commands.Context, input_string: str): - final = [ - ( - ":exclamation:" - if c == "!" - else ( - ":question:" - if c == "?" - else ":regional_indicator_{}:".format(c) if c != " " else " " - ) - ) - for c in input_string.lower() - ] + def char_to_emoji(c: str) -> str: + """Convert a character to its corresponding Discord emoji representation.""" + if c == "!": + return ":exclamation:" + if c == "?": + return ":question:" + if c == " ": + return " " + return f":regional_indicator_{c}:" + final = [char_to_emoji(c) for c in input_string.lower()] await ctx.respond("".join(final)) diff --git a/app/core_utils.py b/app/core_utils.py index 205b5502..1e7032d5 100755 --- a/app/core_utils.py +++ b/app/core_utils.py @@ -73,7 +73,7 @@ def gen_username(): response = requests.get(url, headers=headers).text soup = BeautifulSoup(response, "html.parser") - username = soup.find("div", {"id": "gencont"}).div.find("p").text + username = soup.find("div", {"id": "textblock0"}).find_next("p").text return username