Skip to content

Commit c6cf976

Browse files
committed
Use 'user_ids' CSV header
Change the CSV header for exported target users from "Users" to "user_ids" and update the parser and XML doc comment accordingly. This makes the writer and reader consistent in what header they expect for the user ID CSV.
1 parent e29a0bb commit c6cf976

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

DisCatSharp/Net/Rest/DiscordApiClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ internal Task<RestResponse> DoRequestAsync(BaseDiscordClient client, RateLimitBu
296296
return null;
297297

298298
StringBuilder builder = new();
299-
builder.AppendLine("Users");
299+
builder.AppendLine("user_ids");
300300

301301
foreach (var id in validIds)
302302
{
@@ -366,7 +366,7 @@ void AddIds(IEnumerable<ulong> source)
366366
/// <param name="csvContent">The CSV content.</param>
367367
/// <returns>A read-only list of user ids. Lines that cannot be parsed as valid user IDs are silently skipped.</returns>
368368
/// <remarks>
369-
/// Lines containing only whitespace are skipped. The CSV is expected to have a header line containing "Users" which is also skipped.
369+
/// Lines containing only whitespace are skipped. The CSV is expected to have a header line containing "user_ids" which is also skipped.
370370
/// </remarks>
371371
private static IReadOnlyList<ulong> ParseTargetUsersCsv(string csvContent)
372372
{
@@ -376,7 +376,7 @@ private static IReadOnlyList<ulong> ParseTargetUsersCsv(string csvContent)
376376
var lines = csvContent.Split(["\r\n", "\n"], StringSplitOptions.RemoveEmptyEntries);
377377
var ids = lines
378378
.Select(line => line.Trim())
379-
.Where(line => line.Length > 0 && !line.Equals("Users", StringComparison.OrdinalIgnoreCase))
379+
.Where(line => line.Length > 0 && !line.Equals("user_ids", StringComparison.OrdinalIgnoreCase))
380380
.Select(line => (success: ulong.TryParse(line, NumberStyles.None, CultureInfo.InvariantCulture, out var id), id))
381381
.Where(result => result.success)
382382
.Select(result => result.id)

0 commit comments

Comments
 (0)