From c565f962c5c610b33aabe4dd09e4188c050e0681 Mon Sep 17 00:00:00 2001 From: WhatDidYouExpect <89535984+WhatDidYouExpect@users.noreply.github.com> Date: Wed, 16 Jul 2025 20:11:08 +0200 Subject: [PATCH 1/5] sigh --- .../{webserver.py.disabled => webserver.py} | 0 bot.py | 5 ++-- modules/image.py | 29 ++++++++++--------- 3 files changed, 19 insertions(+), 15 deletions(-) rename assets/cogs/{webserver.py.disabled => webserver.py} (100%) diff --git a/assets/cogs/webserver.py.disabled b/assets/cogs/webserver.py similarity index 100% rename from assets/cogs/webserver.py.disabled rename to assets/cogs/webserver.py diff --git a/bot.py b/bot.py index 74cf0b7..0c40592 100644 --- a/bot.py +++ b/bot.py @@ -225,7 +225,7 @@ async def talk(ctx: commands.Context, sentence_size: int = 5) -> None: # Command: Generate an image @bot.hybrid_command(description=f"{(_('command_desc_help'))}") -async def impact(ctx: commands.Context) -> None: +async def impact(ctx: commands.Context, text: Optional[str] = None) -> None: assets_folder: str = "assets/images" temp_input: Optional[str] = None @@ -259,7 +259,8 @@ async def impact(ctx: commands.Context) -> None: shutil.copy(fallback_image, temp_input) input_path = temp_input - output_path: Optional[str] = await gen_meme(input_path) + output_path: Optional[str] = await gen_meme(input_path, custom_text=text) + if output_path is None or not os.path.isfile(output_path): if temp_input and os.path.exists(temp_input): diff --git a/modules/image.py b/modules/image.py index 58180d5..d3807df 100644 --- a/modules/image.py +++ b/modules/image.py @@ -37,7 +37,7 @@ def split_text_to_fit(text, font, max_width, draw): midpoint = len(words) // 2 return " ".join(words[:midpoint]), " ".join(words[midpoint:]) -async def gen_meme(input_image_path, sentence_size=5, max_attempts=10): +async def gen_meme(input_image_path, sentence_size=5, max_attempts=10, custom_text=None): markov_model = load_markov_model() if not markov_model or not os.path.isfile(input_image_path): return None @@ -52,19 +52,22 @@ async def gen_meme(input_image_path, sentence_size=5, max_attempts=10): font = load_font(font_size) response = None - for _ in range(20): - if sentence_size == 1: - candidate = markov_model.make_short_sentence(max_chars=100, tries=100) - if candidate: - candidate = candidate.split()[0] - else: - candidate = markov_model.make_sentence(tries=100, max_words=sentence_size) + if custom_text: + response = custom_text + else: + for _ in range(20): + if sentence_size == 1: + candidate = markov_model.make_short_sentence(max_chars=100, tries=100) + if candidate: + candidate = candidate.split()[0] + else: + candidate = markov_model.make_sentence(tries=100, max_words=sentence_size) - if candidate and candidate not in generated_sentences: - if sentence_size > 1: - candidate = improve_sentence_coherence(candidate) - generated_sentences.add(candidate) - response = candidate + if candidate and candidate not in generated_sentences: + if sentence_size > 1: + candidate = improve_sentence_coherence(candidate) + generated_sentences.add(candidate) + response = candidate break if not response: From 7c6be59dc96a1987bb2c74fb25ef474fcc58c089 Mon Sep 17 00:00:00 2001 From: WhatDidYouExpect <89535984+WhatDidYouExpect@users.noreply.github.com> Date: Thu, 17 Jul 2025 15:22:39 +0200 Subject: [PATCH 2/5] yeah no lastfm gets the status change so fix later i guess --- assets/cogs/{lastfm.py => lastfm.py.disabled} | 0 bot.py | 14 +++++++++++--- example.env | 1 + modules/globalvars.py | 3 ++- 4 files changed, 14 insertions(+), 4 deletions(-) rename assets/cogs/{lastfm.py => lastfm.py.disabled} (100%) diff --git a/assets/cogs/lastfm.py b/assets/cogs/lastfm.py.disabled similarity index 100% rename from assets/cogs/lastfm.py rename to assets/cogs/lastfm.py.disabled diff --git a/bot.py b/bot.py index 0c40592..4c7f817 100644 --- a/bot.py +++ b/bot.py @@ -113,6 +113,7 @@ async def on_ready() -> None: global launched global slash_commands_enabled global NAME + global status folder_name: str = "cogs" if launched: @@ -136,8 +137,15 @@ async def on_ready() -> None: quit() if not song: - return - await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=f"{song}")) + return + + status = { + "idle": discord.Status.idle, + "dnd": discord.Status.dnd, + "invisible": discord.Status.invisible, + "online": discord.Status.online + }.get(status.lower(), discord.Status.online) + await bot.change_presence(status=status, activity=discord.Activity(type=discord.ActivityType.listening, name=f"{song}")) launched = True @bot.event @@ -372,7 +380,7 @@ async def on_message(message: discord.Message) -> None: if str(message.author.id) in BLACKLISTED_USERS: return - + if message.content.startswith((f"{PREFIX}talk", f"{PREFIX}mem", f"{PREFIX}help", f"{PREFIX}stats", f"{PREFIX}")): logger.info(f"{(_('command_ran')).format(message=message)}") await bot.process_commands(message) diff --git a/example.env b/example.env index fe40023..45cfd9b 100644 --- a/example.env +++ b/example.env @@ -11,6 +11,7 @@ AUTOUPDATE="True" SONG="Basket Case - Green Day" CHECKSDISABLED="Frue" REACT="True" +STATUS="idle" POSITIVEGIFS="https://media.discordapp.net/attachments/821047460151427135/1181371808566493184/jjpQGeno.gif, https://tenor.com/view/chill-guy-my-new-character-gif-2777893510283028272,https://tenor.com/view/goodnight-goodnight-friends-weezer-weezer-goodnight-gif-7322052181075806988" SPLASHTEXT=" diff --git a/modules/globalvars.py b/modules/globalvars.py index 2281388..5241cca 100644 --- a/modules/globalvars.py +++ b/modules/globalvars.py @@ -35,6 +35,7 @@ LOCALE = os.getenv("LOCALE", "en") gooberTOKEN = os.getenv("GOOBERTOKEN") splashtext = os.getenv("SPLASHTEXT") ownerid = int(os.getenv("OWNERID", "0")) +status = os.getenv("STATUS") showmemenabled = os.getenv("SHOWMEMENABLED") BLACKLISTED_USERS = os.getenv("BLACKLISTEDUSERS", "").split(",") USERTRAIN_ENABLED = os.getenv("USERTRAINENABLED", "true").lower() == "true" @@ -44,7 +45,7 @@ MEMORY_LOADED_FILE = "MEMORY_LOADED" # is this still even used?? okay just check ALIVEPING = os.getenv("ALIVEPING") AUTOUPDATE = os.getenv("AUTOUPDATE") # IGNOREWARNING = False # is this either??? i don't think so? -song = os.getenv("song") +song = os.getenv("SONG") arch = platform.machine() slash_commands_enabled = True # 100% broken, its a newer enough version so its probably enabled by default.... fix this at somepoint or hard code it in goober central code launched = False From cb45a9fffc94946246220f057df12f3bfa32c5fb Mon Sep 17 00:00:00 2001 From: WhatDidYouExpect <89535984+WhatDidYouExpect@users.noreply.github.com> Date: Thu, 17 Jul 2025 15:33:32 +0200 Subject: [PATCH 3/5] Update todo.txt --- todo.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/todo.txt b/todo.txt index 428c6c8..9a1a0f3 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,2 @@ -- fix missing translations in some cases - revamp wiki -- clean the rest - alot From 016e907d39c2f77b3b8afa76001b2d05b69dab22 Mon Sep 17 00:00:00 2001 From: WhatDidYouExpect <89535984+WhatDidYouExpect@users.noreply.github.com> Date: Thu, 17 Jul 2025 17:42:21 +0200 Subject: [PATCH 4/5] probably wont break anything (foreshadowing) --- modules/globalvars.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/globalvars.py b/modules/globalvars.py index 5241cca..8ff634e 100644 --- a/modules/globalvars.py +++ b/modules/globalvars.py @@ -44,10 +44,8 @@ MEMORY_FILE = "memory.json" MEMORY_LOADED_FILE = "MEMORY_LOADED" # is this still even used?? okay just checked its used in the markov module ALIVEPING = os.getenv("ALIVEPING") AUTOUPDATE = os.getenv("AUTOUPDATE") -# IGNOREWARNING = False # is this either??? i don't think so? song = os.getenv("SONG") arch = platform.machine() -slash_commands_enabled = True # 100% broken, its a newer enough version so its probably enabled by default.... fix this at somepoint or hard code it in goober central code launched = False latest_version = "0.0.0" local_version = "2.3.3" From 53e0eb5289bd2102d745150c6d8bf3e1069e9565 Mon Sep 17 00:00:00 2001 From: WhatDidYouExpect <89535984+WhatDidYouExpect@users.noreply.github.com> Date: Thu, 17 Jul 2025 23:35:59 +0200 Subject: [PATCH 5/5] bump it to 2.3.4 --- modules/globalvars.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/globalvars.py b/modules/globalvars.py index 8ff634e..0a5a57b 100644 --- a/modules/globalvars.py +++ b/modules/globalvars.py @@ -48,7 +48,7 @@ song = os.getenv("SONG") arch = platform.machine() launched = False latest_version = "0.0.0" -local_version = "2.3.3" +local_version = "2.3.4" os.environ['gooberlocal_version'] = local_version REACT = os.getenv("REACT") if get_git_branch() == "dev":