From 6637ece3d8029ae0f31fcafd4b9bf0a3095166df Mon Sep 17 00:00:00 2001 From: WhatDidYouExpect <89535984+WhatDidYouExpect@users.noreply.github.com> Date: Mon, 7 Jul 2025 13:05:50 +0200 Subject: [PATCH] Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. --- assets/locales/en.json | 1 + assets/locales/it.json | 1 + bot.py | 11 ++++++++++- modules/globalvars.py | 2 +- modules/version.py | 4 +--- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/assets/locales/en.json b/assets/locales/en.json index c169c95..cca8867 100644 --- a/assets/locales/en.json +++ b/assets/locales/en.json @@ -112,6 +112,7 @@ "command_ran": "Info: {message.author.name} ran {message.content}", "command_ran_s": "Info: {interaction.user} ran ", "command_desc_ping": "ping", + "command_desc_setlang": "Set a new language for the bot (temporarily)", "command_ping_embed_desc": "Bot Latency:", "command_ping_footer": "Requested by", "command_about_desc": "about", diff --git a/assets/locales/it.json b/assets/locales/it.json index b9f788d..ebf28aa 100644 --- a/assets/locales/it.json +++ b/assets/locales/it.json @@ -113,6 +113,7 @@ "command_ran": "Info: {message.author.name} ha eseguito {message.content}", "command_ran_s": "Info: {interaction.user} ha eseguito ", "command_desc_ping": "ping", + "command_desc_setlang": "Imposta una nuova lingua per il bot (temporaneamente)", "command_ping_embed_desc": "Latenza del bot:", "command_ping_footer": "Richiesto da", "command_about_desc": "informazioni", diff --git a/bot.py b/bot.py index 9a745bd..cce5e21 100644 --- a/bot.py +++ b/bot.py @@ -23,6 +23,7 @@ import requests import discord from discord.ext import commands +from discord import app_commands from discord import Colour, Embed, File, Interaction, Message from discord.abc import Messageable @@ -30,7 +31,7 @@ from better_profanity import profanity from discord.ext import commands from modules.central import ping_server -from modules.volta.main import _ +from modules.volta.main import _, set_language from modules.markovmemory import * from modules.version import * from modules.sentenceprocessing import * @@ -353,6 +354,14 @@ async def help(ctx: commands.Context) -> None: await send_message(ctx, embed=embed) +@bot.hybrid_command(description=f"{(_('command_desc_setlang'))}") +@app_commands.describe(locale="Choose your language") +async def setlanguage(ctx: commands.Context, locale: str) -> None: + await ctx.defer() + set_language(locale) + + await ctx.send(":thumbsup:") + # Event: Called on every message @bot.event async def on_message(message: discord.Message) -> None: diff --git a/modules/globalvars.py b/modules/globalvars.py index 9431950..56cb752 100644 --- a/modules/globalvars.py +++ b/modules/globalvars.py @@ -37,7 +37,7 @@ 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.0.1" +local_version = "2.0.2" os.environ['gooberlocal_version'] = local_version REACT = os.getenv("REACT") beta = True # this makes goober think its a beta version, so it will not update to the latest stable version or run any version checks diff --git a/modules/version.py b/modules/version.py index ce38d98..f876123 100644 --- a/modules/version.py +++ b/modules/version.py @@ -19,8 +19,6 @@ def is_remote_ahead(branch='main', remote='origin'): # Automatically update the local repository if the remote is ahead def auto_update(branch='main', remote='origin'): - if launched == True: - return if launched == True: print(_("already_started")) return @@ -77,7 +75,7 @@ def check_for_update(): print(f"{YELLOW}{_('new_version').format(latest_version=latest_version, local_version=local_version)}{RESET}") print(f"{YELLOW}{_('changelog').format(VERSION_URL=VERSION_URL)}{RESET}") auto_update() - elif local_version > latest_version and beta == True: + elif beta == True: print(f"{YELLOW}You are running an \"unstable\" version of Goober, do not expect it to work properly.\nVersion {local_version}{RESET}") elif local_version > latest_version: print(f"{YELLOW}{_('modification_warning')}{RESET}")