Skip to content

消息事件

TEXT_MESSAGE

接收文本消息。

  • type: 11041
  • 常量: events.TEXT_MESSAGE
python
@wework.handle(events.TEXT_MESSAGE)
def on_text(bot: WeWork, event: dict):
    content = event["data"]["content"]
    conversation_id = event["data"]["conversation_id"]
    print(f"收到文本: {content}")

IMAGE_MESSAGE

接收图片消息。

  • type: 11042
  • 常量: events.IMAGE_MESSAGE
python
@wework.handle(events.IMAGE_MESSAGE)
def on_image(bot: WeWork, event: dict):
    print(f"收到图片: {event['data']}")

VIDEO_MESSAGE

接收视频消息。

  • type: 11043
  • 常量: events.VIDEO_MESSAGE
python
@wework.handle(events.VIDEO_MESSAGE)
def on_video(bot: WeWork, event: dict):
    print(f"收到视频: {event['data']}")

VOICE_MESSAGE

接收语音消息。

  • type: 11044
  • 常量: events.VOICE_MESSAGE
python
@wework.handle(events.VOICE_MESSAGE)
def on_voice(bot: WeWork, event: dict):
    print(f"收到语音: {event['data']}")

FILE_MESSAGE

接收文件消息。

  • type: 11045
  • 常量: events.FILE_MESSAGE
python
@wework.handle(events.FILE_MESSAGE)
def on_file(bot: WeWork, event: dict):
    print(f"收到文件: {event['data']}")

LOCATION_MESSAGE

接收位置消息。

  • type: 11046
  • 常量: events.LOCATION_MESSAGE
python
@wework.handle(events.LOCATION_MESSAGE)
def on_location(bot: WeWork, event: dict):
    print(f"收到位置: {event['data']}")

接收链接卡片消息。

  • type: 11047
  • 常量: events.LINK_CARD_MESSAGE
python
@wework.handle(events.LINK_CARD_MESSAGE)
def on_link(bot: WeWork, event: dict):
    print(f"收到链接: {event['data']}")

GIF_MESSAGE

接收 GIF 动图消息。

  • type: 11048
  • 常量: events.GIF_MESSAGE
python
@wework.handle(events.GIF_MESSAGE)
def on_gif(bot: WeWork, event: dict):
    print(f"收到动图: {event['data']}")

REDPACKET_MESSAGE

接收红包消息。

  • type: 11049
  • 常量: events.REDPACKET_MESSAGE
python
@wework.handle(events.REDPACKET_MESSAGE)
def on_redpacket(bot: WeWork, event: dict):
    print(f"收到红包: {event['data']}")

CARD_MESSAGE

接收名片消息。

  • type: 11050
  • 常量: events.CARD_MESSAGE
python
@wework.handle(events.CARD_MESSAGE)
def on_card(bot: WeWork, event: dict):
    print(f"收到名片: {event['data']}")

MINI_PROGRAM_MESSAGE

接收小程序消息。

  • type: 11066
  • 常量: events.MINI_PROGRAM_MESSAGE
python
@wework.handle(events.MINI_PROGRAM_MESSAGE)
def on_mini_program(bot: WeWork, event: dict):
    print(f"收到小程序: {event['data']}")

IMAGE_TEXT_CARD_MESSAGE

接收图文消息。

  • type: 11068
  • 常量: events.IMAGE_TEXT_CARD_MESSAGE
python
@wework.handle(events.IMAGE_TEXT_CARD_MESSAGE)
def on_image_text(bot: WeWork, event: dict):
    print(f"收到图文: {event['data']}")

VIDEO_CARD_MESSAGE

接收视频号消息。

  • type: 11124
  • 常量: events.VIDEO_CARD_MESSAGE
python
@wework.handle(events.VIDEO_CARD_MESSAGE)
def on_video_card(bot: WeWork, event: dict):
    print(f"收到视频号: {event['data']}")

REVOKE_MESSAGE

消息被撤回通知。

  • type: 11123
  • 常量: events.REVOKE_MESSAGE
python
@wework.handle(events.REVOKE_MESSAGE)
def on_revoke(bot: WeWork, event: dict):
    print(f"消息被撤回: {event['data']}")

LIVE_CARD_MESSAGE

接收视频号直播消息。

  • type: 11195
  • 常量: events.LIVE_CARD_MESSAGE
python
@wework.handle(events.LIVE_CARD_MESSAGE)
def on_live(bot: WeWork, event: dict):
    print(f"收到直播: {event['data']}")

Released under the MIT License.