protocol change

This commit is contained in:
cynic 2022-07-13 03:40:26 +00:00
parent 1d5832e97b
commit 2de50b158f
1 changed files with 4 additions and 4 deletions

View File

@ -48,15 +48,15 @@ class bird_inst():
try: getattr(self, "handle_"+data["type"], None)(data) 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) except Exception as e: print("hey buddy your shits fucked thought you might want to know", e)
def handle_message(self, ctx): def handle_message(self, ctx):
print("btw i just got this", ctx["data"]["message"]) print("btw i just got this", ctx["data"]["message"]["text"])
if ctx["name"] == self.config["deek_user"]: return if ctx["name"] == self.config["deek_user"]: return
mesg = ctx["data"]["message"].replace("\n", " ") mesg = ctx["data"]["message"]["text"].replace("\n", " ")
chunks = list(mesg[0+i:400+i] for i in range(0, len(mesg), 400)) chunks = list(mesg[0+i:400+i] for i in range(0, len(mesg), 400))
for m in chunks: for m in chunks:
self.irc.sendraw(privmsg.build(self.config["irc_nick"], self.config["irc_chan"], ctx["name"]+": "+m).msg) self.irc.sendraw(privmsg.build(self.config["irc_nick"], self.config["irc_chan"], ctx["name"]+": "+m).msg)
def handle_avatar(self, ctx): pass def handle_avatar(self, ctx): pass
def handle_files(self, ctx): def handle_files(self, ctx):
self.irc.sendraw(privmsg.build(self.config["irc_nick"], self.config["irc_chan"], ctx["name"]+": "+ctx["data"]["message"]).msg) self.irc.sendraw(privmsg.build(self.config["irc_nick"], self.config["irc_chan"], ctx["name"]+": "+ctx["data"]["message"]["text"]).msg)
for f in ctx["data"]["files"]: for f in ctx["data"]["files"]:
self.irc.sendraw(privmsg.build(self.config["irc_nick"], self.config["irc_chan"], f"({ctx['name']} uploaded file: {self.httpendpoint}/storage/files/{f['name']})").msg) self.irc.sendraw(privmsg.build(self.config["irc_nick"], self.config["irc_chan"], f"({ctx['name']} uploaded file: {self.httpendpoint}/storage/files/{f['name']})").msg)
def handle_exit(self, ctx): pass def handle_exit(self, ctx): pass
@ -84,4 +84,4 @@ while True:
except Exception as e: except Exception as e:
print("yo ur shits broken", e) print("yo ur shits broken", e)
print(traceback.format_exc()) print(traceback.format_exc())
continue continue