-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
test-mah.py
50 lines (45 loc) · 1.82 KB
/
test-mah.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from avilla.core import Avilla, Context, MessageReceived
from avilla.core.elements import Notice, Text
from avilla.elizabeth.protocol import ElizabethProtocol, ElizabethConfig
from avilla.standard.core.privilege import Privilege
config = ElizabethConfig(
3542928737,
"localhost",
9080,
"INITKEYWylsVdbr",
)
avilla = Avilla(message_cache_size=0)
avilla.apply_protocols(ElizabethProtocol().configure(config))
@avilla.listen(MessageReceived)
async def on_message_received(cx: Context, event: MessageReceived):
# debug(cx.artifacts.maps)
print(cx.endpoint, cx.client)
print(event.message.content)
if cx.client.follows("::group.member(3165388245)"):
print(
await cx.scene.send_message(
[
Notice(cx.client),
Text("\nHello, Avilla!"),
# Picture("C:\\Users\\TR\\Pictures\\QQ图片20210814001401.jpg")
# Embed(
# "Test Embed",
# "Hello, Avilla!",
# fields=["line1", "line2"],
# )
],
)
)
# await asyncio.sleep(1)
# msg = await cx.scene.send_message("test")
# await asyncio.sleep(3)
# await cx[MessageRevoke.revoke](msg)
# print(await cx.account.connection.call("fetch", "friendList", {}))
# async for i in cx.query("land.group(592387986).announcement"):
# print(await cx.pull(Announcement, i))
# await cx[NickCapability.set_nickname](cx.scene.into("~.member(2582049752)"), "Abylance")
# await cx[SummaryCapability.set_name](cx.scene, Summary, "测试群")
print(await cx.pull(Privilege, cx.scene))
print(await cx.pull(Privilege, cx.client))
print(await cx.pull(Privilege, cx.self))
avilla.launch()