Вот код:
import discord
from discord.ext import commands
from config import settings
from discord.ext.commands import Bot
import string, json
import os, sqlite3
import asyncio
from asyncio import sleep
import requests
from time import strftime
from time import localtime
from discord import utils
from discord import Member
import time
import re
from discord_slash import SlashCommand
from discord.utils import get
from discord_components import DiscordComponents, Button, ButtonStyle
from discord_slash.model import ButtonStyle
from discord_slash.utils.manage_components import (
ComponentContext,
create_actionrow,
create_button,
)
bot = commands.Bot(command_prefix = settings['prefix'])
bot.remove_command('help')
@bot.event
async def on_member_join(member):
role = member.guild.get_role(role_id=996459154128519262)
await member.add_roles(role)
@bot.command()
async def girl(ctx):
author = ctx.message.author
guild = bot.get_guild(985912915355918346)
role = guild.get_role(997108835397410816)
await author.add_roles(role)
@bot.command()
async def man(ctx):
author = ctx.message.author
guild = bot.get_guild(985912915355918346)
role = guild.get_role(997108406710177832)
await author.add_roles(role)
bot.run(settings['token'])
Ошибка:
Ignoring exception in command man:
Traceback (most recent call last):
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\bot\bot.py", line 48, in man
await author.add_roles(role)
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\member.py", line 777, in add_roles
await req(guild_id, user_id, role.id, reason=reason)
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\http.py", line 248, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions