From 78d272444994be689dcee9f07d5fde93ed951532 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 17 Nov 2024 14:06:05 +0100 Subject: [PATCH] Update to .NET 9 --- .github/workflows/dotnet.yml | 2 +- Dockerfile | 4 +- NuGet.Config | 6 - README.md | 10 +- src/iTool.DiscordBot/Modules/HOTSModule.cs | 109 ------------------ src/iTool.DiscordBot/iTool.DiscordBot.csproj | 15 ++- .../iTool.DiscordBot.Tests.csproj | 2 +- 7 files changed, 13 insertions(+), 135 deletions(-) delete mode 100644 NuGet.Config delete mode 100644 src/iTool.DiscordBot/Modules/HOTSModule.cs diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 7cf40ef..f74f899 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Install dependencies run: dotnet restore - name: Build diff --git a/Dockerfile b/Dockerfile index 229dead..7ff82da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 as builder +FROM mcr.microsoft.com/dotnet/sdk:9.0 as builder WORKDIR /repo COPY . . ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 RUN dotnet publish src/iTool.DiscordBot --configuration Release --output="/app" -FROM mcr.microsoft.com/dotnet/runtime:8.0 +FROM mcr.microsoft.com/dotnet/runtime:9.0 COPY --from=builder /app /app WORKDIR /app VOLUME /app/settings /app/data diff --git a/NuGet.Config b/NuGet.Config deleted file mode 100644 index 208625b..0000000 --- a/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/README.md b/README.md index fbae7e0..e921205 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # iTool.DiscordBot -![.NET][github-actions-badge] [![codecov][codecov-badge]][codecov-link] [![Discord][discord-badge]][discord-invite] +![.NET][github-actions-badge] [![codecov][codecov-badge]][codecov-link] [![Discord][discord-badge]][discord-invite] -i-Tool bot is a general purpose bot that has moderation commands, can check your CS:GO, Battlefield 3, 4, H and HOTS stats and a lot more! +i-Tool bot is a general purpose bot that has moderation commands, can check your CS:GO, Battlefield 3, 4, H stats and a lot more! ## Commands @@ -82,12 +82,6 @@ i-Tool bot is a general purpose bot that has moderation commands, can check your | prefix | | | Returns the current prefix | | prefix | setprefix, prefix set | | Sets the current prefix | -## HOTS commands - -| Command | Aliases | Permission | Description | -| ------- | ------- | ---------- | ----------- | -| hotsstats | | | Returns the HOTS stats of the player | - ## Steam commands | Command | Aliases | Permission | Description | diff --git a/src/iTool.DiscordBot/Modules/HOTSModule.cs b/src/iTool.DiscordBot/Modules/HOTSModule.cs deleted file mode 100644 index 164a1b0..0000000 --- a/src/iTool.DiscordBot/Modules/HOTSModule.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System.Threading.Tasks; -using Discord; -using Discord.Commands; -using HOTSLogs; - -namespace iTool.DiscordBot.Modules -{ - public sealed class HOTSModule : ModuleBase - { - private static HOTSLogsClient _client; - private readonly Settings _settings; - - public HOTSModule(Settings settings) - { - _client ??= new HOTSLogsClient(); - _settings = settings; - } - - [Command("hotsstats")] - [Summary("Returns the HOTS stats of the player")] - public async Task HOTSStats(Region region, string battleTag) - { - Player player = await _client.GetPlayerSummary(region, battleTag).ConfigureAwait(false); - if (player == null) - { - await ReplyAsync( - string.Empty, - embed: new EmbedBuilder() - { - Title = $"No player found", - Color = _settings.GetErrorColor(), - Description = "No player was found matching those criteria." - }.Build()).ConfigureAwait(false); - return; - } - - EmbedBuilder b = new EmbedBuilder() - { - Title = $"HOTS player summary for {player.Name}", - Color = _settings.GetColor(), - Url = $"https://www.hotslogs.com/Player/Profile?PlayerID={player.PlayerID}", - ThumbnailUrl = "https://eu.battle.net/heroes/static/images/logos/logo.png", - Footer = new EmbedFooterBuilder() - { - Text = "Powered by hotslogs.com", - } - } - .AddField("PlayerID", player.PlayerID.ToString(), true) - .AddField("Name", player.Name, true); - - foreach (Ranking ranking in player.LeaderboardRankings) - { - b.AddField(f => - { - f.IsInline = true; - f.Name = ranking.GameMode; - f.Value = $"**LeagueID**: {ranking.LeagueID}\n" + - $"- **LeagueRank**: {ranking.LeagueRank}\n" + - $"- **CurrentMMR**: {ranking.CurrentMMR}"; - }); - } - - await ReplyAsync(string.Empty, embed: b.Build()).ConfigureAwait(false); - } - - [Command("hotsstats")] - [Summary("Returns the HOTS stats of the player")] - public async Task HOTSStats(int playerID) - { - Player player = await _client.GetPlayerSummary(playerID).ConfigureAwait(false); - if (player == null) - { - await ReplyAsync( - string.Empty, - embed: new EmbedBuilder() - { - Title = $"No player found", - Color = _settings.GetErrorColor(), - Description = "No player was found matching those criteria." - }.Build()).ConfigureAwait(false); - return; - } - - EmbedBuilder b = new EmbedBuilder() - { - Title = $"HOTS player summary for {player.Name}", - Color = _settings.GetColor(), - Url = $"https://www.hotslogs.com/Player/Profile?PlayerID={player.PlayerID}", - ThumbnailUrl = "https://eu.battle.net/heroes/static/images/logos/logo.png" - } - .AddField("PlayerID", player.PlayerID.ToString(), true) - .AddField("Name", player.Name, true); - - foreach (Ranking ranking in player.LeaderboardRankings) - { - b.AddField(f => - { - f.IsInline = true; - f.Name = ranking.GameMode; - f.Value = $"- **LeagueID**: {ranking.LeagueID}\n" + - $"- **LeagueRank**: {ranking.LeagueRank}\n" + - $"- **CurrentMMR**: {ranking.CurrentMMR}"; - }); - } - - await ReplyAsync(string.Empty, embed: b.Build()).ConfigureAwait(false); - } - } -} diff --git a/src/iTool.DiscordBot/iTool.DiscordBot.csproj b/src/iTool.DiscordBot/iTool.DiscordBot.csproj index 03344b0..dcc02c3 100644 --- a/src/iTool.DiscordBot/iTool.DiscordBot.csproj +++ b/src/iTool.DiscordBot/iTool.DiscordBot.csproj @@ -1,21 +1,20 @@ - + Exe - net8.0 + net9.0 true - - - - + + + + - - + diff --git a/tests/iTool.DiscordBot.Tests/iTool.DiscordBot.Tests.csproj b/tests/iTool.DiscordBot.Tests/iTool.DiscordBot.Tests.csproj index 9128bfd..d49e307 100644 --- a/tests/iTool.DiscordBot.Tests/iTool.DiscordBot.Tests.csproj +++ b/tests/iTool.DiscordBot.Tests/iTool.DiscordBot.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 false