Kaveen Kumarasinghe 2 years ago
commit fed1034665

@ -223,7 +223,8 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
channel_ids = self.conversation_thread_owners[normalized_user_id] channel_ids = self.conversation_thread_owners[normalized_user_id]
if ctx.channel.id not in channel_ids: if ctx.channel.id not in channel_ids:
await ctx.reply( await ctx.reply(
"This is not a conversation thread that you own!", delete_after=5 "This is not a conversation thread that you own!",
delete_after=5,
) )
except Exception: except Exception:
@ -267,9 +268,13 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
if conversation_limit: if conversation_limit:
try: try:
owner_id = list(self.conversation_thread_owners.keys())[ owner_id = list(self.conversation_thread_owners.keys())[
list([value for value in self.conversation_thread_owners.values()]).index(channel_id) list(
[value for value in self.conversation_thread_owners.values()]
).index(channel_id)
] ]
self.conversation_thread_owners[normalized_user_id].remove(ctx.channel.id) self.conversation_thread_owners[normalized_user_id].remove(
ctx.channel.id
)
# Attempt to close and lock the thread. # Attempt to close and lock the thread.
try: try:
thread = await self.bot.fetch_channel(channel_id) thread = await self.bot.fetch_channel(channel_id)
@ -282,7 +287,9 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
else: else:
if normalized_user_id in self.conversation_thread_owners: if normalized_user_id in self.conversation_thread_owners:
thread_id = ctx.channel.id thread_id = ctx.channel.id
self.conversation_thread_owners[normalized_user_id].remove(ctx.channel.id) self.conversation_thread_owners[normalized_user_id].remove(
ctx.channel.id
)
# Attempt to close and lock the thread. # Attempt to close and lock the thread.
try: try:

@ -797,8 +797,8 @@ class EndConvoButton(discord.ui.Button["ConversationView"]):
user_id = interaction.user.id user_id = interaction.user.id
if ( if (
user_id in self.converser_cog.conversation_thread_owners user_id in self.converser_cog.conversation_thread_owners
and interaction.channel.id in self.converser_cog.conversation_thread_owners[user_id] and interaction.channel.id
in self.converser_cog.conversation_thread_owners[user_id]
): ):
try: try:
await self.converser_cog.end_conversation( await self.converser_cog.end_conversation(

Loading…
Cancel
Save