Don't ping the user .match ing, fixes #1
This commit is contained in:
parent
5f945f33a5
commit
9962c1e019
40
bot.py
40
bot.py
|
@ -40,26 +40,34 @@ class Server(BaseServer):
|
||||||
else:
|
else:
|
||||||
game = " ".join(line.params[1].split(" ")[1:]).lower()
|
game = " ".join(line.params[1].split(" ")[1:]).lower()
|
||||||
ping = ""
|
ping = ""
|
||||||
|
user = line.source.split('!')[0]
|
||||||
if game not in match_players[self.name + '-' + chan]:
|
if game not in match_players[self.name + '-' + chan]:
|
||||||
await self.send(build("PRIVMSG", [chan, "ERROR: no players in "+ game]))
|
await self.send(build("PRIVMSG", [chan, "ERROR: no players in "+ game]))
|
||||||
else:
|
else:
|
||||||
for player in match_players[self.name + '-' + chan][game]:
|
matches = match_players[self.name + '-' + chan][game]
|
||||||
pfold = self.casefold(player)
|
others = list(set(matches) - set([user])) # don't ping the user who .matched
|
||||||
if pfold in channel.users:
|
|
||||||
ping += f"{channel.users[pfold].nickname} "
|
if len(others) > 0:
|
||||||
else:
|
for player in others:
|
||||||
ping += f"{player} "
|
pfold = self.casefold(player)
|
||||||
|
if pfold in channel.users:
|
||||||
|
ping += f"{channel.users[pfold].nickname} "
|
||||||
|
else:
|
||||||
|
ping += f"{player} "
|
||||||
|
|
||||||
|
await self.send(build("PRIVMSG", [chan, "Anyone ready for " + game + f" : {ping} ?"]))
|
||||||
|
if connections[self.name]:
|
||||||
|
for connection,address in connections[self.name].items():
|
||||||
|
if connection in line.params[1]:
|
||||||
|
if ':' in address:
|
||||||
|
realaddress = address.split(':')[0]
|
||||||
|
port = address.split(':')[1]
|
||||||
|
self.send(build("PRIVMSG", [chan, f"Connect using nc {realaddress} {port}"]))
|
||||||
|
else:
|
||||||
|
self.send(build("PRIVMSG", [chan, f"Connect using nc {address} 1234"]))
|
||||||
|
else:
|
||||||
|
await self.send(build("PRIVMSG", [chan, user + ": you're the only one who plays this game :("]))
|
||||||
|
|
||||||
await self.send(build("PRIVMSG", [chan, "Anyone ready for " + game + f" : {ping} ?"]))
|
|
||||||
if connections[self.name]:
|
|
||||||
for connection,address in connections[self.name].items():
|
|
||||||
if connection in line.params[1]:
|
|
||||||
if ':' in address:
|
|
||||||
realaddress = address.split(':')[0]
|
|
||||||
port = address.split(':')[1]
|
|
||||||
self.send(build("PRIVMSG", [chan, f"Connect using nc {realaddress} {port}"]))
|
|
||||||
else:
|
|
||||||
self.send(build("PRIVMSG", [chan, f"Connect using nc {address} 1234"]))
|
|
||||||
|
|
||||||
elif line.params[1].startswith(".add"):
|
elif line.params[1].startswith(".add"):
|
||||||
user = line.source.split('!')[0]
|
user = line.source.split('!')[0]
|
||||||
|
|
Loading…
Reference in New Issue