2024-04-25 20:17:59 发布
网友
我正在制作一个discord bot,它检查特定服务器通道中的所有消息,并在消息包含特定内容时添加一个反应。顺便说一句,我知道如何执行后一种操作,但我不知道如何让bot检查服务器中的每条消息。请告诉我怎么做
async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)
返回允许接收目标消息历史记录的异步迭代器
您必须具有read_message_history权限才能使用此文件
read_message_history
例如: messages = await channel.history(limit=123).flatten() 要获取频道历史记录消息,请将其放入展开列表中
messages = await channel.history(limit=123).flatten()
从https://discordpy.readthedocs.io/en/latest/api.html#textchannel
async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)
返回允许接收目标消息历史记录的异步迭代器
您必须具有
read_message_history
权限才能使用此文件例如:
messages = await channel.history(limit=123).flatten()
要获取频道历史记录消息,请将其放入展开列表中从https://discordpy.readthedocs.io/en/latest/api.html#textchannel
相关问题 更多 >
编程相关推荐