Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahStolk committed Sep 7, 2024
1 parent 1391358 commit c108954
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 118 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public async Task EditModAsync(int id, ApiSpec.Admin.Mods.EditMod editMod)
throw new AdminDomainException($"Player with ID '{playerId}' does not exist.");
}

ModEntity? mod = _dbContext.Mods
ModEntity? mod = await _dbContext.Mods
.Include(m => m.PlayerMods)
.FirstOrDefault(m => m.Id == id);
.FirstOrDefaultAsync(m => m.Id == id);
if (mod == null)
throw new NotFoundException($"Mod with ID '{id}' does not exist.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public async Task EditPlayerAsync(int id, ApiSpec.Admin.Players.EditPlayer editP
throw new AdminDomainException($"Mod with ID '{modId}' does not exist.");
}

PlayerEntity? player = _dbContext.Players
PlayerEntity? player = await _dbContext.Players
.Include(p => p.PlayerMods)
.FirstOrDefault(p => p.Id == id);
.FirstOrDefaultAsync(p => p.Id == id);
if (player == null)
throw new NotFoundException($"Player with ID '{id}' does not exist.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public int GetFinalHomingValue()

public TargetCollection CreateTargetCollection()
{
return new()
return new TargetCollection
{
GemsCollected = GemsCollected,
GemsDespawned = GemsDespawned,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using DevilDaggersInfo.Web.Server.NSwag;
using NJsonSchema;
using NSwag;

namespace DevilDaggersInfo.Web.Server.Extensions;

Expand All @@ -22,7 +23,7 @@ public static void AddSwaggerDocument(this WebApplicationBuilder builder, string
{
document.Info.Title = $"DevilDaggers.info API ({apiNamespace.ToUpper()})";
document.Info.Description = description;
document.Info.Contact = new()
document.Info.Contact = new OpenApiContact
{
Name = "Noah Stolk", Url = "//noahstolk.com/",
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public DiscordBotService(IOptions<DiscordOptions> discordBotOptions, IWebHostEnv

public async Task StartAsync(CancellationToken cancellationToken)
{
_client = new(new()
_client = new DiscordClient(new DiscordConfiguration
{
Token = _discordBotOptions.Value.BotToken,
TokenType = TokenType.Bot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public static class DiscordColors

private static DiscordColor ToDiscordColor(Color color)
{
return new(color.R, color.G, color.B);
return new DiscordColor(color.R, color.G, color.B);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ public static class DiscordServerConstants

private static readonly Dictionary<Channel, ChannelWrapper> _channels = new()
{
{ Channel.MaintainersAuditLog, new(975077254046580828) },
{ Channel.MonitoringCustomLeaderboardValid, new(975077530732208148) },
{ Channel.MonitoringCustomLeaderboardInvalid, new(975077543575175228) },
{ Channel.MonitoringLog, new(975077324468920421) },
{ Channel.MonitoringTest, new(TestChannelId) },
{ Channel.CustomLeaderboards, new(578316107836817418) },
{ Channel.MaintainersAuditLog, new ChannelWrapper(975077254046580828) },
{ Channel.MonitoringCustomLeaderboardValid, new ChannelWrapper(975077530732208148) },
{ Channel.MonitoringCustomLeaderboardInvalid, new ChannelWrapper(975077543575175228) },
{ Channel.MonitoringLog, new ChannelWrapper(975077324468920421) },
{ Channel.MonitoringTest, new ChannelWrapper(TestChannelId) },
{ Channel.CustomLeaderboards, new ChannelWrapper(578316107836817418) },
};

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private async Task LogHighscore(CustomLeaderboardHighscoreLog highscoreLog)
Title = highscoreLog.Message,
Color = highscoreLog.Dagger.GetDiscordColor(),
Url = $"https://devildaggers.info/custom/leaderboard/{highscoreLog.CustomLeaderboardId}",
Thumbnail = new()
Thumbnail = new DiscordEmbedBuilder.EmbedThumbnail
{
Url = $"https://devildaggers.info/images/icons/discord-bot/{thumbnailImage}",
Height = 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private bool HistoryFileExistsForDate(DateTime dateTime)

private static LeaderboardHistory ConvertToHistoryModel(IDdLeaderboardService.LeaderboardResponse leaderboard, List<IDdLeaderboardService.EntryResponse> entries)
{
return new()
return new LeaderboardHistory
{
DaggersFiredGlobal = leaderboard.DaggersFiredGlobal,
DaggersHitGlobal = leaderboard.DaggersHitGlobal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class BackgroundServiceMonitor

public void Register(string name, TimeSpan interval)
{
_backgroundServiceLogs.Add(new(name, interval));
_backgroundServiceLogs.Add(new BackgroundServiceLog(name, interval));
}

public void Update(string name, DateTime lastExecuted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void LogNewScore(
CustomLeaderboardDagger dagger = customLeaderboard.DaggerFromStat(customEntry) ?? CustomLeaderboardDagger.Silver;
string scoreField = GetScoreFieldName(customLeaderboard.RankSorting);
string scoreValue = GetFormattedScoreValue(customLeaderboard.RankSorting, customEntry);
_highscoreLogs.Add(new()
_highscoreLogs.Add(new CustomLeaderboardHighscoreLog
{
RankValue = $"{rank}/{totalPlayers}",
Dagger = dagger,
Expand Down Expand Up @@ -61,7 +61,7 @@ public void LogHighscore(
string scoreValue = GetFormattedScoreValue(customLeaderboard.RankSorting, customEntry);
string message = $"`{playerName}` just got {GetScoreMessageText(customLeaderboard.RankSorting, customEntry)} on the `{spawnsetName}` leaderboard!";

_highscoreLogs.Add(new()
_highscoreLogs.Add(new CustomLeaderboardHighscoreLog
{
RankValue = $"{rank}/{totalPlayers}",
Dagger = dagger,
Expand Down
2 changes: 1 addition & 1 deletion src/DevilDaggersInfo.Web.Server/Utils/HistoryUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public static DateTime HistoryFileNameToDateTime(string dateString)
int hour = int.Parse(dateString[8..10]);
int minute = int.Parse(dateString[10..12]);

return new(year, month, day, hour, minute, 0, DateTimeKind.Utc);
return new DateTime(year, month, day, hour, minute, 0, DateTimeKind.Utc);
}
}

0 comments on commit c108954

Please sign in to comment.