title: Send a private messege to everyone that has a role in discord
body: <p>I am trying to send a private message to everyone in a discord channel if they have a certain role.</p>
  
  <p>I manage to find this : </p>
  
  <pre><code>from discord.ext import commands
  import discord
  
  TOKEN = 'xxx'
  
  bot = commands.Bot(command_prefix='!')
  
  @bot.command(pass_context=True)
  async def message_role(ctx, role: discord.Role, *, message):
      for member in ctx.message.server.members:
          if role in member.roles:
              await bot.send_message(member, message)
  
  bot.run(TOKEN)
  </code></pre>
  
  <p>I use Client.x but I don't understand what Bot. is and when I run this, I get the following error message: </p>
  
  <pre><code>PS D:\discord bots&gt; py .\DMeveryone.py
  Ignoring exception in command message_role:
  Traceback (most recent call last):
    File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\bot.py", line 898, in invoke
      await ctx.command.invoke(ctx)
    File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\core.py", line 608, in invoke
      await self.prepare(ctx)
    File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\core.py", line 573, in prepare
      await self._parse_arguments(ctx)
    File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\core.py", line 491, in _parse_arguments
      transformed = await self.transform(ctx, param)
    File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\core.py", line 353, in transform
      return await self.do_conversion(ctx, converter, argument, param)
    File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\core.py", line 308, in do_conversion
      return await self._actual_conversion(ctx, converter, argument, param)
    File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\core.py", line 254, in _actual_conversion
      ret = await instance.convert(ctx, argument)
    File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\discord\ext\commands\converter.py", line 320, in convert
      raise NoPrivateMessage()
  discord.ext.commands.errors.NoPrivateMessage
  </code></pre>
  
  <p>this is the messege : !message_role member Hi everybody!</p>
  
  <p>If someone can explain to me the problem that would be awesome, thank you very much.</p>