From 4caa4e925845a6f1539dd7f55422a8ef3f2e8b55 Mon Sep 17 00:00:00 2001 From: cynic Date: Fri, 12 Jul 2024 00:28:37 -0400 Subject: [PATCH] roomid check, send id w msg --- config.json | 5 +++-- main.py | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index a69bb93..686d929 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,7 @@ { - "deek_user": "YOUR_USERNAME_HERE", - "deek_passwd": "YOUR_PASSWORD_HERE", + "deek_user": "ur usrnm", + "deek_passwd": "ur pswd", + "deek_roomid": 1, "irc_serb": "irc.rizon.net", "irc_port": 7000, "irc_nick": "birdbridge", diff --git a/main.py b/main.py index e72efda..9cf038a 100644 --- a/main.py +++ b/main.py @@ -55,13 +55,17 @@ class bird_inst(): try: getattr(self, "handle_"+data["type"], None)(data) except Exception as e: print("hey buddy your shits fucked thought you might want to know", e) def handle_message(self, ctx): + room = int(ctx["roomId"]) + if room != self.config["deek_roomid"]: return print("btw i just got this", ctx["data"]["text"]) ctx["data"]["text"] = html.unescape(ctx["data"]["text"]) if ctx["data"]["name"] == self.config["deek_user"]: return mesg = ctx["data"]["text"].replace("\n", " ") chunks = list(mesg[0+i:400+i] for i in range(0, len(mesg), 400)) + chunks = ["<"+ctx["data"]["name"]+"> "+m for m in chunks] + chunks[0] = f"(#{ctx['data']['id']}) " + chunks[0] for m in chunks: - self.limiter.action(True, self.irc.sendraw, (privmsg.build(self.config["irc_nick"], self.config["irc_chan"], "<"+ctx["data"]["name"]+"> "+m).msg,)) + self.limiter.action(True, self.irc.sendraw, (privmsg.build(self.config["irc_nick"], self.config["irc_chan"], m).msg,)) def handle_messageStart(self, ctx): pass def handle_messageChange(self, ctx): pass def handle_messageEnd(self, ctx): self.handle_message(ctx)