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

non mi ricordo cosa ho fatto ma #20

This commit is contained in:
Steffo 2016-06-03 22:04:37 +02:00
parent 49c50681a7
commit 756941d084

46
main.py
View file

@ -428,17 +428,17 @@ class Game:
self.message(bot, s.end_mifia_outnumber + s.victory_mifia) self.message(bot, s.end_mifia_outnumber + s.victory_mifia)
for player in self.players: for player in self.players:
if player.role.team == 'Good': if player.role.team == 'Good':
player.message(s.end_mifia_outnumber + s.defeat) player.message(bot, s.end_mifia_outnumber + s.defeat)
elif player.role.team == 'Evil': elif player.role.team == 'Evil':
player.message(s.end_mifia_outnumber + s.victory) player.message(bot, s.end_mifia_outnumber + s.victory)
self.endgame() self.endgame()
elif mifiosi == 0: elif mifiosi == 0:
self.message(bot, s.end_mifia_killed + s.victory_royal) self.message(bot, s.end_mifia_killed + s.victory_royal)
for player in self.players: for player in self.players:
if player.role.team == 'Good': if player.role.team == 'Good':
player.message(s.end_mifia_killed + s.victory) player.message(bot, s.end_mifia_killed + s.victory)
elif player.role.team == 'Evil': elif player.role.team == 'Evil':
player.message(s.end_mifia_killed + s.defeat) player.message(bot, s.end_mifia_killed + s.defeat)
self.endgame() self.endgame()
def endconfig(self, bot): def endconfig(self, bot):
@ -457,7 +457,11 @@ class Game:
def save(self): def save(self):
# Crea il file. # Crea il file.
try:
file = open(str(self.groupid) + ".p", 'x') file = open(str(self.groupid) + ".p", 'x')
except FileExistsError:
pass
else:
file.close() file.close()
# Scrivi sul file. # Scrivi sul file.
file = open(str(self.groupid) + ".p", 'wb') file = open(str(self.groupid) + ".p", 'wb')
@ -771,23 +775,23 @@ def debuggameslist(bot, update):
if __debug__: if __debug__:
bot.sendMessage(update.message.from_user['id'], repr(inprogress), parse_mode=ParseMode.MARKDOWN) bot.sendMessage(update.message.from_user['id'], repr(inprogress), parse_mode=ParseMode.MARKDOWN)
updater.dispatcher.addHandler(CommandHandler('ping', ping)) updater.dispatcher.add_handler(CommandHandler('ping', ping))
updater.dispatcher.addHandler(CommandHandler('newgame', newgame)) updater.dispatcher.add_handler(CommandHandler('newgame', newgame))
updater.dispatcher.addHandler(CommandHandler('join', join)) updater.dispatcher.add_handler(CommandHandler('join', join))
updater.dispatcher.addHandler(CommandHandler('endjoin', endjoin)) updater.dispatcher.add_handler(CommandHandler('endjoin', endjoin))
updater.dispatcher.addHandler(CommandHandler('vote', vote)) updater.dispatcher.add_handler(CommandHandler('vote', vote))
updater.dispatcher.addHandler(CommandHandler('endday', endday)) updater.dispatcher.add_handler(CommandHandler('endday', endday))
updater.dispatcher.addHandler(CommandHandler('power', power)) updater.dispatcher.add_handler(CommandHandler('power', power))
updater.dispatcher.addHandler(CommandHandler('status', status)) updater.dispatcher.add_handler(CommandHandler('status', status))
updater.dispatcher.addHandler(CommandHandler('role', role)) updater.dispatcher.add_handler(CommandHandler('role', role))
updater.dispatcher.addHandler(CommandHandler('debug', debug)) updater.dispatcher.add_handler(CommandHandler('debug', debug))
updater.dispatcher.addHandler(CommandHandler('debuggameslist', debuggameslist)) updater.dispatcher.add_handler(CommandHandler('debuggameslist', debuggameslist))
updater.dispatcher.addHandler(CommandHandler('kill', kill)) updater.dispatcher.add_handler(CommandHandler('kill', kill))
updater.dispatcher.addHandler(CommandHandler('config', config)) updater.dispatcher.add_handler(CommandHandler('config', config))
updater.dispatcher.addHandler(CommandHandler('fakerole', fakerole)) updater.dispatcher.add_handler(CommandHandler('fakerole', fakerole))
updater.dispatcher.addHandler(CommandHandler('save', save)) updater.dispatcher.add_handler(CommandHandler('save', save))
updater.dispatcher.addHandler(CommandHandler('load', load)) updater.dispatcher.add_handler(CommandHandler('load', load))
updater.dispatcher.addHandler(CommandHandler('delete', delete)) updater.dispatcher.add_handler(CommandHandler('delete', delete))
updater.start_polling() updater.start_polling()
print("Bot avviato!") print("Bot avviato!")
if __name__ == "__main__": if __name__ == "__main__":