discord.py bot rewrite AttributeError: 'Bot' object has no attribute 'send_message'












0















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'


My programm is :



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)


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



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 ?










share|improve this question



























    0















    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'


    My programm is :



    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)


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



    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 ?










    share|improve this question

























      0












      0








      0








      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'


      My programm is :



      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)


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



      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 ?










      share|improve this question














      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'


      My programm is :



      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)


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



      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 ?







      python python-3.x discord.py






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 1 at 23:33









      user10849497user10849497

      52




      52
























          1 Answer
          1






          active

          oldest

          votes


















          0














          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')





          share|improve this answer
























          • Thanks anew Tristo. I changed it for "await message.channel.send(newMessage)". I got no error but I get double messages in discord now. Why ? May be it will be easier to change to regular version of discord instead ?

            – user10849497
            Jan 1 at 23:49













          • Are you having multiple instances of the bot running at the same time? Depending on what you want to accomplish either version is fine but the currently supported one is the rewrite

            – Tristo
            Jan 1 at 23:55













          • Ok, it seems to work fine now. Thanks

            – user10849497
            Jan 2 at 0:16













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53999771%2fdiscord-py-bot-rewrite-attributeerror-bot-object-has-no-attribute-send-messa%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          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')





          share|improve this answer
























          • Thanks anew Tristo. I changed it for "await message.channel.send(newMessage)". I got no error but I get double messages in discord now. Why ? May be it will be easier to change to regular version of discord instead ?

            – user10849497
            Jan 1 at 23:49













          • Are you having multiple instances of the bot running at the same time? Depending on what you want to accomplish either version is fine but the currently supported one is the rewrite

            – Tristo
            Jan 1 at 23:55













          • Ok, it seems to work fine now. Thanks

            – user10849497
            Jan 2 at 0:16


















          0














          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')





          share|improve this answer
























          • Thanks anew Tristo. I changed it for "await message.channel.send(newMessage)". I got no error but I get double messages in discord now. Why ? May be it will be easier to change to regular version of discord instead ?

            – user10849497
            Jan 1 at 23:49













          • Are you having multiple instances of the bot running at the same time? Depending on what you want to accomplish either version is fine but the currently supported one is the rewrite

            – Tristo
            Jan 1 at 23:55













          • Ok, it seems to work fine now. Thanks

            – user10849497
            Jan 2 at 0:16
















          0












          0








          0







          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')





          share|improve this answer













          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')






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 1 at 23:40









          TristoTristo

          1,4913821




          1,4913821













          • Thanks anew Tristo. I changed it for "await message.channel.send(newMessage)". I got no error but I get double messages in discord now. Why ? May be it will be easier to change to regular version of discord instead ?

            – user10849497
            Jan 1 at 23:49













          • Are you having multiple instances of the bot running at the same time? Depending on what you want to accomplish either version is fine but the currently supported one is the rewrite

            – Tristo
            Jan 1 at 23:55













          • Ok, it seems to work fine now. Thanks

            – user10849497
            Jan 2 at 0:16





















          • Thanks anew Tristo. I changed it for "await message.channel.send(newMessage)". I got no error but I get double messages in discord now. Why ? May be it will be easier to change to regular version of discord instead ?

            – user10849497
            Jan 1 at 23:49













          • Are you having multiple instances of the bot running at the same time? Depending on what you want to accomplish either version is fine but the currently supported one is the rewrite

            – Tristo
            Jan 1 at 23:55













          • Ok, it seems to work fine now. Thanks

            – user10849497
            Jan 2 at 0:16



















          Thanks anew Tristo. I changed it for "await message.channel.send(newMessage)". I got no error but I get double messages in discord now. Why ? May be it will be easier to change to regular version of discord instead ?

          – user10849497
          Jan 1 at 23:49







          Thanks anew Tristo. I changed it for "await message.channel.send(newMessage)". I got no error but I get double messages in discord now. Why ? May be it will be easier to change to regular version of discord instead ?

          – user10849497
          Jan 1 at 23:49















          Are you having multiple instances of the bot running at the same time? Depending on what you want to accomplish either version is fine but the currently supported one is the rewrite

          – Tristo
          Jan 1 at 23:55







          Are you having multiple instances of the bot running at the same time? Depending on what you want to accomplish either version is fine but the currently supported one is the rewrite

          – Tristo
          Jan 1 at 23:55















          Ok, it seems to work fine now. Thanks

          – user10849497
          Jan 2 at 0:16







          Ok, it seems to work fine now. Thanks

          – user10849497
          Jan 2 at 0:16






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53999771%2fdiscord-py-bot-rewrite-attributeerror-bot-object-has-no-attribute-send-messa%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas