Compare commits

..

No commits in common. "master" and "89d5a4f9c39398a17cd5b41657575a4b30454142" have entirely different histories.

2 changed files with 7 additions and 10 deletions

14
bot.py
View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/bin/env python3
# SPDX-License-Identifier: MIT
import asyncio, configparser
from irctokens import build, Line
@ -41,14 +41,14 @@ class Server(BaseServer):
else:
game = " ".join(line.params[1].split(" ")[1:]).lower()
ping = ""
user = line.source.split('!')[0]
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
global lastPlayed
lastPlayed = game
if len(others) > 0:
for player in others:
@ -90,7 +90,7 @@ class Server(BaseServer):
elif line.params[1].startswith(".last"):
await self.send(build("PRIVMSG", [chan, "Last game played: " + lastPlayed]))
elif line.params[1].startswith(".list"):
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())
@ -140,7 +140,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); .lastPlayed: show the last played game"]))
async def line_send(self, line: Line):
print(f"{self.name} > {line.format()}")
@ -194,7 +194,7 @@ async def main():
botnick = entry['opts']['nickname']
channels = entry['opts']['channels']
params = ConnectionParams(botnick, server, 6697)
params = ConnectionParams(botnick, server, 6697, True)
for channel in channels:
params.autojoin.append(channel)
print("Reading channel", channel)

View File

@ -1,3 +0,0 @@
python >=3.9
ircrobots ~=0.6.6
irctokens ~=2.0.2