Skip to content

Commit

Permalink
Updates tickets
Browse files Browse the repository at this point in the history
  • Loading branch information
JDJGInc authored Sep 1, 2023
1 parent 2d2dbc8 commit 73cd08f
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions cogs/tickets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(self, bot: JDBot):
self.main_channel: discord.TextChannel = None # filled in create_ticket
self.support_role: discord.Role = None # filled in create_ticket
self.support_guild: discord.Guild = None # filled in create_ticket
self.please_help: discord.Role = None #filled in create_ticket

async def cog_load(self):
pool = self.pool
Expand Down Expand Up @@ -93,9 +94,18 @@ async def close(self, context: JDBotContext):
# add a couple more checks here to see if the author is the one who ran it.
# with general checks about requiring the author to run it or the support team.


if not self.support_guild:
self.support_guild = self.bot.get_guild(1019027330779332660)

guild = self.support_guild

role = guild.get_role(1147198431811600444)

try:
member = await remote.fetch_member(context.author.id)
await remote.remove_user(member)
await member.remove_role()

except:
await context.send("Removing you from the ticket channel failed.")
Expand All @@ -112,9 +122,10 @@ async def close(self, context: JDBotContext):
@commands.dm_only()
async def create_ticket(self, context: JDBotContext, *, starter_message: Optional[str] = None):
if not self.main_channel:
self.main_channel = self.bot.get_channel(1042608798709334066)
self.main_channel = self.bot.get_channel(1147198182493794304)
self.support_role = self.bot.get_guild(1019027330779332660).get_role(1042608916233736192)
self.support_guild = self.bot.get_guild(1019027330779332660)
self.please_help = self.bot.get_guild(1019027330779332660).get_role(1147198431811600444)

if context.author.id in self.ticket_cache:
return await context.send("You cannot create another ticket whilst another ticket is unresponded to.")
Expand Down Expand Up @@ -152,6 +163,13 @@ async def create_ticket(self, context: JDBotContext, *, starter_message: Optiona
member = guild.get_member(context.author.id)

if member:

support_receivers = self.please_help


if not support_receivers in member.roles:
await member.add_role(support_receivers)

await thread_channel.add_user(member)

await context.send(f"You have been added to {thread_channel.mention}")
Expand Down Expand Up @@ -179,7 +197,7 @@ async def on_message(self, message: discord.Message):
return

if not self.main_channel:
self.main_channel = self.bot.get_channel(1042608798709334066)
self.main_channel = self.bot.get_channel(1147198182493794304)
self.support_role = self.bot.get_guild(1019027330779332660).get_role(1042608916233736192)
self.support_guild = self.bot.get_guild(1019027330779332660)

Expand Down

0 comments on commit 73cd08f

Please sign in to comment.