Arena and Player start populating more basic methods of the object

This commit is contained in:
Crystal
2025-07-23 23:43:26 +02:00
parent 7710bebdbe
commit 7697b91ec8
5 changed files with 64 additions and 11 deletions

15
bot.py
View File

@@ -16,18 +16,19 @@ async def loop_game(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
async def bot_start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
await update.message.reply_text(_botsyms.START_MSG)
print('Sto costruendo il mondo di gioco...')
chat_id = update.effective_chat.id
print(f'{chat_id}: Sto costruendo il mondo di gioco...')
Arena= _brsim.init_arena()
players= Arena.players
weapons= Arena.weapons
print(f'Ecco il mondo di gioco, questi sono i giocatori: {players}')
print(f'Ecco le armi disponibili nel mondo: {weapons}')
await update.message.reply_text('Ho creato il mondo di gioco')
await update.message.reply_text(f'Ecco la lista degli sfortunati avventurieri: {players}')
await update.message.reply_text(f'Queste le armi che avranno a disposizione nell\'arena: {weapons}')
await update.message.reply_text(f'Ecco la lista degli sfortunati avventurieri:\n{players}')
await update.message.reply_text(f'Queste le armi che avranno a disposizione nell\'arena:\n{weapons}')
context.application.bot_data['arena'] = Arena
chat_id = update.effective_chat.id
context.job_queue.run_daily(
loop_game,
time=datetime.time(hour=0, minute=0, second=5, tzinfo=datetime.timezone.utc),
@@ -38,7 +39,9 @@ async def bot_start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
async def echo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
testo_ricevuto = update.message.text
await update.message.reply_text(f'Ehi, mio padre mi sta ancora finendo di creare, abbi pazienza, che fretta hai di entrare in questo mondo per morire?')
await update.message.reply_text(_botsyms.WIP_MSG)
async def add_player(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
def main():
# Crea l'applicazione e passagli il token del tuo bot.
@@ -46,6 +49,8 @@ def main():
# Gestisce il comando /start
application.add_handler(CommandHandler('start', bot_start))
# Gestisce il comando /addplayer
application.add_handler(CommandHandler('addplayer', add_player))
# Gestisce tutti gli altri messaggi di testo
application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, echo))