allow multiple players insertion
This commit is contained in:
10
bot.py
10
bot.py
@@ -52,7 +52,7 @@ async def bot_start(update, context):
|
||||
context.application.bot_data['arena'] = Arena
|
||||
|
||||
async def start_loop_game(update, context, seconds):
|
||||
await update.message.reply_text(f'Ok capo!! giochero\' per te ogni {seconds}secondi')
|
||||
await update.message.reply_text(f'Ok capo!! giochero\' per te ogni {seconds}s')
|
||||
chat_id = update.effective_chat.id
|
||||
if 'arena' not in context.application.bot_data:
|
||||
print(f'{chat_id}: Arena non trovata')
|
||||
@@ -81,7 +81,7 @@ async def bot_commands(update, context):
|
||||
context.application.bot_data['ask_name'] = 1
|
||||
if 'ask_seconds' in context.application.bot_data:
|
||||
del(context.application.bot_data['ask_seconds'])
|
||||
return await update.message.reply_text('Inserisci il Nome del giocatore')
|
||||
return await update.message.reply_text('Inserisci il Nome del giocatore (o piu\' nomi separati da virgola)')
|
||||
if text == 'Get Players':
|
||||
print(f'bot_command: {chat_id} Get Players')
|
||||
return await _bot_player.get_players(update, context)
|
||||
@@ -109,11 +109,15 @@ async def bot_commands(update, context):
|
||||
except: return
|
||||
seconds= max(1, text)
|
||||
return await start_loop_game(update, context, seconds)
|
||||
|
||||
waiting_for_name= context.application.bot_data.get('ask_name')
|
||||
if waiting_for_name:
|
||||
print(f'bot_command: {chat_id} Collected Player Name {text}')
|
||||
del(context.application.bot_data['ask_name'])
|
||||
return await _bot_player.add_player(update, context, text)
|
||||
players= text.split(',')
|
||||
for player in players:
|
||||
await _bot_player.add_player(update, context, player.strip())
|
||||
return
|
||||
|
||||
print(f'{chat_id} ha inviato questo testo: {text}')
|
||||
await update.message.reply_text(_botsyms.WIP_MSG)
|
||||
|
||||
Reference in New Issue
Block a user