X
X
x4zx2021-11-21 18:27:36
Python
x4zx, 2021-11-21 18:27:36

Why is the command not working?

Hello, I have a command like this:

@bot.command()
    @commands.bot_has_permissions( manage_roles = True, manage_channels = True, send_messages = True, embed_links = True, read_message_history = True )
    @commands.has_permissions( administrator = True )
    async def addblacklist(ctx, member: discord.Member = None):

        support = ctx.guild.get_role(collticku.find_one({'_id': ctx.guild.id})['support_id'])
        black = ctx.guild.get_role(collticku.find_one({'_id': ctx.guild.id})['blackl'])

        if support in ctx.author.roles:
            if member is None:
                emb1 = discord.Embed(
                    description = 'Укажите участника, для занесения в черный список.',
                    colour = 0x2F3136
                )
                await ctx.reply(embed = emb1, delete_after = 5)
            else:
                if len(member.id) in black < 1:
                    collticku.update_one({'_id': ctx.guild.id}, {'$set': {'blackl': member.id}})
                else:
                    collticku.update_one({'_id': ctx.guild.id}, {'$push': {'blackl': member.id}})
                    emb2 = discord.Embed(
                        description = f'Вы успешно занесли ({member.mention}) в черный список.',
                        colour = 0x2F3136
                    )
                    await ctx.send(embed = emb2, delete_after = 5)
        else:
            emb3 = discord.Embed(
                description = 'Вы не являетесь службой поддержки и не можете заносить участников в черный список.',
                colour = 0x2F3136
            )
            await ctx.reply(embed = emb3, delete_after = 5)


Everything seems to be nothing, but here is the problem, when using it, if the user has not specified an argument, it displays an error or if the user does not have a support role, he will also write about it. But if everything is written correctly and the user has a support role, then the bot will not send a message that the participant has been blacklisted and will not be added to the database. There are no errors in cmd, I don't know what to do.
help me please

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question