Compare commits
No commits in common. "19ffa45c3807d343e0258860ed4d820b5462951c" and "9962c1e019c7c77941d2087233f62fe3b05072db" have entirely different histories.
19ffa45c38
...
9962c1e019
15
bot.py
15
bot.py
|
@ -12,7 +12,6 @@ servers = []
|
|||
match_players = {}
|
||||
connections = {}
|
||||
admins = {}
|
||||
lastPlayed = ""
|
||||
|
||||
def update_file(name):
|
||||
with open(f"playerlist-{name}.txt", "wb") as file:
|
||||
|
@ -33,7 +32,7 @@ class Server(BaseServer):
|
|||
|
||||
print("Line Params: ", line.params)
|
||||
if "PRIVMSG" in line.command and any(channel in line.params[0] for channel in self.params.autojoin):
|
||||
chan = self.channels[line.params[0].lstrip("@")].name
|
||||
chan = self.channels[line.params[0].lstrip("@")].name
|
||||
if line.params[1].startswith(".match"):
|
||||
channel = self.channels[line.params[0].lstrip("@")]
|
||||
if len(line.params[1].split(" ")) < 2:
|
||||
|
@ -42,14 +41,12 @@ 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:
|
||||
matches = match_players[self.name + '-' + chan][game]
|
||||
others = list(set(matches) - set([user])) # don't ping the user who .matched
|
||||
|
||||
others = list(set(matches) - set([user])) # don't ping the user who .matched
|
||||
|
||||
if len(others) > 0:
|
||||
for player in others:
|
||||
pfold = self.casefold(player)
|
||||
|
@ -87,9 +84,6 @@ 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(".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:
|
||||
|
@ -103,7 +97,6 @@ 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]:
|
||||
|
@ -140,7 +133,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); .last: show last played game"]))
|
||||
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)"]))
|
||||
|
||||
async def line_send(self, line: Line):
|
||||
print(f"{self.name} > {line.format()}")
|
||||
|
|
Loading…
Reference in New Issue