mode, scanline, ignore

master
dsc 2 years ago
parent d457a25c88
commit 27c95e3cc5

@ -16,7 +16,7 @@ import aiohttp
from settings import * from settings import *
IGNORE_NICKS = ["monerobux", "denise"] IGNORE_NICKS = ["monerobux", "denise", "quotez"]
TASK_QUEUE = asyncio.Queue() TASK_QUEUE = asyncio.Queue()
TASK_AUTHORS = {} TASK_AUTHORS = {}
FONT = ImageFont.truetype('font-bold.ttf', 22) FONT = ImageFont.truetype('font-bold.ttf', 22)
@ -185,11 +185,15 @@ async def handle_msg(nick, msg, target, now: float):
if "re @" in msg: if "re @" in msg:
return return
if "!dall" not in msg: if "!dall " not in msg:
return return
msg = msg[msg.find("!dall"):] if not SCANLINE:
msg = msg[5:].strip() if not msg.strip().startswith("!dall "):
return
msg = msg[msg.find("!dall "):]
msg = msg[6:].strip()
if len(msg) <= 8: if len(msg) <= 8:
return _err(target, f"longer query required.") 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) TASK_AUTHORS.setdefault(nick, 0)
if TASK_AUTHORS[nick] >= 4: if TASK_AUTHORS[nick] >= 4:
err = f"{nick}: you already queued 4 thingies, patient!!11" 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 return
TASK_AUTHORS[nick] += 1 TASK_AUTHORS[nick] += 1
task = Task(channel=target, author=nick, term=msg, dt=int(now)) task = Task(channel=target, author=nick, term=msg, dt=int(now))
await TASK_QUEUE.put(task) await TASK_QUEUE.put(task)
bot.send("NOTICE", target=target, message=f"generating...") bot.send("PRIVMSG", target=target, message=f"generating...")
async def main(): async def main():
@ -252,7 +256,9 @@ async def main():
_lower_author_task_count(task.author) _lower_author_task_count(task.author)
completed_secs = int((datetime.now() - now).total_seconds()) 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) await asyncio.sleep(10)
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()

@ -3,4 +3,6 @@ IRC_HOST = "localhost"
IRC_PORT = 6667 IRC_PORT = 6667
IRC_TLS = False IRC_TLS = False
IRC_CHANNELS = ["#lol"] IRC_CHANNELS = ["#lol"]
MODE = 'monero' MODE = 'monero'
SCANLINE = False
NOTICES = True
Loading…
Cancel
Save