Skip to main content

Metaplanet房间聊天客户端

使用说明

  from metaplanet_room_chat.client import doConnect
  from metaplanet_room_chat.handlers import encodePacket, Cmds

  def on_receive(packet, wsapp, config):
      print(f"收到报文:{packet}")
      data = {"roomId": 75800, "content": "我是python bot, 大家好"}
      sendPack = encodePacket(Cmds["ROOM_MSG_SEND_C"], data=data)
      wsapp.send(sendPack)

  doConnect(
      ws="ws://assets.tpulse.cn/metacat/api/websocket/chat-proxy", 
      token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI3NDcwMCIsImF1ZCI6IkNoYXQgUHJveHkiLCJuYmYiOjE2ODk2NDIwNDUsImlzcyI6Imh0dHBzOi8vdHBsYW5ldC5ydWl4aS1zaC5jb20vIiwiZXhwIjoxNjkyMjM0MDQ1LCJlbnYiOiJmYXQiLCJpYXQiOjE2ODk2NDIwNDUsImp0aSI6IjIzYmRjY2VlLTM1OTMtNGUxYS1iMjM5LTQ0MjY4OWNjMTlhZCJ9.MLjUHZdz7ANQ5jYlH-uFPJ3N3pkBWulQUPwlPxcl7iU", 
      roomId=75800, 
      uid=74700,
      on_receive=on_receive
  )

Metadata

Release files for metaplanet-room-chat 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metaplanet-room-chat 0.0.3
File Size Uploaded
metaplanet_room_chat-0.0.3.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for metaplanet-room-chat 0.0.3
File Interpreter ABI Platform
metaplanet_room_chat-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / metaplanet_room_chat-0.0.3.tar.gz

Download URL metaplanet_room_chat-0.0.3.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f1e78276f9cfd29a975f5edf2b276b07cecc7ccb51b2f47a17f6bcdd24666838
BLAKE2b-256 checksum
How to use checksums
2bde977df5c6a118542bdf9cb1d93822d4392387d192b10f79a40d7e1771e8f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / metaplanet_room_chat-0.0.3-py3-none-any.whl

Download URL metaplanet_room_chat-0.0.3-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
611a76b91f33568d410a63f5368509437a412f140a9a9ead89e63b4991752cda
BLAKE2b-256 checksum
How to use checksums
0af68c7fcff0d810fe93ebaf2ee6129cae9f5e3b4dd7f13b337b2c35c7650f5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page