[英]How do I use discord.py to make a bot that checks through all messages in a certain server channel
I am making a discord bot that checks through all messages in a particular server channel and adds a reaction if the message has certain content.我正在制作一个 discord 机器人,它检查特定服务器通道中的所有消息,并在消息具有某些内容时添加反应。 I know how to do the latter btw, but I do not know how to make the bot check through every message in the server.顺便说一句,我知道如何做后者,但我不知道如何让机器人检查服务器中的每条消息。 Please tell me how.请告诉我怎么做。
async for... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)
Returns an AsyncIterator that enables receiving the destination's message history.返回允许接收目标消息历史记录的 AsyncIterator。
You must have read_message_history
permissions to use this.您必须具有read_message_history
权限才能使用它。
example: messages = await channel.history(limit=123).flatten()
to get channel history messages, into a flatten list示例: messages = await channel.history(limit=123).flatten()
获取频道历史消息,放入扁平列表
fromhttps://discordpy.readthedocs.io/en/latest/api.html#textchannel来自https://discordpy.readthedocs.io/en/latest/api.html#textchannel
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.