From 38c7f32a76899ab48ded95af2a7a4d3492923bb0 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Fri, 18 Jun 2021 04:00:05 +0200 Subject: [PATCH] More cleanup - Moved all bot files to src/NadekoBot - Fixed tests path in ci - Fixed some warnings in MusicService - Cleaned up csproj slightly --- .gitlab-ci.yml | 2 +- NadekoBot.sln | 12 ++-- .../NadekoBot.Coordinator.csproj | 59 +----------------- src/NadekoBot.Coordinator/credentials.json | 32 ---------- .../credentials_example.json | 31 --------- .../Modules/Music/Services/IMusicService.cs | 3 +- .../Modules/Music/Services/MusicService.cs | 3 +- src/NadekoBot/NadekoBot.csproj | 34 ++++++++-- .../Program.cs | 0 .../libopus.so | Bin .../libsodium.dll | Bin .../libsodium.so | Bin .../nadeko_icon.ico | Bin .../opus.dll | Bin 14 files changed, 41 insertions(+), 135 deletions(-) delete mode 100644 src/NadekoBot.Coordinator/credentials.json delete mode 100644 src/NadekoBot.Coordinator/credentials_example.json rename src/{NadekoBot.Coordinator => NadekoBot}/Program.cs (100%) rename src/{NadekoBot.Coordinator => NadekoBot}/libopus.so (100%) rename src/{NadekoBot.Coordinator => NadekoBot}/libsodium.dll (100%) rename src/{NadekoBot.Coordinator => NadekoBot}/libsodium.so (100%) rename src/{NadekoBot.Coordinator => NadekoBot}/nadeko_icon.ico (100%) rename src/{NadekoBot.Coordinator => NadekoBot}/opus.dll (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 389e01d93..bd831404e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ stages: variables: project: "NadekoBot" - tests: "Nadeko.Tests" + tests: "NadekoBot.Tests" before_script: - "dotnet restore" diff --git a/NadekoBot.sln b/NadekoBot.sln index 0edd59e0d..5ef1e8922 100644 --- a/NadekoBot.sln +++ b/NadekoBot.sln @@ -6,12 +6,12 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{04929013-5BAB-42B0-B9B2-8F2BB8F16AF2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0B2F1537-4BF0-422B-A0DD-8F9CCEFB340F}" - ProjectSection(SolutionItems) = preProject - license.md = license.md - mkdocs.yml = mkdocs.yml - NadekoBot.iss = NadekoBot.iss - release.ps1 = release.ps1 - EndProjectSection +ProjectSection(SolutionItems) = preProject + CHANGELOG.md = CHANGELOG.md + LICENSE.md = LICENSE.md + README.md = README.md + .gitlab-ci.yml = .gitlab-ci.yml +EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NadekoBot", "src\NadekoBot\NadekoBot.csproj", "{45EC1473-C678-4857-A544-07DFE0D0B478}" EndProject diff --git a/src/NadekoBot.Coordinator/NadekoBot.Coordinator.csproj b/src/NadekoBot.Coordinator/NadekoBot.Coordinator.csproj index d75e40336..feb8aacb7 100644 --- a/src/NadekoBot.Coordinator/NadekoBot.Coordinator.csproj +++ b/src/NadekoBot.Coordinator/NadekoBot.Coordinator.csproj @@ -3,63 +3,6 @@ net5.0 9.0 - exe - nadeko_icon.ico Major - $(MSBuildProjectDirectory) - - - - 2.0.0 - $(VersionPrefix).$(VersionSuffix) - $(VersionPrefix) - - - - - - PreserveNewest - - - PreserveNewest - - - Always - - - PreserveNewest - - - Always - - - PreserveNewest - - - PreserveNewest - - - Always - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - $(DefineConstants);GLOBAL_NADEKO - $(NoWarn);CS1573;CS1591;CS8032 - - - - + diff --git a/src/NadekoBot.Coordinator/credentials.json b/src/NadekoBot.Coordinator/credentials.json deleted file mode 100644 index 26872caf8..000000000 --- a/src/NadekoBot.Coordinator/credentials.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "Token": "MTE5Nzc3MDIxMzE5NTc3NjEw.VlhNCw.xZ3lOoy35iROltPJVOXB2IaEMME", - "OwnerIds": [ - 105635576866156544 - ], - "LoLApiKey": "", - "GoogleApiKey": "", - "MashapeKey": "", - "OsuApiKey": "", - "SoundCloudClientId": "", - "CleverbotApiKey": "", - "CarbonKey": "", - "Db": { - "Type": "sqlite", - "ConnectionString": "Data Source=data/NadekoBot.db" - }, - "TotalShards": 1, - "PatreonAccessToken": "", - "PatreonCampaignId": "334038", - "RestartCommand": null, - "ShardRunCommand": "", - "ShardRunArguments": "", - "ShardRunPort": null, - "BotListToken": null, - "TwitchClientId": null, - "VotesToken": null, - "VotesUrl": null, - "RedisOptions": null, - "LocationIqApiKey": null, - "TimezoneDbApiKey": null, - "CoinmarketcapApiKey": null -} \ No newline at end of file diff --git a/src/NadekoBot.Coordinator/credentials_example.json b/src/NadekoBot.Coordinator/credentials_example.json deleted file mode 100644 index 18849be99..000000000 --- a/src/NadekoBot.Coordinator/credentials_example.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "Token": "", - "OwnerIds": [ - 105635576866156544 - ], - "GoogleApiKey": "", - "MashapeKey": "", - "OsuApiKey": "", - "SoundCloudClientId": "", - "CleverbotApiKey": "", - "CarbonKey": "", - "Db": { - "Type": "sqlite", - "ConnectionString": "Data Source=data/NadekoBot.db" - }, - "TotalShards": 1, - "PatreonAccessToken": "", - "PatreonCampaignId": "334038", - "RestartCommand": null, - "ShardRunCommand": "", - "ShardRunArguments": "", - "ShardRunPort": null, - "BotListToken": null, - "TwitchClientId": null, - "VotesToken": null, - "VotesUrl": null, - "RedisOptions": null, - "LocationIqApiKey": null, - "TimezoneDbApiKey": null, - "CoinmarketcapApiKey": null -} \ No newline at end of file diff --git a/src/NadekoBot/Modules/Music/Services/IMusicService.cs b/src/NadekoBot/Modules/Music/Services/IMusicService.cs index 1ff8d9fef..88648c459 100644 --- a/src/NadekoBot/Modules/Music/Services/IMusicService.cs +++ b/src/NadekoBot/Modules/Music/Services/IMusicService.cs @@ -1,5 +1,6 @@ #nullable enable using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using Discord; using NadekoBot.Core.Common; @@ -24,7 +25,7 @@ namespace NadekoBot.Modules.Music.Services public Task JoinVoiceChannelAsync(ulong guildId, ulong voiceChannelId); Task GetOrCreateMusicPlayerAsync(ITextChannel contextChannel); - bool TryGetMusicPlayer(ulong guildId, out IMusicPlayer musicPlayer); + bool TryGetMusicPlayer(ulong guildId, [MaybeNullWhen(false)] out IMusicPlayer musicPlayer); Task EnqueueYoutubePlaylistAsync(IMusicPlayer mp, string playlistId, string queuer); Task EnqueueDirectoryAsync(IMusicPlayer mp, string dirPath, string queuer); Task EnqueueSoundcloudPlaylistAsync(IMusicPlayer mp, string playlist, string queuer); diff --git a/src/NadekoBot/Modules/Music/Services/MusicService.cs b/src/NadekoBot/Modules/Music/Services/MusicService.cs index 99204a06e..d3b10d5d5 100644 --- a/src/NadekoBot/Modules/Music/Services/MusicService.cs +++ b/src/NadekoBot/Modules/Music/Services/MusicService.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Discord; @@ -93,7 +94,7 @@ namespace NadekoBot.Modules.Music.Services return _players.GetOrAdd(contextChannel.GuildId, newPLayer); } - public bool TryGetMusicPlayer(ulong guildId, out IMusicPlayer musicPlayer) + public bool TryGetMusicPlayer(ulong guildId, [MaybeNullWhen(false)] out IMusicPlayer musicPlayer) => _players.TryGetValue(guildId, out musicPlayer); public async Task EnqueueYoutubePlaylistAsync(IMusicPlayer mp, string query, string queuer) diff --git a/src/NadekoBot/NadekoBot.csproj b/src/NadekoBot/NadekoBot.csproj index b1eb7df2d..a6385ccfb 100644 --- a/src/NadekoBot/NadekoBot.csproj +++ b/src/NadekoBot/NadekoBot.csproj @@ -3,12 +3,11 @@ net5.0 9.0 + $(MSBuildProjectDirectory) + exe + nadeko_icon.ico - - - - - + @@ -50,6 +49,31 @@ + + + + PreserveNewest + + + PreserveNewest + + + Always + + + Always + + + Always + + + + + 2.0.0 + $(VersionPrefix).$(VersionSuffix) + $(VersionPrefix) + + $(DefineConstants);GLOBAL_NADEKO $(NoWarn);CS1573;CS1591 diff --git a/src/NadekoBot.Coordinator/Program.cs b/src/NadekoBot/Program.cs similarity index 100% rename from src/NadekoBot.Coordinator/Program.cs rename to src/NadekoBot/Program.cs diff --git a/src/NadekoBot.Coordinator/libopus.so b/src/NadekoBot/libopus.so similarity index 100% rename from src/NadekoBot.Coordinator/libopus.so rename to src/NadekoBot/libopus.so diff --git a/src/NadekoBot.Coordinator/libsodium.dll b/src/NadekoBot/libsodium.dll similarity index 100% rename from src/NadekoBot.Coordinator/libsodium.dll rename to src/NadekoBot/libsodium.dll diff --git a/src/NadekoBot.Coordinator/libsodium.so b/src/NadekoBot/libsodium.so similarity index 100% rename from src/NadekoBot.Coordinator/libsodium.so rename to src/NadekoBot/libsodium.so diff --git a/src/NadekoBot.Coordinator/nadeko_icon.ico b/src/NadekoBot/nadeko_icon.ico similarity index 100% rename from src/NadekoBot.Coordinator/nadeko_icon.ico rename to src/NadekoBot/nadeko_icon.ico diff --git a/src/NadekoBot.Coordinator/opus.dll b/src/NadekoBot/opus.dll similarity index 100% rename from src/NadekoBot.Coordinator/opus.dll rename to src/NadekoBot/opus.dll