import disnake
from disnake.ext import commands
from disnake import utils, Intents
from dotenv import load_dotenv
import os
load_dotenv()
ROLE_NAME = "Верифицированные - Пользователи"
#ROLE_NAME_DELETE = ''
intents = Intents.all()
bot = commands.Bot(command_prefix='-', intents=intents)
@bot.event
async def on_ready():
print(f'Logged in as {bot.user.name}')
@bot.slash_command(name='verify')
async def verify(inter):
try:
role = utils.get(inter.guild.roles, name=ROLE_NAME)
#role1 = utils.get(inter.guild.roles, name=ROLE_NAME_DELETE)
if role:
await inter.author.add_roles(role)
#await inter.author.remove_roles(role1)
await inter.respond.send_message(f'{inter.author.mention}, Роль {role.name[1:]} выдана, удачи).',ephemeral=True)
else:
await inter.respond.send_message(f'Role {ROLE_NAME} not found.',ephemeral=True)
except Exception as e:
print(f'Error: %s' % e)
bot.run(os.getenv('TOKEN'))
Ошибка:
Error: 403 Forbidden (error code: 50001): Missing Access