MCPcopy
hub / github.com/wechaty/python-wechaty / message

Function message

examples/ding-dong-bot.py:20–34  ·  view source on GitHub ↗

back on message

(msg: Message)

Source from the content-addressed store, hash-verified

18
19
20async def message(msg: Message) -> None:
21 """back on message"""
22 from_contact = msg.talker()
23 text = msg.text()
24 room = msg.room()
25 if text == 'ding':
26 conversation: Union[
27 Room, Contact] = from_contact if room is None else room
28 await conversation.ready()
29 await conversation.say('dong')
30 file_box = FileBox.from_url(
31 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/'
32 'u=1116676390,2305043183&fm=26&gp=0.jpg',
33 name='ding-dong.jpg')
34 await conversation.say(file_box)
35
36bot: Optional[Wechaty] = None
37

Callers

nothing calls this directly

Calls 5

talkerMethod · 0.80
textMethod · 0.80
roomMethod · 0.80
readyMethod · 0.45
sayMethod · 0.45

Tested by

no test coverage detected