-
Notifications
You must be signed in to change notification settings - Fork 389
Open
Description
设置message_reference无法正确地引用消息。
做出来的效果只有这样:
↑ 这并没有消息引用
以下是我的代码,请问应该怎么写?
# -*- coding: utf-8 -*-
import asyncio
import os
import botpy
from botpy import logging
from botpy.ext.cog_yaml import read
from botpy.message import GroupMessage, Message
from botpy.types.message import Reference
test_config = read(os.path.join(os.path.dirname(__file__), "config.yaml"))
_log = logging.get_logger()
class MyClient(botpy.Client):
async def on_ready(self):
_log.info(f"robot 「{self.robot.name}」 on_ready!")
async def on_group_at_message_create(self, message: GroupMessage):
messageResult = await message._api.post_group_message(
group_openid=message.group_openid,
msg_type=0,
msg_id=message.id,
content=f"收到了消息:{message.content}",
message_reference=Reference(message_id=message.id, ignore_get_message_error=False)
)
_log.info(messageResult)
if __name__ == "__main__":
# 通过预设置的类型,设置需要监听的事件通道
# intents = botpy.Intents.none()
# intents.public_messages=True
# 通过kwargs,设置需要监听的事件通道
intents = botpy.Intents(public_messages=True)
client = MyClient(intents=intents, is_sandbox=True)
client.run(appid=test_config["appid"], secret=test_config["secret"])Metadata
Metadata
Assignees
Labels
No labels