Skip to content

Commit

Permalink
[ReacTicket] Exit branch if no tickets are open, close tickets in con…
Browse files Browse the repository at this point in the history
…fig (#62)

* fix(reacticket): Exit branch if no tickets are open, close tickets in config

* style(reacticket): fix linespacing

* style(reacticket): fix vscode autoformatter
  • Loading branch information
NeuroAssassin authored Oct 7, 2021
1 parent b17058f commit 21cbf41
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion reacticket/reacticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ async def on_member_remove(self, member: discord.Member):
if not guild_settings["closeonleave"]:
return

if not str(member.id) in guild_settings["created"]:
if (
not str(member.id) in guild_settings["created"]
or len(guild_settings["created"][str(member.id)]) == 0
):
return

archive = self.bot.get_channel(guild_settings["archive"]["category"])
Expand Down Expand Up @@ -240,6 +243,9 @@ async def on_member_remove(self, member: discord.Member):
f"Ticket {channel.mention} for {member.display_name} has been closed "
"due to author leaving. Channel will be deleted in one minute, if exists."
)
async with self.config.guild(member.guild).created() as tickets:
if str(member.id) in tickets:
del tickets[str(member.id)]

await asyncio.sleep(60)

Expand Down

0 comments on commit 21cbf41

Please sign in to comment.