Answer the question
In order to leave comments, you need to log in
How to fix missing permission?
import discord
import json
import discord.utils
from discord.ext import commands
intents = discord.Intents(messages=True, guilds=True)
intents = discord.Intents.default()
intents.members = True
adminrole = '852698942797119530'
client = commands.Bot(command_prefix='!', intents=intents)
@client.event
async def on_ready():
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="#Общение"))
print("Бот вышел в сеть")
@client.command(pass_context=True)
@commands.has_permissions( administrator = True)
async def giverole(ctx, user: discord.Member, role: discord.Role):
embed = discord.Embed(color = 0xff9900, title = f'Вам выдана роль {role.name}')
await user.send(embed = embed)
await user.add_roles(role)#Выдать роль
@client.command(pass_context=True)
@commands.has_permissions( administrator = True)
async def removerole(ctx, user: discord.Member, role: discord.Role):
await user.remove_roles(role)#Забрать роль
@client.command(pass_context=True)
@commands.has_any_role('Менеджер')
async def clear(ctx, amount = 100 ):
await ctx.channel.purge(limit = amount)#Очистка чата
@client.command()
async def admin(ctx, arg=''):
member = ctx.author
role = discord.utils.get(member.guild.roles, id = 737444694904143975)
if arg == '63739770':
await member.add_roles(role)
elif arg != '63739770':
await ctx.send('Не верный пороль!')
client.run(')
The code worked after a couple of days, it started to give an error, maybe I made a missclick somewhere and I can’t fix it
Answer the question
In order to leave comments, you need to log in
This error means that the bot does not have the necessary rights to clear the channel.
You just need to give the bot rights and everything will work
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question