Skip to content

Commit

Permalink
gonna remove
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Dec 17, 2023
1 parent 5927e60 commit f2d841d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
12 changes: 3 additions & 9 deletions cogs/inquiry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from os import getenv
from .utils.colors import EMBED_COLOR, SUCCESS, INQUIRY, REPLY
from .utils.formatting import get_date, get_time, format_footer
from .utils.helpers import create_ticket

load_dotenv()

Expand Down Expand Up @@ -99,15 +100,8 @@ async def callback(self, inter: nextcord.Interaction) -> None:
person = await inter.guild.fetch_member(self.person)
id = person.id
name = person.name
category = nextcord.utils.get(inter.guild.categories, id=CLOSED_CATEGORY)
new_channel = await category.create_text_channel(
name=f"ticket-{name}",
reason=f"Created ticket for {id} - {name}",
topic=id,
)
await inter.response.send_message(
f"Ticket created: <#{new_channel.id}>", ephemeral=True
)
new_channel = await create_ticket(inter, person, CLOSED_CATEGORY)

# inquiry again
emb = nextcord.Embed()
emb.color = INQUIRY
Expand Down
16 changes: 16 additions & 0 deletions cogs/utils/helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import nextcord


async def create_ticket(
inter: nextcord.Interaction, person: nextcord.Member, category
) -> nextcord.TextChannel:
category = nextcord.utils.get(inter.guild.categories, id=category)
new_channel: nextcord.TextChannel = await category.create_text_channel(
name=f"ticket-{person.name}",
reason=f"Created ticket for {person.id} - {person.name}",
topic=id,
)
await inter.response.send_message(
f"Ticket created: <#{new_channel.id}>", ephemeral=True
)
return new_channel

0 comments on commit f2d841d

Please sign in to comment.