Python Discord如何发送消息?

时间:2020-06-28 10:54:29

标签: python discord.py

我正在尝试手动发送消息,而不等待用户发送消息。基本上,我希望能够在服务器端和邮件用户完成http请求时提醒用户

from discord.ext import commands



client = commands.Bot(command_prefix=".")

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

1 个答案:

答案 0 :(得分:0)

您可以获取具有ID的用户并向他发送消息。示例:

@client.event
async def on_ready():
    await client.get_user(USER_ID).send("Text Message")