1
Fork 0
mirror of https://github.com/RYGhub/royal-mifia.git synced 2024-11-22 05:44:19 +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':
p = game.findplayerbyid(update.message.from_user['id'])
if p is None:
p = Player(update.message.from_user['id'], update.message.from_user['username'])
try:
p.message(bot, s.you_joined.format(game=game.name))
except TelegramError:
game.message(bot, s.error_chat_unavailable)
p = Player(update.message.from_user['id'], update.message.from_user['username'])
except KeyError:
game.message(bot, s.error_no_username)
else:
game.message(bot, s.player_joined.format(name=p.tusername))
if len(game.players) == 0:
game.admin = p
game.players.append(p)
try:
p.message(bot, s.you_joined.format(game=game.name))
except TelegramError:
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:
game.message(bot, s.error_player_already_joined)
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" \
"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
names_list = ["Cassata",
"Cannoli",