• <small id='2Suh0'></small><noframes id='2Suh0'>

        • <bdo id='2Suh0'></bdo><ul id='2Suh0'></ul>

        <tfoot id='2Suh0'></tfoot>

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

        如何让我的 discord.py 重写机器人向消息作者发送

        时间:2023-09-09
      1. <small id='ORlsS'></small><noframes id='ORlsS'>

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

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

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

                    <tbody id='ORlsS'></tbody>
                • 本文介绍了如何让我的 discord.py 重写机器人向消息作者发送私人消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我为游戏的 Discord 服务器制作了一个 Discord 机器人.我正在使用 discord.py 重写版本,我想向消息的作者发送私信.

                  I have made a Discord bot for a game's Discord server. I'm using the discord.py rewrite version and I want to send a private message to the author of the message.

                  我尝试了互联网上的其他代码,其中包括一些@bot"代码,但它总是出现错误

                  I've tried other codes on the internet which includes some "@bot" code, but it always comes up with the error

                  名称'bot'未定义"

                  "Name 'bot' is not defined"

                  如果我尝试 send_message 它会说

                  and if I try send_message it says

                  客户端对象没有属性‘send_message’"

                  "Client object has no attribute 'send_message'"

                  我的代码:

                  #I've tried this...
                  
                  @bot.command(pass_context=True)
                  async def poke(ctx, message):
                      await client.send_message(ctx.message.author, 'boop')
                  
                  #but it comes up with the error "Name 'bot' is not defined" and stuff like that
                  

                  例如,我想创建一个命令!messageme",如果用户执行该命令,我希望机器人私信给消息的作者说刚刚给你发了消息!".

                  For example, I want to create a command "!messageme", and if a user executes the command I expect the bot to private message the author of the message saying "Just messaged you!".

                  如果 Pierce#9255 在服务器中执行命令,机器人应该私信他说刚刚给你发了消息!".

                  If Pierce#9255 executes the command in the server, the bot should private message him saying "Just messaged you!".

                  推荐答案

                  你定义了你的机器人变量吗?如果没有,请执行以下操作:

                  Did you define your bot variable? If not then do this:

                  bot = commands.Bot(command_prefix='!') # Just add your desired prefix there.
                  
                  # sending dm
                  @bot.command()
                  async def poke(ctx):
                      await ctx.author.send('boop!')
                  

                  另外,如果你仍然感到困惑,那么试试这个 yt 教程:-NiByO6h7Ck

                  Also, if you still confused then just give this yt tutorial a try: -NiByO6h7Ck

                  这篇关于如何让我的 discord.py 重写机器人向消息作者发送私人消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何替换“ "的所有实例在带有换行符的字符 下一篇:自定义表情符号和动画表情符号不起作用 [disco

                  相关文章

                  最新文章

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

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

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