【问题标题】:How do I make a warn command using discord.py?如何使用 discord.py 发出警告命令?
【发布时间】:2018-03-11 21:10:33
【问题描述】:

我尝试了几种方法,例如发送直接消息以发送警告,但我找不到正确的脚本,我尝试使用文档,但找不到任何有用的信息,我想知道如果我能得到一些帮助..

【问题讨论】:

  • 编程是一项实际技能。如果您想编写自己的代码,则必须学习它。

标签: python warnings discord discord.py


【解决方案1】:

Client.send_message 传递给User 对象将允许您向该用户发送消息。 (在实验重写分支上,这个已经被User.send代替了)下面是一个基本的例子

@client.event
async def on_message(message):
    author = message.author
    if author == client.user:
        return
    if 'password' in message.content:
        await client.send_message(author, 'Do not say password')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-20
    • 2021-03-04
    • 1970-01-01
    • 2020-03-31
    • 2021-05-05
    • 1970-01-01
    • 2019-03-26
    • 2018-06-07
    相关资源
    最近更新 更多