wechaty/puppet

Feature Request: System Message Type

su-chang opened this issue · 0 comments

Feature Request

System Message is important type for IM system, e.g. WeChat, WeCom, WhatsApp and so on. But we can not find a message type could stand for System Message below.

/**
* Wechaty Puppet Unified Schema for Message
*/
export enum MessageType {
Unknown = 0,
Attachment = 1, // Attach(6),
Audio = 2, // Audio(1), Voice(34)
Contact = 3, // ShareCard(42)
ChatHistory = 4, // ChatHistory(19)
Emoticon = 5, // Sticker: Emoticon(15), Emoticon(47)
Image = 6, // Img(2), Image(3)
Text = 7, // Text(1)
Location = 8, // Location(48)
MiniProgram = 9, // MiniProgram(33)
GroupNote = 10, // GroupNote(53)
Transfer = 11, // Transfers(2000)
RedEnvelope = 12, // RedEnvelopes(2001)
Recalled = 13, // Recalled(10002)
Url = 14, // Url(5)
Video = 15, // Video(4), Video(43)
Post = 16, // Moment, Channel, Tweet, etc
}

BTW, the number in bracket is out of style, Wechaty is not only for WeChat now.

For WeChat we could find SysNotice and Sys in WechatMessageType, but these types could not used to other IM.

SysNotice = 9999,
Sys = 10000,

So let's add a new type, named System for all IM in Wechaty system.

Example

System message in WeCom.

{
  "appinfo": "NmDJmVR0Tem8JcD",
  "content": "微信授权已过期,消息无法发送成功,请使用微信重新授权后再试",
  "content_type": 1011,
  "conversation_id": "S:7881299706980847_1688852009198694",
  "is_pc": 0,
  "receiver": "1688852009198694",
  "send_time": "1653479895",
  "sender": "7881299706980847",
  "sender_name": "",
  "server_id": "1973927"
}
{
  "appinfo": "dKov80YNRsKQxdD",
  "content": "由于违规行为,你帐号的此功能已被封禁。",
  "content_type": 1011,
  "conversation_id": "S:7881303318051905_1688857603302323",
  "is_pc": 0,
  "receiver": "1688857603302323",
  "send_time": "1654142067",
  "sender": "7881303318051905",
  "sender_name": "",
  "server_id": "1197474"
}