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

      • <bdo id='LZVAI'></bdo><ul id='LZVAI'></ul>

      1. <tfoot id='LZVAI'></tfoot>

        <legend id='LZVAI'><style id='LZVAI'><dir id='LZVAI'><q id='LZVAI'></q></dir></style></legend>
        <i id='LZVAI'><tr id='LZVAI'><dt id='LZVAI'><q id='LZVAI'><span id='LZVAI'><b id='LZVAI'><form id='LZVAI'><ins id='LZVAI'></ins><ul id='LZVAI'></ul><sub id='LZVAI'></sub></form><legend id='LZVAI'></legend><bdo id='LZVAI'><pre id='LZVAI'><center id='LZVAI'></center></pre></bdo></b><th id='LZVAI'></th></span></q></dt></tr></i><div id='LZVAI'><tfoot id='LZVAI'></tfoot><dl id='LZVAI'><fieldset id='LZVAI'></fieldset></dl></div>
      2. Discord.py rewrite 如何 DM 命令?

        时间:2023-10-10

        • <legend id='loC8q'><style id='loC8q'><dir id='loC8q'><q id='loC8q'></q></dir></style></legend>

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

                  <bdo id='loC8q'></bdo><ul id='loC8q'></ul>
                    <tbody id='loC8q'></tbody>
                  <tfoot id='loC8q'></tfoot>

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

                • 本文介绍了Discord.py rewrite 如何 DM 命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我试图让我的机器人在执行-help"时向用户发送帮助.

                  I am trying to have my bot DM the user the help when "-help" is executed.

                  我已经尝试在我的代码中执行此操作,但它不起作用.

                  I have tried doing this in my code already but it will not work.

                  async def help(ctx):
                    helpembed = discord.Embed(color=discord.Color.purple())
                    helpembed.set_author(name="Help")
                    helpembed.add_field(name="-new", value="Creates a new ticket. [Logged]",inline=False)
                    helpembed.add_field(name="-close", value="Closes the ticket.People with the role 'Viewing Team' can close ticets. [Logged]",inline=False)
                    helpembed.add_field(name="-setup", value='Sets Up your server so it can be used',inline=False)
                    helpembed.add_field(name="-help", value="Shows this message :rofl:",inline=False)
                    await client.send_message(ctx.message.author, embed=helpembed)
                  await ctx.send("Help sent in DM's.")```
                  
                  The bot should DM the user with help. Instead it does nothing.
                  

                  推荐答案

                  向discord.py-rewrite,你使用 User.send 方法:

                  To send a private message to a user in discord.py-rewrite, you use the User.send method:

                  async def help(ctx):
                      ...
                      await ctx.author.send(...)
                  

                  这是因为 User 是抽象 Messageable

                  This is because User is a subclass of the abstract Messageable class

                  这篇关于Discord.py rewrite 如何 DM 命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:播放音频时,最后一部分被切断.如何解决这个问 下一篇:discord.py 重写 |为我的命令出错

                  相关文章

                  最新文章

                    1. <small id='98NDh'></small><noframes id='98NDh'>

                      <tfoot id='98NDh'></tfoot>
                    2. <legend id='98NDh'><style id='98NDh'><dir id='98NDh'><q id='98NDh'></q></dir></style></legend>
                      • <bdo id='98NDh'></bdo><ul id='98NDh'></ul>
                    3. <i id='98NDh'><tr id='98NDh'><dt id='98NDh'><q id='98NDh'><span id='98NDh'><b id='98NDh'><form id='98NDh'><ins id='98NDh'></ins><ul id='98NDh'></ul><sub id='98NDh'></sub></form><legend id='98NDh'></legend><bdo id='98NDh'><pre id='98NDh'><center id='98NDh'></center></pre></bdo></b><th id='98NDh'></th></span></q></dt></tr></i><div id='98NDh'><tfoot id='98NDh'></tfoot><dl id='98NDh'><fieldset id='98NDh'></fieldset></dl></div>