ref: upload avatar
This commit is contained in:
parent
5565130e29
commit
4a9b4ccbb4
1 changed files with 22 additions and 23 deletions
33
main.py
33
main.py
|
|
@ -6,7 +6,6 @@ import configparser
|
||||||
import re
|
import re
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
import mimetypes
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from PythonSed import Sed
|
from PythonSed import Sed
|
||||||
|
|
@ -44,6 +43,7 @@ req_list = ("http://", "https://")
|
||||||
|
|
||||||
html_files = ("text/html", "application/xhtml+xml")
|
html_files = ("text/html", "application/xhtml+xml")
|
||||||
|
|
||||||
|
|
||||||
class Lifo(list):
|
class Lifo(list):
|
||||||
"""Limited size LIFO array to store messages and urls."""
|
"""Limited size LIFO array to store messages and urls."""
|
||||||
|
|
||||||
|
|
@ -285,22 +285,6 @@ class AngelBot(ClientXMPP):
|
||||||
avatar_id = self.plugin["xep_0084"].generate_id(avatar)
|
avatar_id = self.plugin["xep_0084"].generate_id(avatar)
|
||||||
avatar_bytes = len(avatar)
|
avatar_bytes = len(avatar)
|
||||||
|
|
||||||
info = {
|
|
||||||
"id": avatar_id,
|
|
||||||
"type": avatar_type,
|
|
||||||
"bytes": avatar_bytes,
|
|
||||||
}
|
|
||||||
|
|
||||||
vcard = self.plugin["xep_0054"].make_vcard()
|
|
||||||
|
|
||||||
vcard["URL"] = "https://wiki.kalli.st/Angel"
|
|
||||||
vcard["DESC"] = "Angel is a bot that can do link previews and embeds."
|
|
||||||
vcard["NICKNAME"] = "Angel"
|
|
||||||
vcard["FN"] = "Angel"
|
|
||||||
vcard["PHOTO"] = info
|
|
||||||
|
|
||||||
asyncio.gather(self.plugin["xep_0054"].publish_vcard(vcard))
|
|
||||||
|
|
||||||
asyncio.gather(self.plugin["xep_0084"].publish_avatar(avatar))
|
asyncio.gather(self.plugin["xep_0084"].publish_avatar(avatar))
|
||||||
|
|
||||||
asyncio.gather(
|
asyncio.gather(
|
||||||
|
|
@ -310,8 +294,23 @@ class AngelBot(ClientXMPP):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
info = {
|
||||||
|
"id": avatar_id,
|
||||||
|
"type": avatar_type,
|
||||||
|
"bytes": avatar_bytes,
|
||||||
|
}
|
||||||
|
|
||||||
asyncio.gather(self.plugin["xep_0084"].publish_avatar_metadata([info]))
|
asyncio.gather(self.plugin["xep_0084"].publish_avatar_metadata([info]))
|
||||||
|
|
||||||
|
vcard = self.plugin["xep_0054"].make_vcard()
|
||||||
|
|
||||||
|
vcard["URL"] = "https://wiki.kalli.st/Angel"
|
||||||
|
vcard["DESC"] = "Angel is a bot that can do link previews and embeds."
|
||||||
|
vcard["NICKNAME"] = "Angel"
|
||||||
|
vcard["FN"] = "Angel"
|
||||||
|
|
||||||
|
asyncio.gather(self.plugin["xep_0054"].publish_vcard(vcard))
|
||||||
|
|
||||||
async def message(self, msg):
|
async def message(self, msg):
|
||||||
"""Process a message."""
|
"""Process a message."""
|
||||||
if msg["type"] in ("chat", "normal"):
|
if msg["type"] in ("chat", "normal"):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue