add: lastPlayed global variable and description of new cmd

This commit is contained in:
franzo 2022-10-06 00:05:06 +02:00
parent 9962c1e019
commit b616edd808
1 changed files with 7 additions and 4 deletions

5
bot.py
View File

@ -12,6 +12,7 @@ servers = []
match_players = {}
connections = {}
admins = {}
lastPlayed = ""
def update_file(name):
with open(f"playerlist-{name}.txt", "wb") as file:
@ -41,6 +42,8 @@ class Server(BaseServer):
game = " ".join(line.params[1].split(" ")[1:]).lower()
ping = ""
user = line.source.split('!')[0]
global lastPlayed
lastPlayed = game
if game not in match_players[self.name + '-' + chan]:
await self.send(build("PRIVMSG", [chan, "ERROR: no players in "+ game]))
else:
@ -133,7 +136,7 @@ class Server(BaseServer):
await self.send(build("PRIVMSG", [chan, "Removed " + user + " from the " + game + " match list."]))
elif line.params[1].startswith(".help"):
await self.send(build("PRIVMSG", [chan, " .add game: Add user to the game list; .del game: Remove user from the game list; .match game: Ping everyone on the game list; .list game: list people added to the game; .list: list games; .remove game: removes the game from the list (admin command)"]))
await self.send(build("PRIVMSG", [chan, " .add game: Add user to the game list; .del game: Remove user from the game list; .match game: Ping everyone on the game list; .list game: list people added to the game; .list: list games; .remove game: removes the game from the list (admin command); .lastPlayed: show the last played game"]))
async def line_send(self, line: Line):
print(f"{self.name} > {line.format()}")