1
0

add items also on the telegram bot

This commit is contained in:
andrea
2025-11-15 18:40:34 +01:00
parent 445c51eec7
commit d40c7addfb
5 changed files with 18 additions and 7 deletions

13
bot.py
View File

@@ -1,3 +1,5 @@
import random as _rand
from telegram.ext import Application
from telegram.ext import CommandHandler
from telegram.ext import MessageHandler
@@ -8,10 +10,18 @@ from telegram import ReplyKeyboardRemove
from utils import logs as _log
from entities import arena as _arena
from entities.items import syms as _isyms
from bot_libs import special_commands as _scmd
from bot_libs import syms as _botsyms
from bot_libs import commands_handling as _cmd
def bot_get_random_items():
items= []
nitems= _rand.randint(3,5)
for n in range(nitems):
itype= _rand.sample(_isyms.ITEMS_LIST, 1)[0]
items.append(itype)
return items
async def bot_start(update, context):
await update.message.reply_text(_botsyms.START_MSG)
@@ -30,7 +40,8 @@ async def bot_start(update, context):
chat_id = update.effective_chat.id
_log.log_debug(f'bot_start: {chat_id} - I\'m building the world\'s game...')
Arena= _arena.BrSimArena()
items= bot_get_random_items()
Arena= _arena.BrSimArena(items= items)
await update.message.reply_text('Ho creato il mondo di gioco', reply_markup=reply_markup)
context.application.bot_data['arena'] = Arena