dev #2

Merged
WhatDidYouExpect merged 24 commits from dev into main 2025-07-22 00:26:21 +02:00
3 changed files with 7 additions and 7 deletions
Showing only changes of commit 59ce219183 - Show all commits

View file

@ -1,5 +1,5 @@
{ {
"minigames_hangman_game": "Parola: {display_word()}\nErrori: {wrong_guesses}/{max_wrong}", "minigames_hangman_game": "Parola: {display_word}\nErrori: {wrong_guesses}/{max_wrong}",
"minigames_hangman_lost": "Hai perso! La parola era:", "minigames_hangman_lost": "Hai perso! La parola era:",
"minigames_hangman_won": "Hai vinto! La parola era:", "minigames_hangman_won": "Hai vinto! La parola era:",
"minigames_hangman_already_guessed": "Hai già indovinato", "minigames_hangman_already_guessed": "Hai già indovinato",

2
bot.py
View file

@ -49,7 +49,7 @@ from modules.version import *
from modules.sentenceprocessing import * from modules.sentenceprocessing import *
from modules.unhandledexception import handle_exception from modules.unhandledexception import handle_exception
from modules.image import gen_meme, gen_demotivator from modules.image import gen_meme, gen_demotivator
from modules.minigames import guessthenumber, hangman # from modules.minigames import guessthenumber, hangman
sys.excepthook = handle_exception sys.excepthook = handle_exception
check_for_update() # Check for updates (from modules/version.py) check_for_update() # Check for updates (from modules/version.py)

View file

@ -7,7 +7,7 @@ import asyncio
from modules.globalvars import bot from modules.globalvars import bot
from modules.volta.main import _ from modules.volta.main import _
@bot.hybrid_command(description=_('minigames_guess_the_number')) # @bot.hybrid_command(description=_('minigames_guess_the_number'))
async def guessthenumber(ctx: commands.Context): async def guessthenumber(ctx: commands.Context):
number = random.randint(1, 10) number = random.randint(1, 10)
class GuessModal(ui.Modal, title=_('minigames_guess_the_number')): class GuessModal(ui.Modal, title=_('minigames_guess_the_number')):
@ -30,7 +30,7 @@ async def guessthenumber(ctx: commands.Context):
view.add_item(button) view.add_item(button)
await ctx.send(_('minigames_click_to_guess'), view=view) await ctx.send(_('minigames_click_to_guess'), view=view)
@bot.hybrid_command(description=_('minigames_hangman')) # @bot.hybrid_command(description=_('minigames_hangman')) nope nope nope fuck no nope no thanks no nuh uh not today nope
async def hangman(ctx: commands.Context): async def hangman(ctx: commands.Context):
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get("https://random-word-api.herokuapp.com/word?number=1") as resp: async with session.get("https://random-word-api.herokuapp.com/word?number=1") as resp:
@ -61,11 +61,11 @@ async def hangman(ctx: commands.Context):
elif wrong_guesses >= max_wrong: elif wrong_guesses >= max_wrong:
await interaction.response.edit_message(content=f"{_('minigames_hangman_lost')} **{word}**", view=None) await interaction.response.edit_message(content=f"{_('minigames_hangman_lost')} **{word}**", view=None)
else: else:
await interaction.response.edit_message(content=_('minigames_hangman_game').format(display_word=display_word,wrong_guesses=wrong_guesses,max_wrong=max_wrong), view=view) await interaction.response.edit_message(content=_('minigames_hangman_game').format(display_word=display_word(),wrong_guesses=wrong_guesses,max_wrong=max_wrong), view=view)
async def button_callback(interaction: Interaction): async def button_callback(interaction: Interaction):
await interaction.response.send_modal(GuessModal()) await interaction.response.send_modal(GuessModal())
button = ui.Button(label="Guess a letter", style=discord.ButtonStyle.primary) button = ui.Button(label=_('minigames_click_to_guess'), style=discord.ButtonStyle.primary)
button.callback = button_callback button.callback = button_callback
view = ui.View() view = ui.View()
view.add_item(button) view.add_item(button)
await ctx.send(f"Word: {display_word()}\nWrong guesses: {wrong_guesses}/{max_wrong}\nClick the button to guess a letter.", view=view) await ctx.send(_('minigames_hangman_game').format(display_word=display_word,wrong_guesses=wrong_guesses,max_wrong=max_wrong), view=view)