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

Solved #38 (can't test)

This commit is contained in:
Steffo 2016-12-06 22:52:58 +01:00
parent 2e160b6e16
commit 4de819c1df
2 changed files with 16 additions and 8 deletions

20
main.py
View file

@ -629,16 +629,20 @@ def join(bot, update):
if game.phase == 'Join': if game.phase == 'Join':
p = game.findplayerbyid(update.message.from_user['id']) p = game.findplayerbyid(update.message.from_user['id'])
if p is None: if p is None:
p = Player(update.message.from_user['id'], update.message.from_user['username'])
try: try:
p.message(bot, s.you_joined.format(game=game.name)) p = Player(update.message.from_user['id'], update.message.from_user['username'])
except TelegramError: except KeyError:
game.message(bot, s.error_chat_unavailable) game.message(bot, s.error_no_username)
else: else:
game.message(bot, s.player_joined.format(name=p.tusername)) try:
if len(game.players) == 0: p.message(bot, s.you_joined.format(game=game.name))
game.admin = p except TelegramError:
game.players.append(p) game.message(bot, s.error_chat_unavailable)
else:
game.message(bot, s.player_joined.format(name=p.tusername))
if len(game.players) == 0:
game.admin = p
game.players.append(p)
else: else:
game.message(bot, s.error_player_already_joined) game.message(bot, s.error_player_already_joined)
else: else:

View file

@ -256,6 +256,10 @@ error_invalid_config = "\U000026A0 Configurazione non valida."
error_chat_unavailable = "\U000026A0 Non hai mai scritto un messaggio in chat privata a @mifiabot!\n" \ error_chat_unavailable = "\U000026A0 Non hai mai scritto un messaggio in chat privata a @mifiabot!\n" \
"Scrivigli nella chat privata `/start` e riprova." "Scrivigli nella chat privata `/start` e riprova."
# Erorre: nessun username
error_no_username = "\U000026A0 Non hai nessun username di Telegram!\n" \
"Specificane uno nelle opzioni!"
# Lista dei possibili nomi di una partita # Lista dei possibili nomi di una partita
names_list = ["Cassata", names_list = ["Cassata",
"Cannoli", "Cannoli",