fixed missing add_player implementation
This commit is contained in:
12
bot.py
12
bot.py
@@ -33,7 +33,7 @@ async def bot_start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
loop_game,
|
||||
time=datetime.time(hour=0, minute=0, second=5, tzinfo=datetime.timezone.utc),
|
||||
chat_id=chat_id,
|
||||
name=str(chat_id) # Usiamo il chat_id come nome univoco per il job
|
||||
name=str(chat_id)
|
||||
)
|
||||
print(f'Job giornaliero creato per la chat {chat_id}')
|
||||
|
||||
@@ -42,16 +42,18 @@ async def echo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
await update.message.reply_text(_botsyms.WIP_MSG)
|
||||
|
||||
async def add_player(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
player= 'XXX' #XXX implement me, get from user request
|
||||
print(f'sto aggiungendo il giocatore {player} all\'arena')
|
||||
_brsim.BrSimArena
|
||||
Arena= context.application.bot_data['arena']
|
||||
Arena.add_player(player)
|
||||
|
||||
|
||||
def main():
|
||||
# Crea l'applicazione e passagli il token del tuo bot.
|
||||
application = Application.builder().token(_botsyms.TOKEN).build()
|
||||
|
||||
# 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))
|
||||
|
||||
print('Bot in esecuzione...')
|
||||
|
||||
Reference in New Issue
Block a user