-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
31 lines (25 loc) · 932 Bytes
/
Copy pathtest.py
File metadata and controls
31 lines (25 loc) · 932 Bytes
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
import asyncio
import os
import hyperot
logger = hyperot.init()
from hyperot import listener, Client
from hyperot.events import *
from hyperot.common import Message
from hyperot.segments import *
async def handler_msg(event: MessageEvent, actions: listener.Actions):
if str(event.message) == ".ping":
logger.info("有人拍我!")
res = await actions.send_msg("pong", group_id=event.group_id, user_id=event.user_id)
msg_id = res.data.message_id
await actions.send_msg(
Message(Text("Hello from HypeR Core"), Image(file=f"file://{os.path.abspath('./ban.png')}")),
group_id=event.group_id, user_id=event.user_id
)
await asyncio.sleep(3)
await actions.del_msg(msg_id)
with Client() as cli:
cli.subscribe(handler_msg, [
GroupMessageEvent,
PrivateMessageEvent
])
asyncio.get_event_loop().run_until_complete(cli.run())