git-svn-id: file:///srv/svn/repo/chen/trunk@10 32723744-9b23-0b4a-b1da-9b2e968f9461
This commit is contained in:
czar 2021-10-31 23:46:13 +00:00
parent dc187bb3ba
commit c6988ab84d

View File

@ -7,7 +7,6 @@ import re
import io
import mimetypes
import asyncio
from collections import defaultdict
from PythonSed import Sed
from slixmpp import ClientXMPP
@ -189,6 +188,7 @@ class AngelBot(ClientXMPP):
def sed_command(self, msg, sender, mtype):
try:
text = msg["body"]
print(f"{text = }")
if not sed_cmd.match(text):
self.messages[sender]["messages"].add(text)
return
@ -207,7 +207,7 @@ class AngelBot(ClientXMPP):
self.messages[sender]["messages"].add(out)
return self.send_message(
mto=sender,
mbody=res,
mbody=out,
mtype=mtype,
)
@ -239,8 +239,10 @@ class AngelBot(ClientXMPP):
self.send_presence()
await self.get_roster()
for channel in self.autojoin:
try:
self.plugin["xep_0045"].join_muc(channel, self.nick)
await self.update_info()
except:
...
async def update_info(self):
with open("angel.png", "rb") as avatar_file:
@ -309,7 +311,6 @@ class AngelBot(ClientXMPP):
if __name__ == "__main__":
config = configparser.ConfigParser()
config.read("config.ini")
jid = config["angel"]["jid"]
password = config["angel"]["password"]
autojoin = config["angel"]["autojoin"].split()