From 27c95e3cc52a2a28cfc8423597f574f31d2f392d Mon Sep 17 00:00:00 2001 From: dsc Date: Thu, 21 Jul 2022 23:36:37 +0200 Subject: [PATCH] mode, scanline, ignore --- main.py | 20 +++++++++++++------- settings.py_example.py | 4 +++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index 8483939..f31c697 100644 --- a/main.py +++ b/main.py @@ -16,7 +16,7 @@ import aiohttp from settings import * -IGNORE_NICKS = ["monerobux", "denise"] +IGNORE_NICKS = ["monerobux", "denise", "quotez"] TASK_QUEUE = asyncio.Queue() TASK_AUTHORS = {} FONT = ImageFont.truetype('font-bold.ttf', 22) @@ -185,11 +185,15 @@ async def handle_msg(nick, msg, target, now: float): if "re @" in msg: return - if "!dall" not in msg: + if "!dall " not in msg: return - msg = msg[msg.find("!dall"):] - msg = msg[5:].strip() + if not SCANLINE: + if not msg.strip().startswith("!dall "): + return + + msg = msg[msg.find("!dall "):] + msg = msg[6:].strip() if len(msg) <= 8: return _err(target, f"longer query required.") @@ -197,13 +201,13 @@ async def handle_msg(nick, msg, target, now: float): TASK_AUTHORS.setdefault(nick, 0) if TASK_AUTHORS[nick] >= 4: err = f"{nick}: you already queued 4 thingies, patient!!11" - bot.send("NOTICE", target=target, message=err) + bot.send("PRIVMSG", target=target, message=err) return TASK_AUTHORS[nick] += 1 task = Task(channel=target, author=nick, term=msg, dt=int(now)) await TASK_QUEUE.put(task) - bot.send("NOTICE", target=target, message=f"generating...") + bot.send("PRIVMSG", target=target, message=f"generating...") async def main(): @@ -252,7 +256,9 @@ async def main(): _lower_author_task_count(task.author) completed_secs = int((datetime.now() - now).total_seconds()) - bot.send("NOTICE", target=task.channel, message=f"{url} \"{task.term_short}\" (total: {completed_secs}s, {task.author}) ") + bot.send("NOTICE" if NOTICES else "PRIVMSG", + target=task.channel, + message=f"{url} \"{task.term_short}\" (total: {completed_secs}s, {task.author}) ") await asyncio.sleep(10) loop = asyncio.get_event_loop() diff --git a/settings.py_example.py b/settings.py_example.py index bf29827..1468529 100644 --- a/settings.py_example.py +++ b/settings.py_example.py @@ -3,4 +3,6 @@ IRC_HOST = "localhost" IRC_PORT = 6667 IRC_TLS = False IRC_CHANNELS = ["#lol"] -MODE = 'monero' \ No newline at end of file +MODE = 'monero' +SCANLINE = False +NOTICES = True \ No newline at end of file