• <small id='iFZA4'></small><noframes id='iFZA4'>

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

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

        <tfoot id='iFZA4'></tfoot>

        <legend id='iFZA4'><style id='iFZA4'><dir id='iFZA4'><q id='iFZA4'></q></dir></style></legend>

        Discord.py - 使用特定消息回复 DM

        时间:2023-10-10

              <tbody id='Icvh6'></tbody>
              <bdo id='Icvh6'></bdo><ul id='Icvh6'></ul>
            • <tfoot id='Icvh6'></tfoot>

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

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

                <legend id='Icvh6'><style id='Icvh6'><dir id='Icvh6'><q id='Icvh6'></q></dir></style></legend>

                  本文介绍了Discord.py - 使用特定消息回复 DM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  试图让我的机器人用这是一个 dm"回复 DM;但没有运气,这是我的代码:

                  trying to make my bot reply to DMs with "this is a dm" but no luck, here's my code:

                  @client.event
                  async def on_message(message):
                      if message.guild == null:
                          await message.channel.send('this is a dm')
                      else:
                          pass
                  

                  我也试过用这个:

                  @client.event
                  async def on_message(message):
                      if isinstance(message.channel, discord.channel.DMChannel):
                          await ctx.send('This is a DM')
                  

                  在最后一个上,由于上​​下文 (ctx) 我收到一个错误

                  On that last one, I get an error due to context (ctx)

                  推荐答案

                  您发送的第一个代码使用了 null,这在 python 中甚至都不是.第二个有点不必要,改用这个:

                  The first code you sent uses null which isn’t even a thing in python. The second one is a bit unnecessary, use this instead:

                  @client.event
                  async def on_message(message):
                      if not message.guild:
                          await message.channel.send('this is a dm')
                  

                  这篇关于Discord.py - 使用特定消息回复 DM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Discord.py(重写)on_member_update 无法正常工作 下一篇:无法在聊天中显示错误

                  相关文章

                  最新文章

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

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

                      <legend id='mp7HB'><style id='mp7HB'><dir id='mp7HB'><q id='mp7HB'></q></dir></style></legend>
                    1. <small id='mp7HB'></small><noframes id='mp7HB'>

                      <tfoot id='mp7HB'></tfoot>