小编Dor*_*ray的帖子

Discord.py:如何查看频道历史记录并搜索特定消息?

本质上,我希望机器人浏览频道的消息历史记录,找到包含某些特定文本的消息,然后在同一频道中给出该消息的链接。

通过文档,我想我会使用,async for message in channel.history(params)但我无法弄清楚我的特定用例如何。

discord.py

3
推荐指数
1
解决办法
7212
查看次数

如何使用 Python Discord 机器人发送附件

我希望我的机器人在调用时将文件(不一定是图像,可以是文本文件)发送到通道。这是我的代码片段:

@bot.command(pass_context=True)
async def send(ctx):
    area=ctx.message.channel
    await bot.send_file(area, r"c:\location\of\the_file_to\send.png",content="Message test")
Run Code Online (Sandbox Code Playgroud)

但是,它给了我一个错误: AttributeError: 'Bot' object has no attribute 'send_file' 我尝试按照另一个答案的建议替换send_filesend,但这也不起作用。这里正确的语法应该是什么?

python python-3.x discord.py

1
推荐指数
1
解决办法
8011
查看次数

标签 统计

discord.py ×2

python ×1

python-3.x ×1