title: Add role by ID discord.py
body: <p>I've tried relentlessly for about 1-2hrs to get this piece of code to work. I need to add the role to a user, simple enough right?</p>
  <p>This code, searches for the role but cannot find it, is this because I am sending it from a channel which that role doesn't have access to? I need help please.</p>
  <p>Edit 1: removed quotations around the ID</p>
  <pre><code>@bot.command()
  async def addrole(ctx, user: discord.User):
      #Add the customer role to the user
      role_id = 810264985258164255
  
      guild = ctx.guild
      role = discord.utils.get(guild.roles, id=810264985258164255)
      await user.add_roles(role)
  </code></pre>
  <pre><code>2021-03-06T21:12:51.811235+00:00 app[worker.1]: Your bot is ready.
  2021-03-06T21:14:09.010057+00:00 app[worker.1]: Ignoring exception in command addrole:
  2021-03-06T21:14:09.012477+00:00 app[worker.1]: Traceback (most recent call last):
  2021-03-06T21:14:09.012553+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/core.py&quot;, line 85, in wrapped
  2021-03-06T21:14:09.012554+00:00 app[worker.1]: ret = await coro(*args, **kwargs)
  2021-03-06T21:14:09.012592+00:00 app[worker.1]: File &quot;bot.py&quot;, line 92, in addrole
  2021-03-06T21:14:09.012593+00:00 app[worker.1]: await user.add_roles(user, role)
  2021-03-06T21:14:09.012621+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/member.py&quot;, line 673, in add_roles
  2021-03-06T21:14:09.012621+00:00 app[worker.1]: await req(guild_id, user_id, role.id, reason=reason)
  2021-03-06T21:14:09.012651+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/http.py&quot;, line 243, in request
  2021-03-06T21:14:09.012652+00:00 app[worker.1]: raise NotFound(r, data)
  2021-03-06T21:14:09.012699+00:00 app[worker.1]: discord.errors.NotFound: 404 Not Found (error code: 10011): Unknown Role
  2021-03-06T21:14:09.012735+00:00 app[worker.1]:
  2021-03-06T21:14:09.012735+00:00 app[worker.1]: The above exception was the direct cause of the following exception:
  2021-03-06T21:14:09.012736+00:00 app[worker.1]:
  2021-03-06T21:14:09.012772+00:00 app[worker.1]: Traceback (most recent call last):
  2021-03-06T21:14:09.012832+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/bot.py&quot;, line 935, in invoke
  2021-03-06T21:14:09.012833+00:00 app[worker.1]: await ctx.command.invoke(ctx)
  2021-03-06T21:14:09.012863+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/core.py&quot;, line 863, in invoke
  2021-03-06T21:14:09.012863+00:00 app[worker.1]: await injected(*ctx.args, **ctx.kwargs)
  2021-03-06T21:14:09.012890+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/core.py&quot;, line 94, in wrapped
  2021-03-06T21:14:09.012891+00:00 app[worker.1]: raise CommandInvokeError(exc) from exc
  2021-03-06T21:14:09.012932+00:00 app[worker.1]: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10011): Unknown Role
  </code></pre>
  <p>Edit 2: removed user from add_role</p>
  <pre><code>2021-03-06T22:22:45.062172+00:00 app[worker.1]: Your bot is ready.
  2021-03-06T22:22:52.026199+00:00 app[worker.1]: Ignoring exception in command addrole:
  2021-03-06T22:22:52.028082+00:00 app[worker.1]: Traceback (most recent call last):
  2021-03-06T22:22:52.028089+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/core.py&quot;, line 85, in wrapped
  2021-03-06T22:22:52.028089+00:00 app[worker.1]: ret = await coro(*args, **kwargs)
  2021-03-06T22:22:52.028092+00:00 app[worker.1]: File &quot;bot.py&quot;, line 94, in addrole
  2021-03-06T22:22:52.028100+00:00 app[worker.1]: await user.add_roles(role)
  2021-03-06T22:22:52.028104+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/member.py&quot;, line 673, in add_roles
  2021-03-06T22:22:52.028108+00:00 app[worker.1]: await req(guild_id, user_id, role.id, reason=reason)
  2021-03-06T22:22:52.028111+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/http.py&quot;, line 241, in request
  2021-03-06T22:22:52.028111+00:00 app[worker.1]: raise Forbidden(r, data)
  2021-03-06T22:22:52.028152+00:00 app[worker.1]: discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
  2021-03-06T22:22:52.028160+00:00 app[worker.1]:
  2021-03-06T22:22:52.028161+00:00 app[worker.1]: The above exception was the direct cause of the following exception:
  2021-03-06T22:22:52.028161+00:00 app[worker.1]:
  2021-03-06T22:22:52.028164+00:00 app[worker.1]: Traceback (most recent call last):
  2021-03-06T22:22:52.028223+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/bot.py&quot;, line 935, in invoke
  2021-03-06T22:22:52.028224+00:00 app[worker.1]: await ctx.command.invoke(ctx)
  2021-03-06T22:22:52.028225+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/core.py&quot;, line 863, in invoke
  2021-03-06T22:22:52.028225+00:00 app[worker.1]: await injected(*ctx.args, **ctx.kwargs)
  2021-03-06T22:22:52.028225+00:00 app[worker.1]: File &quot;/app/.heroku/python/lib/python3.6/site-packages/discord/ext/commands/core.py&quot;, line 94, in wrapped
  2021-03-06T22:22:52.028226+00:00 app[worker.1]: raise CommandInvokeError(exc) from exc
  2021-03-06T22:22:52.028228+00:00 app[worker.1]: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
  </code></pre>