1
Fork 0
mirror of https://github.com/RYGhub/royal-mifia.git synced 2025-02-16 13:24:06 +00:00
This commit is contained in:
Steffo 2016-05-28 00:13:34 +02:00
parent c8f3d1681a
commit 2286e66720

13
main.py
View file

@ -18,6 +18,7 @@ updater = Updater(token)
freenames = s.names_list.copy()
# Ruoli possibili per i giocatori
# Base di un ruolo
class Role:
@ -144,7 +145,7 @@ class Angelo(Role):
self.powerdesc = s.angel_power_description
def __repr__(self) -> str:
if protecting is None:
if self.protecting is None:
r = "<Role: Angelo>"
else:
r = "<Role: Angelo, protecting {target}>".format(target=self.protecting.tusername)
@ -162,9 +163,9 @@ class Angelo(Role):
self.protecting = selected
player.message(bot, s.angel_target_selected.format(target=self.protecting.tusername))
else:
player.message(bot, error_angel_no_selfprotect)
player.message(bot, s.error_angel_no_selfprotect)
else:
player.message(bot, error_username)
player.message(bot, s.error_username)
def onendday(self, bot, game):
@ -200,6 +201,7 @@ class Player:
# Perchè questo esiste?
self.alive = False
class Game:
"""Classe di una partita, contenente parametri riguardanti stato della partita
e informazioni sul gruppo di Telegram."""
@ -354,7 +356,6 @@ class Game:
else:
return list()
def endday(self, bot):
"""Finisci la giornata, uccidi il più votato del giorno ed esegui gli endday di tutti i giocatori."""
# Conta i voti ed elimina il più votato.
@ -449,6 +450,7 @@ def findgamebyname(name) -> Game:
if game.name.lower() == name.lower():
return game
# Comandi a cui risponde il bot
def ping(bot, update):
"""Ping!"""
@ -551,6 +553,7 @@ def endjoin(bot, update):
else:
bot.sendMessage(update.message.chat['id'], s.error_no_games_found, parse_mode=ParseMode.MARKDOWN)
def config(bot, update):
"""Configura il parametro richiesto."""
game = findgamebyid(update.message.chat['id'])
@ -649,6 +652,7 @@ def power(bot, update):
else:
bot.sendMessage(update.message.chat['id'], s.error_private_required, parse_mode=ParseMode.MARKDOWN)
def role(bot, update):
"""Visualizza il tuo ruolo."""
game = findgamebyid(update.message.chat['id'])
@ -666,7 +670,6 @@ def role(bot, update):
bot.sendMessage(update.message.chat['id'], s.error_no_games_found, parse_mode=ParseMode.MARKDOWN)
def debuggameslist(bot, update):
"""Visualizza l'elenco delle partite in corso."""
bot.sendMessage(update.message.from_user['id'], repr(inprogress), parse_mode=ParseMode.MARKDOWN)