cleanup, discord filter
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja> git-svn-id: file:///srv/svn/repo/chen/trunk@27 32723744-9b23-0b4a-b1da-9b2e968f9461
This commit is contained in:
parent
040037ac70
commit
26d52f2098
16
main.py
16
main.py
@ -105,14 +105,14 @@ class ChenBot(ClientXMPP):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
lenght = 0
|
length = 0
|
||||||
outfile = io.BytesIO()
|
outfile = io.BytesIO()
|
||||||
for chunk in r.iter_content(
|
for chunk in r.iter_content(
|
||||||
chunk_size=512,
|
chunk_size=512,
|
||||||
decode_unicode=False,
|
decode_unicode=False,
|
||||||
):
|
):
|
||||||
lenght += 512
|
length += 512
|
||||||
if lenght >= data_limit:
|
if length >= data_limit:
|
||||||
return
|
return
|
||||||
outfile.write(chunk)
|
outfile.write(chunk)
|
||||||
|
|
||||||
@ -142,6 +142,8 @@ class ChenBot(ClientXMPP):
|
|||||||
return
|
return
|
||||||
if "#nospoil" in msg["body"].lower():
|
if "#nospoil" in msg["body"].lower():
|
||||||
return
|
return
|
||||||
|
if "cdn.discordapp.com" in msg["body"].lower():
|
||||||
|
msg.reply("Ew, discord! :<\n").send()
|
||||||
for u in urls:
|
for u in urls:
|
||||||
if u in self.messages[sender]["links"]:
|
if u in self.messages[sender]["links"]:
|
||||||
continue
|
continue
|
||||||
@ -193,10 +195,6 @@ class ChenBot(ClientXMPP):
|
|||||||
mtype = "chat"
|
mtype = "chat"
|
||||||
sender = msg["from"].bare
|
sender = msg["from"].bare
|
||||||
|
|
||||||
edit = "urn:xmpp:message-correct:0" in str(msg)
|
|
||||||
if edit:
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not msg["oob"]["url"]:
|
if not msg["oob"]["url"]:
|
||||||
if urls := self.get_urls(msg):
|
if urls := self.get_urls(msg):
|
||||||
@ -211,10 +209,6 @@ class ChenBot(ClientXMPP):
|
|||||||
if msg["mucnick"] == self.nick:
|
if msg["mucnick"] == self.nick:
|
||||||
return
|
return
|
||||||
|
|
||||||
edit = "urn:xmpp:message-correct:0" in str(msg)
|
|
||||||
if edit:
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not msg["oob"]["url"]:
|
if not msg["oob"]["url"]:
|
||||||
if urls := self.get_urls(msg):
|
if urls := self.get_urls(msg):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user