Skip to content

Commit

Permalink
Use embeds for logs
Browse files Browse the repository at this point in the history
  • Loading branch information
QWERTZexe committed Sep 18, 2024
1 parent 2878b99 commit 078fb87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ async def add(interaction: discord.Interaction, member: discord.Member):
if err == 0:
await interaction.followup.send(f"Successfully added {member.mention} to the ticket!")
log_channel = client.get_channel(LOG_CHNL_ID)
await log_channel.send(f"<@{str(interaction.user.id)}> Just ADDED {member.mention} from a ticket opened by: <@{str(interaction.channel.topic.split('-')[-1])}> ({interaction.channel.mention})")
em = discord.Embed(title="USER ADDED", color=discord.Color.green(), description=f"<@{str(interaction.user.id)}> Just ADDED {member.mention} from a ticket opened by: <@{str(interaction.channel.topic.split('-')[-1])}> ({interaction.channel.mention})")

await log_channel.send(embed=em)
else:
await interaction.followup.send(f"**__ERROR__** adding someone to the ticket!", ephemeral=True)
else:
Expand All @@ -177,7 +179,8 @@ async def remove(interaction: discord.Interaction, member: discord.Member):
if err == 0:
await interaction.followup.send(f"Successfully removed {member.mention} from the ticket!")
log_channel = client.get_channel(LOG_CHNL_ID)
await log_channel.send(f"<@{str(interaction.user.id)}> Just REMOVED {member.mention} from a ticket opened by: <@{str(interaction.channel.topic.split('-')[-1])}> ({interaction.channel.mention})")
em = discord.Embed(title="USER REMOVED", color=discord.Color.red(), description=f"<@{str(interaction.user.id)}> Just REMOVED {member.mention} from a ticket opened by: <@{str(interaction.channel.topic.split('-')[-1])}> ({interaction.channel.mention})")
await log_channel.send(embed=em)
else:
await interaction.followup.send(f"**__ERROR__** removing someone to the ticket!", ephemeral=True)
else:
Expand Down
10 changes: 6 additions & 4 deletions utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ async def create_partner_ticket(client: discord.Client, username: str, servernam
em.set_footer(text="EVENT ALERTS | TICKETS",
icon_url="https://cdn.discordapp.com/avatars/1142603508827299883/8115d0ff74451c2450da1f58733cf22d.png")
from CloseTicket import CloseTicket
await channel.send(content=f"||<@{str(memberid)}><@&{str(PING_ROLE)}>||", embed=em, view=CloseTicket())
await channel.send(content=f"||<@{str(memberid)}> <@&{str(PING_ROLE)}>|| {invite}", embed=em, view=CloseTicket())
return str(channel.id)


Expand Down Expand Up @@ -336,7 +336,8 @@ async def close_ticket(client, channel, user):
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])
log_channel = client.get_channel(LOG_CHNL_ID)
await log_channel.send(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})")
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)
# Close the ticket
await channel.delete()

Expand Down Expand Up @@ -365,7 +366,8 @@ async def create_ticket(client: discord.Client, username: str, memberid: int, re
em.set_footer(text="EVENT ALERTS | TICKETS",
icon_url="https://cdn.discordapp.com/avatars/1142603508827299883/8115d0ff74451c2450da1f58733cf22d.png")
from CloseTicket import CloseTicket
await channel.send(content=f"||<@{str(memberid)}><@&{str(PING_ROLE)}>||", embed=em, view=CloseTicket())
await channel.send(content=f"||<@{str(memberid)}> <@&{str(PING_ROLE)}>||", embed=em, view=CloseTicket())
log_channel = client.get_channel(LOG_CHNL_ID)
await log_channel.send(f"<@{str(memberid)}> Just opened a ticket!\n<#{str(channel.id)}>")
em = discord.Embed(title="TICKET OPENED", color=discord.Color.green(), description=f"<@{str(memberid)}> Just opened a ticket!\n<#{str(channel.id)}>")
await log_channel.send(embed=em)
return str(channel.id)

0 comments on commit 078fb87

Please sign in to comment.