I'm noob coder and I'm also new to the stackoverflow I am using this ticket system and how can I limit each person's ticket like if one person has a ticket and if that person tries to make a ticket then that ticket just disappears how can I do that
@bot.event
async def on_raw_reaction_add(payload):
if payload.member.id != bot.user.id and str(payload.emoji) == u"\U0001F3AB":
msg_id, channel_id, category_id = bot.ticket_configs[payload.guild_id]
if payload.message_id == msg_id:
guild = bot.get_guild(payload.guild_id)
for category in guild.categories:
if category.id == category_id:
break
channel = guild.get_channel(channel_id)
ticket_num = 1 if len(category.channels) == 0 else int(category.channels[-1].name.split("-")[-1]) + 1
ticket_channel = await category.create_text_channel(f"ticket{ticket_num}", topic=f"ticket.", permission_synced=True)
await ticket_channel.set_permissions(payload.member, read_messages=True, send_messages=True)
message = await channel.fetch_message(msg_id)
await message.remove_reaction(payload.emoji, payload.member)
try:
await bot.wait_for("message", check=lambda m: m.channel == ticket_channel and m.content == "close", timeout=3600)
except asyncio.TimeoutError:
await ticket_channel.delete()
else:
await ticket_channel.delete()
'''