【发布时间】:2021-08-18 07:53:57
【问题描述】:
我一直在寻找使用@name_of_object.command() 执行以下列出的操作的方法。
- 检索过去 x 天内频道中的消息。
- 检索到的消息存储在具有 3 个参数的数组中。该数组的每个元素都包含 3 种类型的信息,即 Message 、发送者和发送时间。
我在here 中搜索了答案,并认为created_at 可能有助于实现我想做的事情。谁能告诉我一些提示或我应该看哪些网站?
我做了什么:
我引用了here下面的代码
@bot.command()
async def getmsg(ctx, channel: discord.TextChannel, member: discord.Member):
msg = discord.utils.get(await channel.history(limit=100).flatten(), author=member)
# this gets the most recent message from a specified member in the past 100 messages
# in a certain text channel - just an idea of how to use its versatility
【问题讨论】:
标签: python discord discord.py