Skip to content

Commit

Permalink
Better lettering, better transcripts
Browse files Browse the repository at this point in the history
  • Loading branch information
QWERTZexe committed Sep 18, 2024
1 parent 078fb87 commit ada2e8f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
4 changes: 2 additions & 2 deletions OpenView.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
40 changes: 20 additions & 20 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -107,44 +107,44 @@ 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
await interaction.response.defer(thinking=True)
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:
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
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
Expand All @@ -162,15 +162,15 @@ 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:
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
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
Expand All @@ -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)
Expand All @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,15 @@ async def close_ticket(client, channel, user):
</body>
</html>"""

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)
Expand Down

0 comments on commit ada2e8f

Please sign in to comment.