title: Discord Movie Bot error - AttributeError: 'Client' object has no attribute 'send_message'
body: <p>I have tried to create a discord bot for movies, but I am facing some error, while running the commands. I was able to successfully run the program and the bot shows itself online in my server. However, whenever I enter a command in my server, it shows me the following error:</p>
  <pre><code>AttributeError: 'Client' object has no attribute 'send_message'
  </code></pre>
  <p>I have already checked <a href="https://stackoverflow.com/questions/48116872/attributeerror-client-object-has-no-attribute-send-message-discord-bot">AttributeError: &#39;Client&#39; object has no attribute &#39;send_message&#39; (Discord Bot)</a> and <a href="https://stackoverflow.com/questions/57482788/attributeerror-client-object-has-no-attribute-send-message-discordbot-pyth">AttributeError: &#39;Client&#39; object has no attribute &#39;send_message&#39; (DiscordBot python)</a> but I am not able to solve my error as this is my first time creating a bot and I am new to using discord.py in general.</p>
  <p>Here is my code:</p>
  <p>bot.py</p>
  <pre><code>import discord
  import asyncio
  
  class MoviesBot:
      &quot;&quot;&quot;
          @token String -&gt; the api token for the Discord API
          @movies_provider -&gt; allows searching movies
      &quot;&quot;&quot;
      def __init__(self, token, movies_provider, subtitles_provider):
          self.__token = token
          self.__movies_provider = movies_provider
          self.__subtitles_provider = subtitles_provider
          self.__client = discord.Client()
  
          @self.__client.event
          async def on_ready(): await self.handle_ready()
  
          @self.__client.event
          async def on_message(message): await self.handle_message(message)
  
      @staticmethod
      def __get_embed_for_query_result(movie, subs, also=[]):
          # Title and Description
          formatted_title = '{} | {}'.format(movie.title, str(movie.year))
          
          description = movie.description + '\n'
          description += &quot;View on [IMDB](https://www.imdb.com/title/{})&quot;.format(movie.imdb_id)
          
          embed = discord.Embed(title=formatted_title, description=description)
          
          # Thumbnail
          embed.set_thumbnail(url=movie.thumbnail)
  
          # Download Links
          for download in movie.downloads:
              download_link = &quot;[Download]({})&quot;.format(download['url'])
              embed.add_field(name=download['title'], value=download_link, inline=False)
          
          if subs:
              embed.add_field(name=&quot;{} Subtitles&quot;.format(subs.language), value=&quot;[Download Subs]({})&quot;.format(subs.download_url))
  
          # Footer (Other search options)
          if len(also) &gt; 0:
              other_options = ', '.join(['{} ({})'.format(m.title, m.year) for m in also])
              embed.set_footer(text=&quot;Did you mean:\n&quot; + other_options)
  
          return embed
  
      async def handle_ready(self):
          # Log
          print('Logged in as')
          print(self.__client.user.name)
          print(self.__client.user.id)
          print('------')
  
      @staticmethod
      def is_movies_request(message):
          content = message.content
          # Check if keyword matches
          for keyword in ['!movie', '!movies', '!moviebot', '!moviesbot']:
              # If found a match, return True
              if content.startswith(keyword + ' ') and len(content) &gt; len(keyword + ' '):
                  return True
  
          # Return False in case no keyword matched
          return False
  
      @staticmethod
      def get_query_from_command(message):
          content = message.content
          # Remove first word
          words = content.split(' ')
          return ' '.join(words[1:])
      
      async def discord_response_for_query(self, query):
          movies = await self.__movies_provider.search_movies(query)
          # If no movies were found
          if len(movies) == 0:
              # present message
              return &quot;Sorry, I didn't find anything.&quot;, None
          
          selected_movie = movies[0]
          subtitles = await self.__subtitles_provider.search_subtitles(selected_movie)
          # If only found one movie, return it as single result
          if len(movies) == 1:
              # construct message and present it
              embed = self.__get_embed_for_query_result(selected_movie, subs=subtitles)
              return 'Got It!', embed
          # If found multiple movies, return the best one and other as hints
          elif len(movies) &gt; 1:
              alsoFound = movies[1:]
              # construct message and present it
              embed = self.__get_embed_for_query_result(selected_movie, subs=subtitles, also=alsoFound)
              return'Found some, here is the best one', embed
  
      async def handle_message(self, message):
          if self.is_movies_request(message):
              # Query movies
              query = self.get_query_from_command(message)
              tmp = await self.__client.send_message(message.channel, 'Proccessing...')
              try:
                  body, embed = await self.discord_response_for_query(query)
              except:
                  print(&quot;Error Occured&quot;)
                  body, embed = &quot;Oops. Something went wrong.&quot;, None
              
              await self.__client.edit_message(tmp, body, embed=embed)
  
      def start(self):
          # start the bot
          self.__client.run(self.__token)
  </code></pre>
  <p>main.py</p>
  <pre><code>#Movies
  from backend.movies.yst_am import YstAmProvider
  
  # Subs
  from backend.subtitles.yifysubtitles import YifySubtitlesPorivder
  from backend.subtitles.opensubtitles_org import OpenSubsProvider
  from backend.subtitles.multiple_sources import MultipleSourcesProvider
  
  # Bot
  
      from bot import MoviesBot
      from credentials import token
      
      bot = MoviesBot(token, YstAmProvider(), MultipleSourcesProvider([YifySubtitlesPorivder('Hebrew'), OpenSubsProvider('heb', 'Hebrew')]))
      bot.start()
  </code></pre>
  <p>This was the error that I received:</p>
  <pre><code>Ignoring exception in on_message
  Traceback (most recent call last):
    File &quot;/opt/homebrew/lib/python3.9/site-packages/discord/client.py&quot;, line 343, in _run_event
      await coro(*args, **kwargs)
    File &quot;/Users/Mac/Desktop/Bot/app/bot.py&quot;, line 19, in on_message
      async def on_message(message): await self.handle_message(message)
    File &quot;/Users/Mac/Desktop/Bot/app/bot.py&quot;, line 100, in handle_message
      tmp = await self.__client.send_message(message.channel, 'Proccessing...')
  AttributeError: 'Client' object has no attribute 'send_message'
  </code></pre>
  <p>Any help would be greatly appreciated. Thanks in advance!</p>