Answer the question
In order to leave comments, you need to log in
How to solve list issue in mongodb?
Hello, I'm making a bot ticket. I ran into a problem that when I add a person to the blacklist (so that he cannot create a ticket) and this person clicks on the button to create a ticket, it is created. Although it shouldn't.
Here is the code:
Add a person to the blacklist
@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'])
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:
collticku.update_one({'_id': ctx.guild.id}, {'$inc': {'blackl': +1}, '$push': {'member': 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)
def blacklist(inter, guild):
member = inter.author
blackl = collticku.find_one({'_id': guild.id}['member'])
return member.id in [blackl['member']]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question