<bdo id='LVWDb'></bdo><ul id='LVWDb'></ul>
  • <tfoot id='LVWDb'></tfoot>

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

    2. <small id='LVWDb'></small><noframes id='LVWDb'>

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

        discord.py bot rewrite AttributeError: 'Bot' object h

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

              <tbody id='wGv7r'></tbody>
            1. <small id='wGv7r'></small><noframes id='wGv7r'>

                  本文介绍了discord.py bot rewrite AttributeError: 'Bot' object has no attribute 'send_message'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我为 discord 制作了一个机器人,当我在本地启动它时它运行良好.我在 heroku 上构建它,它似乎也可以正常工作(感谢 Tristo).但在日志中我收到以下消息:

                  I made a bot for discord and it works fine when I launch it in local. I build it on heroku and It's seems to work fine too (thanks to Tristo). But in the log I get the following message :

                  2019-01-01T23:06:50.131982+00:00 app[worker.1]: Ignoring exception in on_message
                  2019-01-01T23:06:50.132550+00:00 app[worker.1]: Traceback (most recent call last):
                  2019-01-01T23:06:50.132589+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/discord/client.py", line 227, in _run_event
                  2019-01-01T23:06:50.132590+00:00 app[worker.1]:     await coro(*args, **kwargs)
                  2019-01-01T23:06:50.132593+00:00 app[worker.1]:   File "run.py", line 14, in on_message
                  2019-01-01T23:06:50.132594+00:00 app[worker.1]:     await client.send_message(message.channel, newMessage)
                  2019-01-01T23:06:50.132616+00:00 app[worker.1]: AttributeError: 'Bot' object has no attribute 'send_message'
                  

                  我的程序是:

                  from discord.ext.commands import Bot
                  import os
                  
                  BOT_PREFIX = ("?")
                  access_token= os.environ["ACCESS_TOKEN"]
                  
                  client = Bot(command_prefix=BOT_PREFIX)
                  
                  @client.event
                  async def on_message(message):
                       if message.content.startswith("?"):
                           newMessage = 'text' + str(message.content)[1:].upper() + '.png'
                           await client.send_message(message.channel, newMessage)
                  
                  client.run(access_token)
                  

                  我的 requirements.txt 仅包含git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[语音]"

                  My requirements.txt includes only "git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]"

                  我尝试使用send"而不是send_message"(类似帖子中的答案),但没有任何变化.

                  I tried to use "send" instead of "send_message" (the answer in a similar post) but nothing changes.

                  尽管属性消息错误,我的机器人似乎仍然可以工作.你能帮我理解发生了什么吗?

                  My bot seems to work despite the attribute message error. Could you help me to understand what happened, please ?

                  推荐答案

                  你已经安装了 的 discord.py 的 rewrite 分支.io/en/rewrite/migrating.html#sending-messages" rel="nofollow noreferrer">以不同的方式发送消息

                  You've installed the rewrite branch of discord.py that does sending messages in a different way

                  # before
                  await client.send_message(channel, 'Hello')
                  
                  # after
                  await channel.send('Hello')
                  

                  这篇关于discord.py bot rewrite AttributeError: 'Bot' object has no attribute 'send_message'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:从用户 id 获取用户名 |不和谐.py 下一篇:如何在 Heroku 上安装 discord.py-rewrite 依赖项以进行

                  相关文章

                  最新文章

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

                  1. <tfoot id='9lPTX'></tfoot>
                  2. <small id='9lPTX'></small><noframes id='9lPTX'>

                    • <bdo id='9lPTX'></bdo><ul id='9lPTX'></ul>