Skip to content

Commit

Permalink
Remove nullable type declarations for RestGuild
Browse files Browse the repository at this point in the history
Removed the nullable marker for the RestGuild type to ensure that a non-nullable RestGuild instance is always expected from GetGuildAsync method. This change increases type safety by preventing potential null reference exceptions.
  • Loading branch information
EpicOfficer committed Oct 7, 2024
1 parent 121c10f commit 747b18f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Blink3.API/Controllers/GuildsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task<ActionResult<IReadOnlyCollection<DiscordPartialChannel>>> GetC
string cacheKey = $"guild_{id}_categories";
IReadOnlyCollection<DiscordPartialChannel> categories = await _cachingService.GetOrAddAsync(cacheKey, async () =>
{
RestGuild? guild = await _botClient.GetGuildAsync(id);
RestGuild guild = await _botClient.GetGuildAsync(id);
IReadOnlyCollection<RestCategoryChannel>? categories = await guild.GetCategoryChannelsAsync();
return categories
.OrderBy(c => c.Position)
Expand Down Expand Up @@ -80,7 +80,7 @@ public async Task<ActionResult<IReadOnlyCollection<DiscordPartialChannel>>> GetC
string cacheKey = $"guild_{id}_channels";
IReadOnlyCollection<DiscordPartialChannel> channels = await _cachingService.GetOrAddAsync(cacheKey, async () =>
{
RestGuild? guild = await _botClient.GetGuildAsync(id);
RestGuild guild = await _botClient.GetGuildAsync(id);
IReadOnlyCollection<RestTextChannel>? channels = await guild.GetTextChannelsAsync();
return channels
.OrderBy(c => c.Position)
Expand Down

0 comments on commit 747b18f

Please sign in to comment.