From 26d52f2098cfcac0cdecff9987a3c83ff78edc97 Mon Sep 17 00:00:00 2001 From: "yakumo.izuru" Date: Thu, 2 Nov 2023 15:18:34 +0000 Subject: [PATCH] cleanup, discord filter Signed-off-by: Izuru Yakumo git-svn-id: file:///srv/svn/repo/chen/trunk@27 32723744-9b23-0b4a-b1da-9b2e968f9461 --- main.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index 3b0f2f8..3444631 100644 --- a/main.py +++ b/main.py @@ -105,14 +105,14 @@ class ChenBot(ClientXMPP): else: try: - lenght = 0 + length = 0 outfile = io.BytesIO() for chunk in r.iter_content( chunk_size=512, decode_unicode=False, ): - lenght += 512 - if lenght >= data_limit: + length += 512 + if length >= data_limit: return outfile.write(chunk) @@ -142,6 +142,8 @@ class ChenBot(ClientXMPP): return if "#nospoil" in msg["body"].lower(): return + if "cdn.discordapp.com" in msg["body"].lower(): + msg.reply("Ew, discord! :<\n").send() for u in urls: if u in self.messages[sender]["links"]: continue @@ -193,10 +195,6 @@ class ChenBot(ClientXMPP): mtype = "chat" sender = msg["from"].bare - edit = "urn:xmpp:message-correct:0" in str(msg) - if edit: - return - try: if not msg["oob"]["url"]: if urls := self.get_urls(msg): @@ -211,10 +209,6 @@ class ChenBot(ClientXMPP): if msg["mucnick"] == self.nick: return - edit = "urn:xmpp:message-correct:0" in str(msg) - if edit: - return - try: if not msg["oob"]["url"]: if urls := self.get_urls(msg):