From ada2e8f7a3bc03ae6f086c7523b749f00e9cada4 Mon Sep 17 00:00:00 2001 From: QWERTZexe <109920359+QWERTZexe@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:47:09 +0200 Subject: [PATCH] Better lettering, better transcripts --- OpenView.py | 4 ++-- main.py | 40 ++++++++++++++++++++-------------------- utilities.py | 8 +++++--- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/OpenView.py b/OpenView.py index aefb6a3..5feac5c 100644 --- a/OpenView.py +++ b/OpenView.py @@ -26,7 +26,7 @@ class OpenView(discord.ui.View): def __init__(self): super().__init__(timeout=None) - @discord.ui.button(label="APPLY FOR PARTNER", emoji="🤝", style=discord.ButtonStyle.blurple, custom_id="partner_button") + @discord.ui.button(label="Apply for Partner", emoji="🤝", style=discord.ButtonStyle.blurple, custom_id="partner_button") async def partner_button(self, interaction: discord.Interaction, button: discord.Button): # Check for existing tickets TICKET_CTGRY_ID = utilities.get_config("TICKET_CTGRY_ID") @@ -41,7 +41,7 @@ async def partner_button(self, interaction: discord.Interaction, button: discord else: await interaction.response.send_modal(PartnerInfo()) - @discord.ui.button(label="OPEN A SUPPORT TICKET", emoji="🎫", style=discord.ButtonStyle.gray, custom_id="ticket_button") + @discord.ui.button(label="Open a support ticket", emoji="🎫", style=discord.ButtonStyle.gray, custom_id="ticket_button") async def ticket_button(self, interaction: discord.Interaction, button: discord.Button): # Check for existing tickets TICKET_CTGRY_ID = utilities.get_config("TICKET_CTGRY_ID") diff --git a/main.py b/main.py index aede519..2b9e62a 100644 --- a/main.py +++ b/main.py @@ -67,15 +67,15 @@ async def on_message(message): print(message) -@app_commands.command(description="ADMIN ONLY | Send the ticket msg!") +@app_commands.command(description="ADMIN | Send the ticket msg!") async def ticketmsg(interaction: discord.Interaction, channel: discord.TextChannel): if interaction.user.guild_permissions.administrator or interaction.user.id == 971316880243576862: em = discord.Embed(description=f'Do NOT open a ticket to "see what it does" or for matters that do not concern us\nWe **will** punish you for opening a ticket for an invalid reason', title=":sos: Event Alerts Support", color=discord.Color.red()) em.add_field(name=":handshake: Applying for Partner", - value="Please read all of the requirements and necessary information **[HERE](https://discord.com/channels/970411885293895801/970415677393477734/1179203344917614662)**\nOnce you're ready, you can click the ``APPLY FOR PARTNER`` button below!") + value="Please read all of the requirements and necessary information **[here](https://discord.com/channels/970411885293895801/970415677393477734/1179203344917614662)**\nOnce you're ready, you can click the ``Apply for Partner`` button below!") em.add_field(name=":ticket: General server support", - value="If you have any other questions about the server, feel free to create a ticket to ask us\nJust click the ``OPEN A SUPPORT TICKET`` button below to get started!") + value="If you have any other questions about the server, feel free to create a ticket to ask us\nJust click the ``Open a support ticket`` button below to get started!") view = OpenView() await channel.send(embed=em, view=view) await interaction.response.send_message("**Done!**", ephemeral=True) @@ -107,16 +107,16 @@ async def close(interaction: discord.Interaction, time: str = None): await utilities.close_ticket(interaction.client, interaction.channel, interaction.user) -@app_commands.command(description="STAFF ONLY | Change the priority of the current ticket") -@app_commands.describe(priority="The priority of the current ticket") -@app_commands.choices(priority=[ - app_commands.Choice(name="Waiting to close", value="🕑"), - app_commands.Choice(name="Waiting for something to happen", value="⏩"), +@app_commands.command(description="STAFF | Change the status of the current ticket") +@app_commands.describe(status="The status of the current ticket") +@app_commands.choices(status=[ + app_commands.Choice(name="Closure pending", value="❌"), + app_commands.Choice(name="Waiting for something to happen", value="⏳"), app_commands.Choice(name="Mod Attention", value="🟡"), - app_commands.Choice(name="ADMIN ATTENTION", value="🔴"), - app_commands.Choice(name="Their Turn", value="👍") + app_commands.Choice(name="HIGH PRIORITY", value="🔴"), + app_commands.Choice(name="Waiting for response", value="👍") ]) -async def priority(interaction: discord.Interaction, priority: app_commands.Choice[str]): +async def status(interaction: discord.Interaction, status: app_commands.Choice[str]): if "TICKET" not in interaction.channel.topic: await interaction.response.send_message(embed=discord.Embed(description="This command can only be used in ticket channels.", color=discord.Color.red()), ephemeral=True) return @@ -124,19 +124,19 @@ async def priority(interaction: discord.Interaction, priority: app_commands.Choi member = interaction.user if get(member.roles, id=MOD_ROLE_ID) or member.id == 971316880243576862 or interaction.user.guild_permissions.administrator: try: - await interaction.channel.edit(name=f"{priority.value}{interaction.channel.name[1:]}") + await interaction.channel.edit(name=f"{status.value}{interaction.channel.name[1:]}") err = 0 except: err = 1 if err == 0: - await interaction.followup.send(f"Successfully changed the ticket priority to {priority.name}!", ephemeral=True) + await interaction.followup.send(f"Successfully changed the ticket status to {status.name}!", ephemeral=True) else: - await interaction.followup.send(f"**__ERROR__** changing the ticket priority!", ephemeral=True) + await interaction.followup.send(f"**__ERROR__** changing the ticket status!", ephemeral=True) else: await interaction.followup.send("Sorry, this command is only for staff!", ephemeral=True) -@app_commands.command(description="STAFF ONLY | Add someone to the current ticket") +@app_commands.command(description="STAFF | Add someone to the current ticket") @app_commands.describe(member="The member to add to the current ticket") async def add(interaction: discord.Interaction, member: discord.Member): if "TICKET" not in interaction.channel.topic: @@ -144,7 +144,7 @@ async def add(interaction: discord.Interaction, member: discord.Member): return await interaction.response.defer(thinking=True) - if get(interaction.user.roles, id=MOD_ROLE_ID) or interaction.user.id == 971316880243576862 or interaction.user.guild_permissions.administrator: + if get(interaction.user.roles, id=MOD_ROLE_ID) or interaction.user.id == 971316880243576862 or interaction.user.guild_permissions.administrator or str(interaction.user.id) in interaction.channel.topic: try: await interaction.channel.set_permissions(member, read_messages=True, send_messages=True) err = 0 @@ -162,7 +162,7 @@ async def add(interaction: discord.Interaction, member: discord.Member): await interaction.followup.send(f"Sorry, this command is only for staff!", ephemeral=True) -@app_commands.command(description="STAFF ONLY | Remove someone from the current ticket") +@app_commands.command(description="STAFF | Remove someone from the current ticket") @app_commands.describe(member="The member to remove from the current ticket") async def remove(interaction: discord.Interaction, member: discord.Member): if "TICKET" not in interaction.channel.topic: @@ -170,7 +170,7 @@ async def remove(interaction: discord.Interaction, member: discord.Member): return await interaction.response.defer(thinking=True) - if get(interaction.user.roles, id=MOD_ROLE_ID) or interaction.user.id == 971316880243576862 or interaction.user.guild_permissions.administrator: + if get(interaction.user.roles, id=MOD_ROLE_ID) or interaction.user.id == 971316880243576862 or interaction.user.guild_permissions.administrator or str(interaction.user.id) in interaction.channel.topic: try: await interaction.channel.set_permissions(member, read_messages=False, send_messages=False) err = 0 @@ -187,7 +187,7 @@ async def remove(interaction: discord.Interaction, member: discord.Member): await interaction.followup.send(f"Sorry, this command is only for staff!", ephemeral=True) -@app_commands.command(description="STAFF ONLY | Bump the current ticket") +@app_commands.command(description="STAFF | Bump the current ticket") async def bump(interaction: discord.Interaction): if "TICKET" not in interaction.channel.topic: await interaction.response.send_message(embed=discord.Embed(description="This command can only be used in ticket channels.", color=discord.Color.red()), ephemeral=True) @@ -213,7 +213,7 @@ async def bump(interaction: discord.Interaction): # ADDING COMMANDS tree.add_command(ticketmsg) tree.add_command(close) -tree.add_command(priority) +tree.add_command(status) tree.add_command(add) tree.add_command(remove) tree.add_command(bump) diff --git a/utilities.py b/utilities.py index 7b9d70f..977c511 100644 --- a/utilities.py +++ b/utilities.py @@ -328,13 +328,15 @@ async def close_ticket(client, channel, user): """ - markdown_file = discord.File(io.StringIO( - markdown_transcript), filename=f"{channel.name}_transcript.md") +# markdown_file = discord.File(io.StringIO( +# markdown_transcript), filename=f"{channel.name}_transcript.md") html_file = discord.File(io.StringIO( html_transcript), filename=f"{channel.name}_transcript.html") + storage_message = await storage_channel.send(file=html_file) transcript_channel = channel.guild.get_channel(TRANSCRIPT_CHNL_ID) - x = await transcript_channel.send(embed=discord.Embed(description=f"Transcripts for {channel.name}", color=discord.Color.blue()), files=[markdown_file, html_file]) + url = storage_message.attachments[0].url + x = await transcript_channel.send(embed=discord.Embed(description=f"Transcript for {channel.name}\n[Transcript]({url})", color=discord.Color.blue())) log_channel = client.get_channel(LOG_CHNL_ID) em = discord.Embed(title="TICKET CLOSED", color=discord.Color.red(), description=f"<@{str(user.id)}> Just closed a ticket opened by: <@{str(channel.topic.split('-')[-1])}> (Transcript: https://discord.com/channels/{x.guild.id}/{x.channel.id}/{x.id})") await log_channel.send(embed=em)