Merge
このコミットが含まれているのは:
コミット
b39b887e25
|
@ -1,5 +1,4 @@
|
|||
[angel]
|
||||
jid = angel@example.com
|
||||
owner = admin@example.com
|
||||
password = b0TPA55W0rD
|
||||
autojoin = room1@muc.example.com room2@muc.example.com room3@muc.example.com
|
18
main.py
18
main.py
|
@ -7,8 +7,6 @@ import re
|
|||
import io
|
||||
import mimetypes
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from collections import defaultdict
|
||||
from PythonSed import Sed
|
||||
from slixmpp import ClientXMPP
|
||||
|
@ -201,13 +199,11 @@ class AngelBot(ClientXMPP):
|
|||
|
||||
sed = Sed()
|
||||
sed.load_string(text)
|
||||
|
||||
for message in self.messages[sender]["messages"]:
|
||||
message_io = io.StringIO(message)
|
||||
res = sed.apply(message_io, None)
|
||||
print(f"{ res = }")
|
||||
out = "\n".join(res)
|
||||
print(f"{ out = }")
|
||||
if out.strip() != message.strip():
|
||||
msg = io.StringIO(message)
|
||||
if res := sed.apply(msg, None):
|
||||
out = "\n".join(res)
|
||||
self.messages[sender]["messages"].add(out)
|
||||
return self.send_message(
|
||||
mto=sender,
|
||||
|
@ -215,8 +211,7 @@ class AngelBot(ClientXMPP):
|
|||
mtype=mtype,
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
except Exception:
|
||||
return
|
||||
|
||||
def __init__(self, jid, password, nick="angel", autojoin=None):
|
||||
|
@ -248,8 +243,6 @@ class AngelBot(ClientXMPP):
|
|||
self.plugin["xep_0045"].join_muc(channel, self.nick)
|
||||
except:
|
||||
...
|
||||
# await self.update_info()
|
||||
logging.info("Session started!")
|
||||
|
||||
async def update_info(self):
|
||||
with open("angel.png", "rb") as avatar_file:
|
||||
|
@ -318,7 +311,6 @@ class AngelBot(ClientXMPP):
|
|||
if __name__ == "__main__":
|
||||
config = configparser.ConfigParser()
|
||||
config.read("config.ini")
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
jid = config["angel"]["jid"]
|
||||
password = config["angel"]["password"]
|
||||
autojoin = config["angel"]["autojoin"].split()
|
||||
|
|
読み込み中…
新しいイシューから参照