Skip to content

Commit

Permalink
fix: fix my own mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Jan 3, 2024
1 parent 0ccd184 commit d76c831
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
1 change: 0 additions & 1 deletion DisCatSharp/DisCatSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
<Folder Include="Entities\Interaction\Components\Attachment\" />
<Folder Include="Entities\Interaction\Components\DateTime\" />
<Folder Include="Entities\Interaction\Components\Radio\" />
<Folder Include="Ascii\" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 4 additions & 3 deletions DisCatSharp/Net/Rest/DiscordApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,14 @@ private Task<RestResponse> DoMultipartAsync(
IReadOnlyDictionary<string, string>? headers = null,
IReadOnlyDictionary<string, string>? values = null,
IEnumerable<DiscordMessageFile>? files = null,
double? ratelimitWaitOverride = null
double? ratelimitWaitOverride = null,
bool targetDebug = false

Check warning on line 297 in DisCatSharp/Net/Rest/DiscordApiClient.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Parameter 'targetDebug' has no matching param tag in the XML comment for 'DiscordApiClient.DoMultipartAsync(BaseDiscordClient, RateLimitBucket, Uri, RestRequestMethod, string, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, IEnumerable<DiscordMessageFile>?, double?, bool)' (but other parameters do)

Check warning on line 297 in DisCatSharp/Net/Rest/DiscordApiClient.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Parameter 'targetDebug' has no matching param tag in the XML comment for 'DiscordApiClient.DoMultipartAsync(BaseDiscordClient, RateLimitBucket, Uri, RestRequestMethod, string, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, IEnumerable<DiscordMessageFile>?, double?, bool)' (but other parameters do)

Check warning on line 297 in DisCatSharp/Net/Rest/DiscordApiClient.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Parameter 'targetDebug' has no matching param tag in the XML comment for 'DiscordApiClient.DoMultipartAsync(BaseDiscordClient, RateLimitBucket, Uri, RestRequestMethod, string, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, IEnumerable<DiscordMessageFile>?, double?, bool)' (but other parameters do)

Check warning on line 297 in DisCatSharp/Net/Rest/DiscordApiClient.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Parameter 'targetDebug' has no matching param tag in the XML comment for 'DiscordApiClient.DoMultipartAsync(BaseDiscordClient, RateLimitBucket, Uri, RestRequestMethod, string, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, IEnumerable<DiscordMessageFile>?, double?, bool)' (but other parameters do)
)
{
var req = new MultipartWebRequest(client, bucket, url, method, route, headers, values, files, ratelimitWaitOverride);

if (this.Discord is not null)
this.Rest.ExecuteRequestAsync(req).LogTaskFault(this.Discord.Logger, LogLevel.Error, LoggerEvents.RestError, "Error while executing request");
this.Rest.ExecuteRequestAsync(req, targetDebug).LogTaskFault(this.Discord.Logger, LogLevel.Error, LoggerEvents.RestError, "Error while executing request");
else
_ = this.Rest.ExecuteRequestAsync(req);

Expand Down Expand Up @@ -4705,7 +4706,7 @@ internal async Task<DiscordMessage> ExecuteWebhookAsync(ulong webhookId, string

var url = qub.Build();

var res = await this.DoMultipartAsync(this.Discord, bucket, url, RestRequestMethod.POST, route, values: values, files: builder.Files).ConfigureAwait(false);
var res = await this.DoMultipartAsync(this.Discord, bucket, url, RestRequestMethod.POST, route, values: values, files: builder.Files, targetDebug: true).ConfigureAwait(false);
var ret = DiscordJson.DeserializeObject<DiscordMessage>(res.Response, this.Discord);

if (this.Discord != null!)
Expand Down
9 changes: 6 additions & 3 deletions DisCatSharp/Net/Rest/RestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ public RateLimitBucket GetBucket(RestRequestMethod method, string route, object
/// Executes the request.
/// </summary>
/// <param name="request">The request to be executed.</param>
public Task ExecuteRequestAsync(BaseRestRequest request)
=> request is null ? throw new ArgumentNullException(nameof(request)) : this.ExecuteRequestAsync(request, null, null);
public Task ExecuteRequestAsync(BaseRestRequest request, bool targetDebug = false)

Check warning on line 247 in DisCatSharp/Net/Rest/RestClient.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Parameter 'targetDebug' has no matching param tag in the XML comment for 'RestClient.ExecuteRequestAsync(BaseRestRequest, bool)' (but other parameters do)

Check warning on line 247 in DisCatSharp/Net/Rest/RestClient.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Parameter 'targetDebug' has no matching param tag in the XML comment for 'RestClient.ExecuteRequestAsync(BaseRestRequest, bool)' (but other parameters do)

Check warning on line 247 in DisCatSharp/Net/Rest/RestClient.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Parameter 'targetDebug' has no matching param tag in the XML comment for 'RestClient.ExecuteRequestAsync(BaseRestRequest, bool)' (but other parameters do)
=> request is null ? throw new ArgumentNullException(nameof(request)) : this.ExecuteRequestAsync(request, null, null, targetDebug);

/// <summary>
/// Executes the form data request.
Expand Down Expand Up @@ -461,10 +461,13 @@ private async Task ExecuteFormRequestAsync(BaseRestRequest request, RateLimitBuc
/// <param name="request">The request to be executed.</param>
/// <param name="bucket">The bucket.</param>
/// <param name="ratelimitTcs">The ratelimit task completion source.</param>
private async Task ExecuteRequestAsync(BaseRestRequest request, RateLimitBucket? bucket, TaskCompletionSource<bool>? ratelimitTcs)
private async Task ExecuteRequestAsync(BaseRestRequest request, RateLimitBucket? bucket, TaskCompletionSource<bool>? ratelimitTcs, bool targetDebug = false)

Check warning on line 464 in DisCatSharp/Net/Rest/RestClient.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Parameter 'targetDebug' has no matching param tag in the XML comment for 'RestClient.ExecuteRequestAsync(BaseRestRequest, RateLimitBucket?, TaskCompletionSource<bool>?, bool)' (but other parameters do)

Check warning on line 464 in DisCatSharp/Net/Rest/RestClient.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Parameter 'targetDebug' has no matching param tag in the XML comment for 'RestClient.ExecuteRequestAsync(BaseRestRequest, RateLimitBucket?, TaskCompletionSource<bool>?, bool)' (but other parameters do)

Check warning on line 464 in DisCatSharp/Net/Rest/RestClient.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Parameter 'targetDebug' has no matching param tag in the XML comment for 'RestClient.ExecuteRequestAsync(BaseRestRequest, RateLimitBucket?, TaskCompletionSource<bool>?, bool)' (but other parameters do)
{
ObjectDisposedException.ThrowIf(this._disposed, this);

if (targetDebug)
Console.WriteLine("Meow");

HttpResponseMessage? res = default;

try
Expand Down
2 changes: 1 addition & 1 deletion DisCatSharp/QueryUriBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public QueryUriBuilder AddParameter(string key, string value)
public Uri Build() =>
new UriBuilder(this.SourceUri)
{
Query = this._queryParams.Count is 0 ? string.Join("&", this._queryParams.Select(e => Uri.EscapeDataString(e.Key) + '=' + Uri.EscapeDataString(e.Value))) : string.Empty
Query = this._queryParams.Count is not 0 ? string.Join("&", this._queryParams.Select(e => Uri.EscapeDataString(e.Key) + '=' + Uri.EscapeDataString(e.Value))) : string.Empty
}.Uri;

/// <summary>
Expand Down

0 comments on commit d76c831

Please sign in to comment.