• <bdo id='2I4xz'></bdo><ul id='2I4xz'></ul>
    <tfoot id='2I4xz'></tfoot>
    <legend id='2I4xz'><style id='2I4xz'><dir id='2I4xz'><q id='2I4xz'></q></dir></style></legend>
  • <small id='2I4xz'></small><noframes id='2I4xz'>

      1. <i id='2I4xz'><tr id='2I4xz'><dt id='2I4xz'><q id='2I4xz'><span id='2I4xz'><b id='2I4xz'><form id='2I4xz'><ins id='2I4xz'></ins><ul id='2I4xz'></ul><sub id='2I4xz'></sub></form><legend id='2I4xz'></legend><bdo id='2I4xz'><pre id='2I4xz'><center id='2I4xz'></center></pre></bdo></b><th id='2I4xz'></th></span></q></dt></tr></i><div id='2I4xz'><tfoot id='2I4xz'></tfoot><dl id='2I4xz'><fieldset id='2I4xz'></fieldset></dl></div>

        如何使 discord.py 机器人私人/直接消息不是作者的

        时间:2023-10-10
        <i id='Nnrjl'><tr id='Nnrjl'><dt id='Nnrjl'><q id='Nnrjl'><span id='Nnrjl'><b id='Nnrjl'><form id='Nnrjl'><ins id='Nnrjl'></ins><ul id='Nnrjl'></ul><sub id='Nnrjl'></sub></form><legend id='Nnrjl'></legend><bdo id='Nnrjl'><pre id='Nnrjl'><center id='Nnrjl'></center></pre></bdo></b><th id='Nnrjl'></th></span></q></dt></tr></i><div id='Nnrjl'><tfoot id='Nnrjl'></tfoot><dl id='Nnrjl'><fieldset id='Nnrjl'></fieldset></dl></div>

          <small id='Nnrjl'></small><noframes id='Nnrjl'>

            <bdo id='Nnrjl'></bdo><ul id='Nnrjl'></ul>

              • <legend id='Nnrjl'><style id='Nnrjl'><dir id='Nnrjl'><q id='Nnrjl'></q></dir></style></legend>
                  <tbody id='Nnrjl'></tbody>
                1. <tfoot id='Nnrjl'></tfoot>
                2. 本文介绍了如何使 discord.py 机器人私人/直接消息不是作者的人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  假设我想制作一个具有poke"功能的机器人(也就是当有人说!poke @user#0000"时向用户发送一个说Boop"的 pm),我该怎么做?当我这样做时效果很好:

                  Say I want to make a bot with a "poke" feature (aka sends a pm to a user saying "Boop" when someone says "!poke @user#0000"), how would I do this? It works perfectly when I do this:

                  @bot.command(pass_context=True)
                  async def poke(ctx, message):
                      await client.send_message(ctx.message.author, 'boop')
                  

                  但前提是我想戳消息的作者.我想戳那些被@'d 的人.

                  but only if I want to poke the author of the message. I want to poke whoever's being @'d.

                  我知道 discord.py 文件说我可以使用这个:

                  I know the discord.py documents say I can use this:

                  start_private_message(user)
                  

                  但我不知道用什么代替用户.

                  but I don't know what to put in place of user.

                  推荐答案

                  其实比那个简单

                  @bot.command(pass_context=True)
                  async def poke(ctx, member: discord.Member):
                      await bot.send_message(member, 'boop')
                  

                  send_message 包含私人消息的逻辑,因此您不必自己使用 start_private_message.: discord.Member 称为转换器,描述为 在此处的文档中

                  send_message contains logic for private messages, so you don't have to use start_private_message yourself. The : discord.Member is called a converter, and is described in the documentation here

                  这篇关于如何使 discord.py 机器人私人/直接消息不是作者的人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:(Discord.py) 如何获取整个嵌入内容? 下一篇:在消息删除消息 Discord.py

                  相关文章

                  最新文章

                3. <small id='xvQu0'></small><noframes id='xvQu0'>

                4. <i id='xvQu0'><tr id='xvQu0'><dt id='xvQu0'><q id='xvQu0'><span id='xvQu0'><b id='xvQu0'><form id='xvQu0'><ins id='xvQu0'></ins><ul id='xvQu0'></ul><sub id='xvQu0'></sub></form><legend id='xvQu0'></legend><bdo id='xvQu0'><pre id='xvQu0'><center id='xvQu0'></center></pre></bdo></b><th id='xvQu0'></th></span></q></dt></tr></i><div id='xvQu0'><tfoot id='xvQu0'></tfoot><dl id='xvQu0'><fieldset id='xvQu0'></fieldset></dl></div>

                    <legend id='xvQu0'><style id='xvQu0'><dir id='xvQu0'><q id='xvQu0'></q></dir></style></legend>
                      <bdo id='xvQu0'></bdo><ul id='xvQu0'></ul>
                    <tfoot id='xvQu0'></tfoot>