简体   繁体   English

如何使用 discord.py 制作一个检查某个服务器通道中所有消息的机器人

[英]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.

相关问题 如何让我的 discord.py 机器人对频道中发送的所有图像做出反应 - How do i make my discord.py bot react to all images sent in a channel 在 discord.py 我怎样才能让我的机器人命令只能在特定通道或特定服务器中使用? - in discord.py How can i make my bot that the commands only can be use in specific channel or specific server? 如何创建检查消息的命令 (Discord.py) - How do I make a command that checks for a message (Discord.py) 如何让我的 Discord.py 机器人计算一个人的消息? - How do I make, so my Discord.py bot counts a person's messages? 如何使用 discord.py 在系统消息频道发送问候消息 - How do I use discord.py to send a greeting message in the System Messages Channel 如何在 discord.py 的某个频道中嵌入用户加入? - How do I make an embed on user join in a certain channel in discord.py? 我如何制作使我的机器人离开服务器的命令(discord.py) - How do i make a command that make my bot leave from the server (discord.py) 如何使我使用 discord.py bot 登录的帐户加入特定服务器 - How do I make an account I logged into with a discord.py bot join a specific server 如何使 discord.py 机器人通过控制台向特定通道发送消息 - How to make a discord.py bot send a message through the console to a specific channel 如何使漫游器在另一个频道上发言? (带有discord.py) - How to make the bot speak on another channel? (with discord.py)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM