Skip to content

Commit

Permalink
Merge pull request #395 from Paillat-dev/defer-create-conversation
Browse files Browse the repository at this point in the history
Defer "Conversation started." responses
  • Loading branch information
Kav-K authored Nov 13, 2023
2 parents eb1dc5e + 8578d88 commit 4e30edd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions cogs/code_interpreter_service_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ async def code_interpreter_chat_command(
ctx: discord.ApplicationContext,
model,
):
await ctx.defer()
embed_title = f"{ctx.user.name}'s code interpreter conversation with GPT"
message_embed = discord.Embed(
title=embed_title,
Expand Down
1 change: 1 addition & 0 deletions cogs/search_service_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ async def on_message(self, message):
async def search_chat_command(
self, ctx: discord.ApplicationContext, model, search_scope=2
):
await ctx.defer()
embed_title = f"{ctx.user.name}'s internet-connected conversation with GPT"
message_embed = discord.Embed(
title=embed_title,
Expand Down
1 change: 1 addition & 0 deletions models/index_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ async def index_chat_file(self, message: discord.Message, file: discord.Attachme
return False, None

async def start_index_chat(self, ctx, model):
await ctx.defer()
preparation_message = await ctx.channel.send(
embed=EmbedStatics.get_index_chat_preparation_message()
)
Expand Down
6 changes: 3 additions & 3 deletions utils/safe_ctx_respond.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ async def safe_ctx_respond(
Safely responds to a Discord interaction.
Args:
*args: Positional arguments to be passed to the `respond` or `reply` method of the context.
**kwargs: Keyword arguments to be passed to the `respond` or `reply` method of the context.
`ctx` is a required keyword argument.
ctx (discord.ApplicationContext): The interaction context.
content (str): The content to send.
ephemeral (bool, optional): Whether the response should be ephemeral. Defaults to False.
Raises:
ValueError: If `ctx` is not provided in the `kwargs`.
Expand Down

0 comments on commit 4e30edd

Please sign in to comment.