use multiple lines to list game names
* output cuts off somewhere above 400 chars * batch size of 20 should do it * may as well sort list at the same time
This commit is contained in:
parent
15eab1a86f
commit
7921f44058
6
bot.py
6
bot.py
|
@ -75,13 +75,17 @@ class Server(BaseServer):
|
|||
elif line.params[1].startswith(".list"):
|
||||
user = line.source.split('!')[0]
|
||||
if len(line.params[1].split(" ")) < 2:
|
||||
await self.send(build("PRIVMSG", [chan, "list: " + str(list(match_players[self.name + '-' + chan].keys()))]))
|
||||
games = sorted(match_players[self.name + '-' + chan].keys())
|
||||
while len(games):
|
||||
await self.send(build("PRIVMSG", [chan, "list: " + ', '.join(games[:20])]))
|
||||
del games[:20]
|
||||
else:
|
||||
game = " ".join(line.params[1].split(" ")[1:]).lower()
|
||||
if game not in match_players[self.name + '-' + chan]:
|
||||
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(".del"):
|
||||
user = line.source.split('!')[0]
|
||||
if len(line.params[1].split(" ")) < 2:
|
||||
|
|
Loading…
Reference in New Issue