1
Fork 0
mirror of https://github.com/RYGhub/royal-mifia.git synced 2024-11-25 23:24:18 +00:00

Aggiunto debugjoin per aggiungere un giocatore dummy

This commit is contained in:
Steffo 2016-12-09 17:43:44 +01:00
parent af1e2b8713
commit 677786ab35

17
main.py
View file

@ -660,6 +660,22 @@ def join(bot, update):
bot.sendMessage(update.message.chat['id'], s.error_no_games_found, parse_mode=ParseMode.MARKDOWN) bot.sendMessage(update.message.chat['id'], s.error_no_games_found, parse_mode=ParseMode.MARKDOWN)
def debugjoin(bot, update):
"""Aggiungi un bot alla partita."""
if __debug__:
game = findgamebyid(update.message.chat['id'])
if game is not None:
if game.phase == 'Join':
arg = update.message.text.split(" ")
p = Player(random.randrange(0, 10000), arg[1])
game.message(bot, s.player_joined.format(name=p.tusername))
game.players.append(p)
else:
game.message(bot, s.error_join_phase_ended)
else:
bot.sendMessage(update.message.chat['id'], s.error_no_games_found, parse_mode=ParseMode.MARKDOWN)
def status(bot, update): def status(bot, update):
"""Visualizza lo stato della partita.""" """Visualizza lo stato della partita."""
game = findgamebyid(update.message.chat['id']) game = findgamebyid(update.message.chat['id'])
@ -971,6 +987,7 @@ def debuggameslist(bot, update):
updater.dispatcher.add_handler(CommandHandler('ping', ping)) updater.dispatcher.add_handler(CommandHandler('ping', ping))
updater.dispatcher.add_handler(CommandHandler('newgame', newgame)) updater.dispatcher.add_handler(CommandHandler('newgame', newgame))
updater.dispatcher.add_handler(CommandHandler('join', join)) updater.dispatcher.add_handler(CommandHandler('join', join))
updater.dispatcher.add_handler(CommandHandler('debugjoin', debugjoin))
updater.dispatcher.add_handler(CommandHandler('endjoin', endjoin)) updater.dispatcher.add_handler(CommandHandler('endjoin', endjoin))
updater.dispatcher.add_handler(CommandHandler('vote', vote)) updater.dispatcher.add_handler(CommandHandler('vote', vote))
updater.dispatcher.add_handler(CommandHandler('endday', endday)) updater.dispatcher.add_handler(CommandHandler('endday', endday))