Answer the question
In order to leave comments, you need to log in
How to make it possible to create many reports?
Hello, I am writing a bot for a report system for a separate server, and now I ran into a problem.
There is a "report" command, it calls a menu with a button, when clicked, a report is created (like technical support), but if one of the server participants has already created one report, then the rest cannot click on the button, more precisely, they can, but the discord will give an interaction error. Please tell me what needs to be done?
The code itself:
@bot.command()
@commands.has_role(832536148232503326)
async def report(ctx):
emb = discord.Embed(title = '', description = "**На всі ваші питання допоможе відповісти - <@&833314249827680257>** \n Щоб зв'язатися з адміністраторами натисніть на кнопку нижче", colour = 0xFF8C00)
emb.set_image(url = 'https://riskcontrolacademy.com/wp-content/uploads/2019/09/support.png')
emb.set_footer(text = 'Support Team', icon_url = 'https://cdn.discordapp.com/attachments/772850448892690462/833028640715440128/unknown.png')
await ctx.send(
embed = emb,
components = [
Button(style = ButtonStyle.gray, label = "Зв'язатися", emoji = '')
]
)
while True:
res = await bot.wait_for('button_click')
member = res.guild.get_member(res.user.id)
if res.component.label.startswith("Зв'язатися"):
await res.respond(type = 6)
channel = await ctx.guild.create_text_channel(name = f"{member}", category = ctx.guild.get_channel(833425673188016149))
await channel.set_permissions(ctx.author, overwrite = discord.PermissionOverwrite(view_channel = True, send_messages = True))
#for role in ctx.author.roles:
#mentions = ", ".join(role for role in ctx.author.roles)
#mention = role.mention
await channel.send('**<@&833314249827680257> Новий тікет, інформація про користувача нижче**')
roles = [role for role in member.roles[1:]]
emb1 = discord.Embed(title = "Інформаційне табло", description = 'Це табло надає інформацію про автора тікета', colour = 0xFF8C00)
emb1.add_field(name = 'Користувач', value = f'{member.mention}')
emb1.add_field(name = 'ID', value = f'{member.id}')
emb1.add_field(name = 'Ролі', value = " ".join([role.mention for role in roles]), inline = False)
emb1.add_field(name = 'Приєднався', value = f'{member.joined_at.strftime("%#d %B %Y, %H:%M")}')
emb1.add_field(name = 'Дата створення', value = f'{member.created_at.strftime("%#d %B %Y, %H:%M")}')
emb1.set_thumbnail(url = f'{member.avatar_url}')
emb1.set_footer(icon_url = f'{member.avatar_url}', text = f'{member}')
await channel.send(
embed = emb1,
components = [
Button(style = ButtonStyle.gray, label = 'Закрити', emoji = '⛔')
]
)
#adminrole = [833314249827680257]
res = await bot.wait_for('button_click')
if res.component.label.startswith("Закрити"):
await res.respond(type = 6)
emb2 = discord.Embed(title = '', description = '**Тікет видалиться через декілька секунд.**', colour = 0xFF8C00)
await channel.send(embed = emb2)
await asyncio.sleep(3)
await res.channel.delete()
<code>
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