add: .last cmd which prints the last game played

This commit is contained in:
franzo 2022-10-06 00:06:06 +02:00
parent b616edd808
commit 89d5a4f9c3
1 changed files with 5 additions and 1 deletions

6
bot.py
View File

@ -87,7 +87,10 @@ class Server(BaseServer):
update_file(self.name + '-' + chan)
await self.send(build("PRIVMSG", [chan, "Added " + user + " to the " + game + " match list."]))
elif line.params[1].startswith(".list"):
elif line.params[1].startswith(".last"):
await self.send(build("PRIVMSG", [chan, "Last game played: " + lastPlayed]))
elif line.params[1].startswith(".list"):
user = line.source.split('!')[0]
if len(line.params[1].split(" ")) < 2:
games = sorted(match_players[self.name + '-' + chan].keys())
@ -100,6 +103,7 @@ class Server(BaseServer):
await self.send(build("PRIVMSG", [chan, "ERROR: no players in " + game + " list."]))
else:
await self.send(build("PRIVMSG", [chan, game + " players: " + str(['_' + e for e in match_players[self.name + '-' + chan][game]])]))
elif line.params[1].startswith(".remove"):
channel = self.channels[line.params[0].lstrip("@")].name
if channel in admins[self.name]: