Skip to content

Commit

Permalink
fix: changes not out yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Aug 23, 2024
1 parent 347ea9d commit d3b0ffe
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DisCatSharp.ApplicationCommands/Context/BaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ internal BaseContext(DisCatSharpCommandType type)
/// <param name="type">The type of the response.</param>
/// <param name="builder">The data to be sent, if any.</param>
/// <returns></returns>
public async Task<DiscordMessage> CreateResponseAsync(InteractionResponseType type, DiscordInteractionResponseBuilder? builder = null)
public async Task CreateResponseAsync(InteractionResponseType type, DiscordInteractionResponseBuilder? builder = null)
=> await this.Interaction.CreateResponseAsync(type, builder);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public static async Task<PaginatedModalResponse> CreatePaginatedModalResponseAsy

if (previousInteraction.Type is InteractionType.Ping or InteractionType.ModalSubmit)
{
var originalResponse = await previousInteraction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, b.OpenMessage.AddComponents(b.OpenButton)).ConfigureAwait(false);
await previousInteraction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, b.OpenMessage.AddComponents(b.OpenButton)).ConfigureAwait(false);
var originalResponse = await previousInteraction.GetOriginalResponseAsync().ConfigureAwait(false);
var modalOpen = await interactivity.WaitForButtonAsync(originalResponse, new List<DiscordButtonComponent>
{
b.OpenButton
Expand Down
3 changes: 2 additions & 1 deletion DisCatSharp.Interactivity/InteractivityExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,8 @@ public async Task SendPaginatedResponseAsync(DiscordInteraction interaction, boo
.AddComponents(bts.ButtonArray);
if (ephemeral)
builder = builder.AsEphemeral();
message = await interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, builder).ConfigureAwait(false);
await interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, builder).ConfigureAwait(false);
message = await interaction.GetOriginalResponseAsync().ConfigureAwait(false);
}

var req = new InteractionPaginationRequest(interaction, message, user, bhv, del, bts, pages, token);
Expand Down
2 changes: 1 addition & 1 deletion DisCatSharp/Entities/Interaction/DiscordInteraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public DiscordChannel Channel
/// </summary>
/// <param name="type">The type of the response.</param>
/// <param name="builder">The data, if any, to send.</param>
public async Task<DiscordMessage> CreateResponseAsync(InteractionResponseType type, DiscordInteractionResponseBuilder? builder = null)
public async Task CreateResponseAsync(InteractionResponseType type, DiscordInteractionResponseBuilder? builder = null)
=> await this.Discord.ApiClient.CreateInteractionResponseAsync(this.Id, this.Token, type, builder);

/// <summary>
Expand Down
5 changes: 4 additions & 1 deletion DisCatSharp/Net/Rest/DiscordApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6884,7 +6884,10 @@ internal async Task<DiscordMessage> CreateInteractionResponseAsync(ulong interac

try
{
return DiscordJson.DeserializeObject<DiscordMessage>(response.Response, this.Discord);
if (response.ResponseCode is not HttpStatusCode.NoContent && !string.IsNullOrEmpty(response.Response))
return DiscordJson.DeserializeObject<DiscordMessage>(response.Response, this.Discord);
else
return null!;
}
catch
{
Expand Down

0 comments on commit d3b0ffe

Please sign in to comment.