Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/core/elements/message/__init__.py

87 lines
2.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class MsgInfo:
__slots__ = ["targetId", "senderId", "senderName", "targetFrom", "senderInfo", "senderFrom"]
def __init__(self,
targetId: [int, str],
senderId: [int, str],
senderName: str,
targetFrom: str,
senderFrom: str
):
self.targetId = targetId
self.senderId = senderId
self.senderName = senderName
self.targetFrom = targetFrom
self.senderFrom = senderFrom
class Session:
def __init__(self, message, target, sender):
self.message = message
self.target = target
self.sender = sender
class MessageSession:
__slots__ = ("target", "session", "trigger_msg", "parsed_msg",)
def __init__(self,
target: MsgInfo,
session: Session):
self.target = target
self.session = session
async def sendMessage(self, msgchain, quote=True):
"""
用于向消息发送者回复消息。
:param msgchain: 消息链若传入str则自动创建一条带有Plain元素的消息链
:param quote: 是否引用传入dict中的消息仅对Group消息有效默认为True
:return: 被发送的消息链
"""
...
async def waitConfirm(self):
"""
一次性模板,用于等待触发对象确认。
:param display_msg: 函数传入的dict
:return: 若对象发送confirm_command中的其一文本时返回True反之则返回False
"""
...
def asDisplay(self):
"""
用于将消息转换为一般文本格式。
"""
...
async def delete(self):
"""
用于删除这条消息。
"""
...
def checkPermission(self):
"""
用于检查消息发送者在对象内的权限。
"""
...
class Typing:
def __init__(self, msg):
"""
:param msg: 本条消息由于此class需要被一同传入下游方便调用所以作为子class存在将来可能会有其他的解决办法。
"""
...
def checkSuperUser(self):
"""
用于检查消息发送者是否为超级用户。
"""
...
class Feature:
"""
此消息来自的客户端所支持的消息特性一览用于不同平台适用特性判断如QQ支持消息类型的语音而Discord不支持
"""
image = ...
voice = ...