使用机器人阅读 Discord 频道消息

时间:2021-02-06 16:08:46

标签: python discord bots discord.py

我正在开发一个 python 机器人来读取我在我的帐户上收到的所有传入消息。代码很简单:

import discord

client = discord.Client()

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
    messageContent = message.content
    print(messageContent)
                      
client.run('tokengoeshere')

但是,它只有在我将其添加到我管理的服务器时才有效。

如果我在频道上但我没有添加机器人的权限,有什么方法可以阅读频道的消息吗?

1 个答案:

答案 0 :(得分:2)

据我所知,如果机器人不在服务器中,则无法使用机器人读取频道,因为它对该服务器没有任何权限