add support for go-cqhttp cq code

This commit is contained in:
yanyongyu 2020-08-07 11:56:35 +08:00
parent 5186231869
commit 950dbb1115

View File

@ -136,9 +136,13 @@ class MessageSegment(BaseMessageSegment):
def face(id_: int) -> "MessageSegment":
return MessageSegment("face", {"id": str(id_)})
@staticmethod
def forward(id_: str) -> "MessageSegment":
return MessageSegment("forward", {"id": id_})
@staticmethod
def image(file: str) -> "MessageSegment":
return MessageSegment("image", {"file": "file"})
return MessageSegment("image", {"file": file})
@staticmethod
def location(latitude: float,
@ -191,6 +195,19 @@ class MessageSegment(BaseMessageSegment):
"image": img_url
})
@staticmethod
def node(id_: int) -> "MessageSegment":
return MessageSegment("node", {"id": str(id_)})
@staticmethod
def node_custom(name: str, uin: int,
content: "Message") -> "MessageSegment":
return MessageSegment("node", {
"name": name,
"uin": str(uin),
"content": str(content)
})
@staticmethod
def poke(type_: str = "Poke") -> "MessageSegment":
if type_ not in ["Poke"]:
@ -203,6 +220,10 @@ class MessageSegment(BaseMessageSegment):
def record(file: str, magic: bool = False) -> "MessageSegment":
return MessageSegment("record", {"file": file, "magic": _b2s(magic)})
@staticmethod
def replay(id_: int) -> "MessageSegment":
return MessageSegment("replay", {"id": str(id_)})
@staticmethod
def share(url: str = "",
title: str = "",