diff --git a/config.py b/config.py index 51914d2..86f093a 100644 --- a/config.py +++ b/config.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 __version__ = "v1.0.5" -npbase = "\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|^]{1,MAX} (is listening|last listened) to: \x02.+ - .*\x02 \([0-9]+ plays\)( \[.*\])?" +npbase = "\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|^]{1,MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" servers = { "ircnow": { "address": "localhost", diff --git a/ircbot.py b/ircbot.py index 8bcd167..55e82b4 100644 --- a/ircbot.py +++ b/ircbot.py @@ -10,33 +10,12 @@ from pythonlangutil.overload import Overload, signature from datetime import datetime as dt from logs import log from subprocess import run, PIPE +from config import npbase, servers, __version__ load_dotenv() -__version__ = "v1.0.5" ircsock = socket(AF_INET, SOCK_STREAM) botnick = "FireBot" -servers = { - "ircnow": { - "address": "localhost", - "port": 6601, - "interval": 200, - "pass": env["ircnow_pass"], - "channels": {"#random": 0, "#dice": 0, "#offtopic": 0}, - "admins": ["firepup", "h|thelounge", "firepup|lounge"], - }, - "efnet": { - "address": "irc.mzima.net", - "channels": {"#random": 0, "#dice": 0}, - "admins": ["firepup", "h|tl"], - }, - "replirc": { - "address": "localhost", - "pass": env["replirc_pass"], - "channels": {"#random": 0, "#dice": 0, "#main": 0, "#bots": 0, "#firebot": 0}, - "admins": ["firepup", "firepup|lounge", "h|tl"], - }, -} server = args[1] if args else "UNSTABLE BOT MODE" @@ -57,7 +36,6 @@ if __name__ == "__main__": gblrebt = "all" adminnames = servers[server]["admins"] exitcode = f"bye {botnick.lower()}" - npbase = "\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|^]{1,MAX} (is listening|last listened) to: \x02.+ - .*\x02 \([0-9]+ plays\)( \[.*\])?" np = re.compile(npbase.replace("MAX", f"{nicklen}")) queue = [] log(f"Start init for {server}", server)