From 308ba36b2e7a45df47982c1deb325eb570da55af Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sun, 26 Mar 2023 14:44:25 +0200 Subject: [PATCH] More restructuring --- Nadeko.Bot.Modules.Searches/Class1.cs | 5 + .../Nadeko.Bot.Modules.Searches.csproj | 9 ++ NadekoBot.sln | 63 ++++++++++ src/Nadeko.Bot.Common/ICurrencyProvider.cs | 25 +++- .../Nadeko.Bot.Common.csproj | 3 + .../Services/ITimezoneService.cs | 6 + .../Services/Impl/StatsService.cs | 0 .../TypeReaders/GuildDateTimeTypeReader.cs | 6 +- .../Extensions/UserXpExtensions.cs | 9 ++ .../_Common => Nadeko.Bot.Db}/LevelStats.cs | 7 +- .../Administration.cs | 0 .../AdministrationService.cs | 2 +- .../AutoAssignRoleCommands.cs | 0 .../AutoAssignRoleService.cs | 9 +- .../AutoPublishService.cs | 0 .../DangerousCommands/DangerousCommands.cs | 0 .../DangerousCommandsService.cs | 0 .../GameVoiceChannelCommands.cs | 0 .../GameVoiceChannelService.cs | 2 +- .../GlobalUsings.cs | 32 +++++ .../GreetBye/GreetCommands.cs | 0 .../GreetBye/GreetGrouper.cs | 0 .../GreetBye/GreetService.cs | 2 +- .../GreetBye/GreetSettings.cs | 0 .../ImageOnlyChannelService.cs | 0 .../LocalizationCommands.cs | 0 .../Mute/MuteCommands.cs | 0 .../Mute/MuteService.cs | 0 .../Nadeko.Bot.Modules.Administration.csproj | 18 +++ .../DiscordPermOverrideCommands.cs | 0 .../DiscordPermOverrideService.cs | 0 .../PlayingRotate/PlayingRotateCommands.cs | 0 .../PlayingRotate/PlayingRotateService.cs | 0 .../Prefix/PrefixCommands.cs | 0 .../Protection/ProtectionCommands.cs | 0 .../Protection/ProtectionService.cs | 2 +- .../Protection/ProtectionStats.cs | 0 .../Protection/PunishQueueItem.cs | 0 .../Protection/UserSpamStats.cs | 0 .../Prune/PruneCommands.cs | 0 .../Prune/PruneService.cs | 0 .../Role/IReactionRoleService.cs | 0 .../Role/ReactionRoleCommands.cs | 0 .../Role/ReactionRolesService.cs | 2 +- .../Role/RoleCommands.cs | 0 .../Self/CheckForUpdatesService.cs | 0 .../Self/SelfCommands.cs | 0 .../Self/SelfService.cs | 0 .../SelfAssignedRolesCommands.cs | 0 .../SelfAssignedRolesService.cs | 1 - .../ServerLog/DummyLogCommandService.cs | 0 .../ServerLog/ServerLogCommandService.cs | 0 .../ServerLog/ServerLogCommands.cs | 0 .../Timezone/GuildTimezoneService.cs | 12 +- .../Timezone/TimeZoneCommands.cs | 0 .../UserPunish/UserPunishCommands.cs | 5 +- .../UserPunish/UserPunishService.cs | 0 .../VcRole/VcRoleCommands.cs | 0 .../VcRole/VcRoleService.cs | 2 +- .../Gambling/GamblingTopLevelModule.cs | 15 +-- .../CommandJsonObject.cs | 0 .../CommandsOptions.cs | 1 + src/Nadeko.Bot.Modules.Help/GlobalUsings.cs | 32 +++++ .../Help => Nadeko.Bot.Modules.Help}/Help.cs | 2 - .../HelpService.cs | 1 - .../Nadeko.Bot.Modules.Help.csproj | 17 +++ src/Nadeko.Bot.Modules.Music/GlobalUsings.cs | 31 +++++ .../Music.cs | 2 +- .../Nadeko.Bot.Modules.Music.csproj | 19 +++ .../PlaylistCommands.cs | 0 .../Services/AyuVoiceStateService.cs | 0 .../Services/IMusicService.cs | 0 .../Services/MusicService.cs | 0 .../Services}/SoundCloudApiService.cs | 0 .../Services/extractor/Misc.cs | 0 .../Services/extractor/YtLoader.cs | 0 .../_Common/ICachableTrackData.cs | 0 .../_Common/ILocalTrackResolver.cs | 0 .../_Common/IMusicPlayer.cs | 0 .../_Common/IMusicQueue.cs | 0 .../_Common/IPlatformQueryResolver.cs | 0 .../_Common/IQueuedTrackInfo.cs | 0 .../_Common/IRadioResolver.cs | 0 .../_Common/ISoundcloudResolver.cs | 0 .../_Common/ITrackCacher.cs | 0 .../_Common/ITrackInfo.cs | 0 .../_Common/ITrackResolveProvider.cs | 0 .../_Common/IVoiceProxy.cs | 0 .../_Common/IYoutubeResolver.cs | 0 .../_Common/Impl/CachableTrackData.cs | 0 .../_Common/Impl/MultimediaTimer.cs | 0 .../_Common/Impl/MusicExtensions.cs | 0 .../_Common/Impl/MusicPlatform.cs | 0 .../_Common/Impl/MusicPlayer.cs | 0 .../_Common/Impl/MusicQueue.cs | 0 .../_Common/Impl/RemoteTrackInfo.cs | 0 .../_Common/Impl/SimpleTrackInfo.cs | 0 .../_Common/Impl/TrackCacher.cs | 0 .../_Common/Impl/VoiceProxy.cs | 0 .../_Common/Resolvers/LocalTrackResolver.cs | 0 .../_Common/Resolvers/RadioResolveStrategy.cs | 0 .../_Common/Resolvers/SoundcloudResolver.cs | 0 .../_Common/Resolvers/TrackResolveProvider.cs | 0 .../_Common/Resolvers/YtdlYoutubeResolver.cs | 0 .../Blacklist/BlacklistCommands.cs | 0 .../Blacklist/BlacklistService.cs | 0 .../CleverbotResponseCmdCdTypeReader.cs | 0 .../CommandCooldown/CmdCdService.cs | 2 +- .../CommandCooldown/CmdCdsCommands.cs | 0 .../Filter/FilterCommands.cs | 0 .../Filter/FilterService.cs | 1 - .../Filter/ServerFilterSettings.cs | 0 .../GlobalPermissionCommands.cs | 0 .../GlobalPermissionService.cs | 0 .../GlobalUsings.cs | 32 +++++ .../Nadeko.Bot.Modules.Permisssions.csproj | 18 +++ .../PermissionCache.cs | 0 .../PermissionExtensions.cs | 0 .../Permissions.cs | 0 .../PermissionsCollection.cs | 0 .../PermissionsService.cs | 0 .../ResetPermissionsCommands.cs | 0 .../Anime/AnimeResult.cs | 0 .../Anime/AnimeSearchCommands.cs | 1 - .../Anime/AnimeSearchService.cs | 0 .../Anime/MangaResult.cs | 0 .../Crypto/CryptoCommands.cs | 0 .../Crypto/CryptoService.cs | 0 .../Crypto/DefaultStockDataService.cs | 8 +- .../Crypto/Drawing/CandleDrawingData.cs | 0 .../Drawing/IStockChartDrawingService.cs | 0 .../ImagesharpStockChartDrawingService.cs | 0 .../Crypto/IStockDataService.cs | 0 .../Crypto/Polygon/FinnHubSearchResponse.cs | 0 .../Crypto/Polygon/FinnHubSearchResult.cs | 0 .../Crypto/Polygon/PolygonApiClient.cs | 0 .../Crypto/Polygon/PolygonStockDataService.cs | 0 .../Crypto/Polygon/PolygonTickerData.cs | 0 .../Crypto/Polygon/PolygonTickerResponse.cs | 0 .../Crypto/_Common/CandleData.cs | 0 .../Crypto/_Common/ImageData.cs | 0 .../Crypto/_Common/QuoteResponse.cs | 0 .../Crypto/_Common/StockData.cs | 0 .../Crypto/_Common/SymbolData.cs | 0 .../Crypto/_Common/YahooFinanceCandleData.cs | 0 .../_Common/YahooFinanceSearchResponse.cs | 0 .../_Common/YahooFinanceSearchResponseItem.cs | 0 .../Crypto/_Common/YahooQueryModel.cs | 0 .../Feeds/FeedCommands.cs | 0 .../Feeds/FeedsService.cs | 2 +- .../GlobalUsings.cs | 32 +++++ .../JokeCommands.cs | 0 .../MemegenCommands.cs | 0 .../Nadeko.Bot.Modules.Searches.csproj | 31 +++++ .../OsuCommands.cs | 0 .../PathOfExileCommands.cs | 0 .../PlaceCommands.cs | 0 .../PokemonSearchCommands.cs | 0 .../Search/DefaultSearchServiceFactory.cs | 0 .../DuckDuckGoSeachService.cs | 0 .../Search/Google/GoogleCustomSearchResult.cs | 0 .../Search/Google/GoogleImageData.cs | 0 .../Search/Google/GoogleImageResult.cs | 0 .../Search/Google/GoogleImageResultEntry.cs | 0 .../Google/GoogleSearchResultInformation.cs | 0 .../Search/Google/GoogleSearchService.cs | 0 .../Google/OfficialGoogleSearchResultEntry.cs | 0 .../GoogleScrape/GoogleScrapeService.cs | 0 .../PlainGoogleScrapeSearchResult.cs | 0 .../GoogleScrape/PlainSearchResultEntry.cs | 0 .../GoogleScrape/PlainSearchResultInfo.cs | 0 .../Search/IImageSearchResult.cs | 0 .../Search/ISearchResult.cs | 0 .../Search/ISearchResultEntry.cs | 0 .../Search/ISearchResultInformation.cs | 0 .../Search/ISearchService.cs | 0 .../Search/ISearchServiceFactory.cs | 0 .../Search/SearchCommands.cs | 4 - .../Search/SearchServiceBase.cs | 0 .../Search/Searx/SearxImageSearchResult.cs | 0 .../Searx/SearxImageSearchResultEntry.cs | 0 .../Search/Searx/SearxInfobox.cs | 0 .../Search/Searx/SearxSearchAttribute.cs | 0 .../Search/Searx/SearxSearchResult.cs | 0 .../Search/Searx/SearxSearchResultEntry.cs | 0 .../Searx/SearxSearchResultInformation.cs | 0 .../Search/Searx/SearxSearchService.cs | 0 .../Search/Searx/SearxUrlData.cs | 0 .../Search/Youtube/IYoutubeSearchService.cs | 0 .../Search/Youtube/InvidiousSearchResponse.cs | 0 .../Youtube/InvidiousYtSearchService.cs | 0 .../Search/Youtube/VideoInfo.cs | 0 .../Youtube/YoutubeDataApiSearchService.cs | 0 .../Youtube/YtdlYoutubeSearchService.cs | 0 .../Youtube/YtdlpYoutubeSearchService.cs | 0 .../Search/Youtube/YtdlxServiceBase.cs | 0 .../Searches.cs | 117 +++++++++--------- .../SearchesService.cs | 0 .../StreamNotificationCommands.cs | 0 .../StreamNotificationService.cs | 4 +- .../StreamOnlineMessageDeleterService.cs | 0 .../Translate/ITranslateService.cs | 0 .../Translate/TranslateService.cs | 4 +- .../Translate/TranslatorCommands.cs | 0 .../XkcdCommands.cs | 0 .../YoutubeTrack/YtTrackService.cs | 0 .../YoutubeTrack/YtUploadCommands.cs | 0 .../_Common/AtlExtensions.cs | 0 .../_Common/BibleVerses.cs | 1 + .../_Common/Config/ImgSearchEngine.cs | 0 .../_Common/Config/SearchesConfig.cs | 0 .../_Common/Config/SearchesConfigService.cs | 0 .../_Common/Config/WebSearchEngine.cs | 0 .../_Common/CryptoData.cs | 0 .../_Common/DefineModel.cs | 0 .../_Common/E621Object.cs | 0 .../Exceptions/StreamNotFoundException.cs | 0 .../_Common/Extensions.cs | 2 +- .../_Common/Gallery.cs | 0 .../_Common/GatariUserResponse.cs | 0 .../_Common/GatariUserStatsResponse.cs | 0 .../_Common/GoogleSearchResult.cs | 0 .../_Common/HearthstoneCardData.cs | 0 .../_Common/LowerCaseNamingPolicy.cs | 2 +- .../_Common/MagicItem.cs | 0 .../_Common/MtgData.cs | 0 .../_Common/NovelData.cs | 0 .../_Common/OmdbMovie.cs | 0 .../_Common/OsuUserData.cs | 0 .../_Common/PathOfExileModels.cs | 0 .../_Common/SteamGameId.cs | 0 .../Models/HelixStreamsResponse.cs | 0 .../Models/HelixUsersResponse.cs | 0 .../Models/PicartoChannelResponse.cs | 0 .../StreamNotifications/Models/StreamData.cs | 0 .../Models/StreamDataKey.cs | 0 .../Models/TrovoGetUsersResponse.cs | 0 .../Models/TrovoRequestData.cs | 0 .../Models/TrovoSocialLink.cs | 0 .../Models/TwitchResponseV5.cs | 0 .../Models/TwitchUsersResponseV5.cs | 0 .../StreamNotifications/NotifChecker.cs | 0 .../Providers/PicartoProvider.cs | 0 .../StreamNotifications/Providers/Provider.cs | 0 .../Providers/TrovoProvider.cs | 0 .../Providers/TwitchHelixProvider.cs | 0 .../_Common/TimeData.cs | 0 .../_Common/TimeModels.cs | 0 .../_Common/UrbanDef.cs | 0 .../_Common/WeatherModels.cs | 0 .../_Common/WikipediaApiModel.cs | 0 .../_Common/WoWJoke.cs | 0 .../Alias/AliasCommands.cs | 0 .../Alias/AliasService.cs | 0 .../Calc/CalcCommands.cs | 0 .../ConfigCommands.cs | 0 .../GlobalUsings.cs | 32 +++++ .../Info/InfoCommands.cs | 0 .../Info/InviteCommands.cs | 0 .../Invite/InviteService.cs | 0 .../Nadeko.Bot.Modules.Utility.csproj | 25 ++++ .../Patronage/Config/PatronageConfig.cs | 0 .../Patronage/CurrencyRewardService.cs | 0 .../Patronage/InsufficientTier.cs | 0 .../Patronage/Patreon/PatreonClient.cs | 0 .../Patronage/Patreon/PatreonCredentials.cs | 0 .../Patronage/Patreon/PatreonMemberData.cs | 0 .../Patronage/Patreon/PatreonRefreshData.cs | 0 .../Patreon/PatreonSubscriptionHandler.cs | 0 .../Patronage/PatronageCommands.cs | 0 .../Patronage/PatronageService.cs | 1 - .../Quote/IQuoteService.cs | 0 .../Quote/QuoteCommands.cs | 0 .../Quote/QuoteService.cs | 0 .../Remind/RemindCommands.cs | 5 +- .../Remind/RemindService.cs | 0 .../Repeater/RepeatCommands.cs | 0 .../Repeater/RepeaterService.cs | 0 .../Repeater/RunningRepeater.cs | 0 .../StreamRole/StreamRoleCommands.cs | 0 .../StreamRole/StreamRoleService.cs | 2 +- .../UnitConversion/ConverterService.cs | 0 .../UnitConversion/UnitConversionCommands.cs | 0 .../Utility.cs | 5 +- .../VerboseErrors/EvalCommands.cs | 0 .../VerboseErrors/EvalGlobals.cs | 0 .../VerboseErrorsService.cs | 2 +- .../_Common/ConvertUnit.cs | 0 .../Exceptions/StreamRoleNotFoundException.cs | 0 .../StreamRolePermissionException.cs | 0 .../_Common/Patreon/PatreonData.cs | 0 .../_Common/StreamRoleListType.cs | 0 .../Xp => Nadeko.Bot.Modules.Xp}/Club/Club.cs | 15 +-- .../Club/ClubService.cs | 0 .../Club/IClubService.cs | 0 .../Club/Results/ClubAcceptResult.cs | 0 .../Club/Results/ClubBanResult.cs | 0 .../Club/Results/ClubCreateResult.cs | 0 .../Club/Results/ClubKickResult.cs | 0 .../Club/Results/ClubLeaveResult.cs | 0 .../Club/Results/ClubTransferError.cs | 0 .../Club/Results/ClubUnbanResult.cs | 0 .../Club/Results/SetClubIconResult.cs | 0 .../Club/Results/ToggleAdminResult.cs | 0 src/Nadeko.Bot.Modules.Xp/GlobalUsings.cs | 32 +++++ .../Nadeko.Bot.Modules.Xp.csproj | 18 +++ .../Xp => Nadeko.Bot.Modules.Xp}/Xp.cs | 95 +++++++------- .../Xp => Nadeko.Bot.Modules.Xp}/XpConfig.cs | 0 .../XpConfigService.cs | 0 .../Xp => Nadeko.Bot.Modules.Xp}/XpRewards.cs | 17 ++- .../Xp => Nadeko.Bot.Modules.Xp}/XpService.cs | 4 +- .../_Common/Extensions.cs | 10 ++ .../_Common/FullUserStats.cs | 1 + .../_Common/UserCacheItem.cs | 0 .../_Common/XpTemplate.cs | 0 src/Nadeko.Common/Extensions/Extensions.cs | 7 ++ src/NadekoBot.Tests/NadekoBot.Tests.csproj | 1 + .../Modules/Xp/_Common/Extensions.cs | 15 --- src/NadekoBot/NadekoBot.csproj | 9 +- 319 files changed, 681 insertions(+), 218 deletions(-) create mode 100644 Nadeko.Bot.Modules.Searches/Class1.cs create mode 100644 Nadeko.Bot.Modules.Searches/Nadeko.Bot.Modules.Searches.csproj create mode 100644 src/Nadeko.Bot.Common/Services/ITimezoneService.cs rename src/{NadekoBot => Nadeko.Bot.Common}/Services/Impl/StatsService.cs (100%) rename src/{NadekoBot/Common => Nadeko.Bot.Common}/TypeReaders/GuildDateTimeTypeReader.cs (89%) rename src/{NadekoBot/Modules/Xp/_Common => Nadeko.Bot.Db}/LevelStats.cs (84%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Administration.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/AdministrationService.cs (99%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/AutoAssignableRoles/AutoAssignRoleCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/AutoAssignableRoles/AutoAssignRoleService.cs (98%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/AutoPublishService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/DangerousCommands/DangerousCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/DangerousCommands/DangerousCommandsService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/GameVoiceChannel/GameVoiceChannelCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/GameVoiceChannel/GameVoiceChannelService.cs (99%) create mode 100644 src/Nadeko.Bot.Modules.Administration/GlobalUsings.cs rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/GreetBye/GreetCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/GreetBye/GreetGrouper.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/GreetBye/GreetService.cs (99%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/GreetBye/GreetSettings.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/ImageOnlyChannelService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/LocalizationCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Mute/MuteCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Mute/MuteService.cs (100%) create mode 100644 src/Nadeko.Bot.Modules.Administration/Nadeko.Bot.Modules.Administration.csproj rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/PermOverrides/DiscordPermOverrideCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/PermOverrides/DiscordPermOverrideService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/PlayingRotate/PlayingRotateCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/PlayingRotate/PlayingRotateService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Prefix/PrefixCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Protection/ProtectionCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Protection/ProtectionService.cs (99%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Protection/ProtectionStats.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Protection/PunishQueueItem.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Protection/UserSpamStats.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Prune/PruneCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Prune/PruneService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Role/IReactionRoleService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Role/ReactionRoleCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Role/ReactionRolesService.cs (99%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Role/RoleCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Self/CheckForUpdatesService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Self/SelfCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Self/SelfService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/SelfAssignableRoles/SelfAssignedRolesCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/SelfAssignableRoles/SelfAssignedRolesService.cs (99%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/ServerLog/DummyLogCommandService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/ServerLog/ServerLogCommandService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/ServerLog/ServerLogCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Timezone/GuildTimezoneService.cs (84%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/Timezone/TimeZoneCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/UserPunish/UserPunishCommands.cs (99%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/UserPunish/UserPunishService.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/VcRole/VcRoleCommands.cs (100%) rename src/{NadekoBot/Modules/Administration => Nadeko.Bot.Modules.Administration}/VcRole/VcRoleService.cs (98%) rename src/{NadekoBot/Modules/Help => Nadeko.Bot.Modules.Help}/CommandJsonObject.cs (100%) rename src/{NadekoBot/Modules/Help => Nadeko.Bot.Modules.Help}/CommandsOptions.cs (96%) create mode 100644 src/Nadeko.Bot.Modules.Help/GlobalUsings.cs rename src/{NadekoBot/Modules/Help => Nadeko.Bot.Modules.Help}/Help.cs (99%) rename src/{NadekoBot/Modules/Help => Nadeko.Bot.Modules.Help}/HelpService.cs (99%) create mode 100644 src/Nadeko.Bot.Modules.Help/Nadeko.Bot.Modules.Help.csproj create mode 100644 src/Nadeko.Bot.Modules.Music/GlobalUsings.cs rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/Music.cs (99%) create mode 100644 src/Nadeko.Bot.Modules.Music/Nadeko.Bot.Modules.Music.csproj rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/PlaylistCommands.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/Services/AyuVoiceStateService.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/Services/IMusicService.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/Services/MusicService.cs (100%) rename src/{NadekoBot/Services/Impl => Nadeko.Bot.Modules.Music/Services}/SoundCloudApiService.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/Services/extractor/Misc.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/Services/extractor/YtLoader.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/ICachableTrackData.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/ILocalTrackResolver.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/IMusicPlayer.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/IMusicQueue.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/IPlatformQueryResolver.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/IQueuedTrackInfo.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/IRadioResolver.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/ISoundcloudResolver.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/ITrackCacher.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/ITrackInfo.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/ITrackResolveProvider.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/IVoiceProxy.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/IYoutubeResolver.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Impl/CachableTrackData.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Impl/MultimediaTimer.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Impl/MusicExtensions.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Impl/MusicPlatform.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Impl/MusicPlayer.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Impl/MusicQueue.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Impl/RemoteTrackInfo.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Impl/SimpleTrackInfo.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Impl/TrackCacher.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Impl/VoiceProxy.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Resolvers/LocalTrackResolver.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Resolvers/RadioResolveStrategy.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Resolvers/SoundcloudResolver.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Resolvers/TrackResolveProvider.cs (100%) rename src/{NadekoBot/Modules/Music => Nadeko.Bot.Modules.Music}/_Common/Resolvers/YtdlYoutubeResolver.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/Blacklist/BlacklistCommands.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/Blacklist/BlacklistService.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/CommandCooldown/CleverbotResponseCmdCdTypeReader.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/CommandCooldown/CmdCdService.cs (99%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/CommandCooldown/CmdCdsCommands.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/Filter/FilterCommands.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/Filter/FilterService.cs (99%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/Filter/ServerFilterSettings.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/GlobalPermissions/GlobalPermissionCommands.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/GlobalPermissions/GlobalPermissionService.cs (100%) create mode 100644 src/Nadeko.Bot.Modules.Permisssions/GlobalUsings.cs create mode 100644 src/Nadeko.Bot.Modules.Permisssions/Nadeko.Bot.Modules.Permisssions.csproj rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/PermissionCache.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/PermissionExtensions.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/Permissions.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/PermissionsCollection.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/PermissionsService.cs (100%) rename src/{NadekoBot/Modules/Permissions => Nadeko.Bot.Modules.Permisssions}/ResetPermissionsCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Anime/AnimeResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Anime/AnimeSearchCommands.cs (99%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Anime/AnimeSearchService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Anime/MangaResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/CryptoCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/CryptoService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/DefaultStockDataService.cs (95%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/Drawing/CandleDrawingData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/Drawing/IStockChartDrawingService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/Drawing/ImagesharpStockChartDrawingService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/IStockDataService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/Polygon/FinnHubSearchResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/Polygon/FinnHubSearchResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/Polygon/PolygonApiClient.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/Polygon/PolygonStockDataService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/Polygon/PolygonTickerData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/Polygon/PolygonTickerResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/_Common/CandleData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/_Common/ImageData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/_Common/QuoteResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/_Common/StockData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/_Common/SymbolData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/_Common/YahooFinanceCandleData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/_Common/YahooFinanceSearchResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/_Common/YahooFinanceSearchResponseItem.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Crypto/_Common/YahooQueryModel.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Feeds/FeedCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Feeds/FeedsService.cs (99%) create mode 100644 src/Nadeko.Bot.Modules.Searches/GlobalUsings.cs rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/JokeCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/MemegenCommands.cs (100%) create mode 100644 src/Nadeko.Bot.Modules.Searches/Nadeko.Bot.Modules.Searches.csproj rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/OsuCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/PathOfExileCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/PlaceCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/PokemonSearchCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/DefaultSearchServiceFactory.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/DuckDuckGoScrape/DuckDuckGoSeachService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Google/GoogleCustomSearchResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Google/GoogleImageData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Google/GoogleImageResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Google/GoogleImageResultEntry.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Google/GoogleSearchResultInformation.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Google/GoogleSearchService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Google/OfficialGoogleSearchResultEntry.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/GoogleScrape/GoogleScrapeService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/GoogleScrape/PlainGoogleScrapeSearchResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/GoogleScrape/PlainSearchResultEntry.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/GoogleScrape/PlainSearchResultInfo.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/IImageSearchResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/ISearchResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/ISearchResultEntry.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/ISearchResultInformation.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/ISearchService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/ISearchServiceFactory.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/SearchCommands.cs (98%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/SearchServiceBase.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Searx/SearxImageSearchResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Searx/SearxImageSearchResultEntry.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Searx/SearxInfobox.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Searx/SearxSearchAttribute.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Searx/SearxSearchResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Searx/SearxSearchResultEntry.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Searx/SearxSearchResultInformation.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Searx/SearxSearchService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Searx/SearxUrlData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Youtube/IYoutubeSearchService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Youtube/InvidiousSearchResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Youtube/InvidiousYtSearchService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Youtube/VideoInfo.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Youtube/YoutubeDataApiSearchService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Youtube/YtdlYoutubeSearchService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Youtube/YtdlpYoutubeSearchService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Search/Youtube/YtdlxServiceBase.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Searches.cs (82%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/SearchesService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/StreamNotification/StreamNotificationCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/StreamNotification/StreamNotificationService.cs (99%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/StreamNotification/StreamOnlineMessageDeleterService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Translate/ITranslateService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Translate/TranslateService.cs (99%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/Translate/TranslatorCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/XkcdCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/YoutubeTrack/YtTrackService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/YoutubeTrack/YtUploadCommands.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/AtlExtensions.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/BibleVerses.cs (90%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/Config/ImgSearchEngine.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/Config/SearchesConfig.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/Config/SearchesConfigService.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/Config/WebSearchEngine.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/CryptoData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/DefineModel.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/E621Object.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/Exceptions/StreamNotFoundException.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/Extensions.cs (82%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/Gallery.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/GatariUserResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/GatariUserStatsResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/GoogleSearchResult.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/HearthstoneCardData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/LowerCaseNamingPolicy.cs (84%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/MagicItem.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/MtgData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/NovelData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/OmdbMovie.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/OsuUserData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/PathOfExileModels.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/SteamGameId.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Models/HelixStreamsResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Models/HelixUsersResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Models/PicartoChannelResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Models/StreamData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Models/StreamDataKey.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Models/TrovoGetUsersResponse.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Models/TrovoRequestData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Models/TrovoSocialLink.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Models/TwitchResponseV5.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Models/TwitchUsersResponseV5.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/NotifChecker.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Providers/PicartoProvider.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Providers/Provider.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Providers/TrovoProvider.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/StreamNotifications/Providers/TwitchHelixProvider.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/TimeData.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/TimeModels.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/UrbanDef.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/WeatherModels.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/WikipediaApiModel.cs (100%) rename src/{NadekoBot/Modules/Searches => Nadeko.Bot.Modules.Searches}/_Common/WoWJoke.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Alias/AliasCommands.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Alias/AliasService.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Calc/CalcCommands.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/ConfigCommands.cs (100%) create mode 100644 src/Nadeko.Bot.Modules.Utility/GlobalUsings.cs rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Info/InfoCommands.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Info/InviteCommands.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Invite/InviteService.cs (100%) create mode 100644 src/Nadeko.Bot.Modules.Utility/Nadeko.Bot.Modules.Utility.csproj rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Patronage/Config/PatronageConfig.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Patronage/CurrencyRewardService.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Patronage/InsufficientTier.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Patronage/Patreon/PatreonClient.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Patronage/Patreon/PatreonCredentials.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Patronage/Patreon/PatreonMemberData.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Patronage/Patreon/PatreonRefreshData.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Patronage/Patreon/PatreonSubscriptionHandler.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Patronage/PatronageCommands.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Patronage/PatronageService.cs (99%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Quote/IQuoteService.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Quote/QuoteCommands.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Quote/QuoteService.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Remind/RemindCommands.cs (97%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Remind/RemindService.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Repeater/RepeatCommands.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Repeater/RepeaterService.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Repeater/RunningRepeater.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/StreamRole/StreamRoleCommands.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/StreamRole/StreamRoleService.cs (99%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/UnitConversion/ConverterService.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/UnitConversion/UnitConversionCommands.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/Utility.cs (99%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/VerboseErrors/EvalCommands.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/VerboseErrors/EvalGlobals.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/VerboseErrorsService.cs (99%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/_Common/ConvertUnit.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/_Common/Exceptions/StreamRoleNotFoundException.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/_Common/Exceptions/StreamRolePermissionException.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/_Common/Patreon/PatreonData.cs (100%) rename src/{NadekoBot/Modules/Utility => Nadeko.Bot.Modules.Utility}/_Common/StreamRoleListType.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/Club.cs (97%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/ClubService.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/IClubService.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/Results/ClubAcceptResult.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/Results/ClubBanResult.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/Results/ClubCreateResult.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/Results/ClubKickResult.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/Results/ClubLeaveResult.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/Results/ClubTransferError.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/Results/ClubUnbanResult.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/Results/SetClubIconResult.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Club/Results/ToggleAdminResult.cs (100%) create mode 100644 src/Nadeko.Bot.Modules.Xp/GlobalUsings.cs create mode 100644 src/Nadeko.Bot.Modules.Xp/Nadeko.Bot.Modules.Xp.csproj rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/Xp.cs (88%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/XpConfig.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/XpConfigService.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/XpRewards.cs (93%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/XpService.cs (99%) create mode 100644 src/Nadeko.Bot.Modules.Xp/_Common/Extensions.cs rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/_Common/FullUserStats.cs (97%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/_Common/UserCacheItem.cs (100%) rename src/{NadekoBot/Modules/Xp => Nadeko.Bot.Modules.Xp}/_Common/XpTemplate.cs (100%) create mode 100644 src/Nadeko.Common/Extensions/Extensions.cs delete mode 100644 src/NadekoBot/Modules/Xp/_Common/Extensions.cs diff --git a/Nadeko.Bot.Modules.Searches/Class1.cs b/Nadeko.Bot.Modules.Searches/Class1.cs new file mode 100644 index 000000000..9be3e7956 --- /dev/null +++ b/Nadeko.Bot.Modules.Searches/Class1.cs @@ -0,0 +1,5 @@ +namespace Nadeko.Bot.Modules.Searches; + +public class Class1 +{ +} \ No newline at end of file diff --git a/Nadeko.Bot.Modules.Searches/Nadeko.Bot.Modules.Searches.csproj b/Nadeko.Bot.Modules.Searches/Nadeko.Bot.Modules.Searches.csproj new file mode 100644 index 000000000..6836c6808 --- /dev/null +++ b/Nadeko.Bot.Modules.Searches/Nadeko.Bot.Modules.Searches.csproj @@ -0,0 +1,9 @@ + + + + net7.0 + enable + enable + + + diff --git a/NadekoBot.sln b/NadekoBot.sln index 5cce753b9..9d2391daf 100644 --- a/NadekoBot.sln +++ b/NadekoBot.sln @@ -43,6 +43,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Common", "src\Na EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Modules.Gambling", "src\Nadeko.Bot.Modules.Gambling\Nadeko.Bot.Modules.Gambling.csproj", "{5F4F36A5-5874-4461-BB34-EE107E4B7F15}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Modules.Searches", "src\Nadeko.Bot.Modules.Searches\Nadeko.Bot.Modules.Searches.csproj", "{65E2A9D2-2239-41B0-AC46-48ACDDF6B121}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Modules.Music", "src\Nadeko.Bot.Modules.Music\Nadeko.Bot.Modules.Music.csproj", "{95271823-A8FC-4BEF-BB1E-FAE699722922}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Modules.Xp", "src\Nadeko.Bot.Modules.Xp\Nadeko.Bot.Modules.Xp.csproj", "{8B4CCF50-E109-4206-9FEB-93F199C42B8A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Modules.Utility", "src\Nadeko.Bot.Modules.Utility\Nadeko.Bot.Modules.Utility.csproj", "{1E338315-4BA9-4091-A06E-DE80399A1CF9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Modules.Permisssions", "src\Nadeko.Bot.Modules.Permisssions\Nadeko.Bot.Modules.Permisssions.csproj", "{A5B51533-33B6-43AF-9D2D-410613078E96}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Modules.Administration", "src\Nadeko.Bot.Modules.Administration\Nadeko.Bot.Modules.Administration.csproj", "{08C31FF8-AC47-498D-ACD9-612FA8001F1F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Modules.Help", "src\Nadeko.Bot.Modules.Help\Nadeko.Bot.Modules.Help.csproj", "{C6359697-25F1-4049-8D73-AC48043CA192}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -128,6 +142,48 @@ Global {5F4F36A5-5874-4461-BB34-EE107E4B7F15}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU {5F4F36A5-5874-4461-BB34-EE107E4B7F15}.Release|Any CPU.ActiveCfg = Release|Any CPU {5F4F36A5-5874-4461-BB34-EE107E4B7F15}.Release|Any CPU.Build.0 = Release|Any CPU + {65E2A9D2-2239-41B0-AC46-48ACDDF6B121}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65E2A9D2-2239-41B0-AC46-48ACDDF6B121}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65E2A9D2-2239-41B0-AC46-48ACDDF6B121}.GlobalNadeko|Any CPU.ActiveCfg = Debug|Any CPU + {65E2A9D2-2239-41B0-AC46-48ACDDF6B121}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU + {65E2A9D2-2239-41B0-AC46-48ACDDF6B121}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65E2A9D2-2239-41B0-AC46-48ACDDF6B121}.Release|Any CPU.Build.0 = Release|Any CPU + {95271823-A8FC-4BEF-BB1E-FAE699722922}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95271823-A8FC-4BEF-BB1E-FAE699722922}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95271823-A8FC-4BEF-BB1E-FAE699722922}.GlobalNadeko|Any CPU.ActiveCfg = Debug|Any CPU + {95271823-A8FC-4BEF-BB1E-FAE699722922}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU + {95271823-A8FC-4BEF-BB1E-FAE699722922}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95271823-A8FC-4BEF-BB1E-FAE699722922}.Release|Any CPU.Build.0 = Release|Any CPU + {8B4CCF50-E109-4206-9FEB-93F199C42B8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B4CCF50-E109-4206-9FEB-93F199C42B8A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B4CCF50-E109-4206-9FEB-93F199C42B8A}.GlobalNadeko|Any CPU.ActiveCfg = Debug|Any CPU + {8B4CCF50-E109-4206-9FEB-93F199C42B8A}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU + {8B4CCF50-E109-4206-9FEB-93F199C42B8A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B4CCF50-E109-4206-9FEB-93F199C42B8A}.Release|Any CPU.Build.0 = Release|Any CPU + {1E338315-4BA9-4091-A06E-DE80399A1CF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E338315-4BA9-4091-A06E-DE80399A1CF9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E338315-4BA9-4091-A06E-DE80399A1CF9}.GlobalNadeko|Any CPU.ActiveCfg = Debug|Any CPU + {1E338315-4BA9-4091-A06E-DE80399A1CF9}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU + {1E338315-4BA9-4091-A06E-DE80399A1CF9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E338315-4BA9-4091-A06E-DE80399A1CF9}.Release|Any CPU.Build.0 = Release|Any CPU + {A5B51533-33B6-43AF-9D2D-410613078E96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5B51533-33B6-43AF-9D2D-410613078E96}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5B51533-33B6-43AF-9D2D-410613078E96}.GlobalNadeko|Any CPU.ActiveCfg = Debug|Any CPU + {A5B51533-33B6-43AF-9D2D-410613078E96}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU + {A5B51533-33B6-43AF-9D2D-410613078E96}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5B51533-33B6-43AF-9D2D-410613078E96}.Release|Any CPU.Build.0 = Release|Any CPU + {08C31FF8-AC47-498D-ACD9-612FA8001F1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08C31FF8-AC47-498D-ACD9-612FA8001F1F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08C31FF8-AC47-498D-ACD9-612FA8001F1F}.GlobalNadeko|Any CPU.ActiveCfg = Debug|Any CPU + {08C31FF8-AC47-498D-ACD9-612FA8001F1F}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU + {08C31FF8-AC47-498D-ACD9-612FA8001F1F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08C31FF8-AC47-498D-ACD9-612FA8001F1F}.Release|Any CPU.Build.0 = Release|Any CPU + {C6359697-25F1-4049-8D73-AC48043CA192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C6359697-25F1-4049-8D73-AC48043CA192}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6359697-25F1-4049-8D73-AC48043CA192}.GlobalNadeko|Any CPU.ActiveCfg = Debug|Any CPU + {C6359697-25F1-4049-8D73-AC48043CA192}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU + {C6359697-25F1-4049-8D73-AC48043CA192}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C6359697-25F1-4049-8D73-AC48043CA192}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -147,6 +203,13 @@ Global {02499E3E-3B04-4BC8-9B3C-D9494661F78E} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} {02ABC10E-3323-4698-A388-C61D7D03797E} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} {5F4F36A5-5874-4461-BB34-EE107E4B7F15} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} + {65E2A9D2-2239-41B0-AC46-48ACDDF6B121} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} + {95271823-A8FC-4BEF-BB1E-FAE699722922} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} + {8B4CCF50-E109-4206-9FEB-93F199C42B8A} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} + {1E338315-4BA9-4091-A06E-DE80399A1CF9} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} + {A5B51533-33B6-43AF-9D2D-410613078E96} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} + {08C31FF8-AC47-498D-ACD9-612FA8001F1F} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} + {C6359697-25F1-4049-8D73-AC48043CA192} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {5F3F555C-855F-4BE8-B526-D062D3E8ACA4} diff --git a/src/Nadeko.Bot.Common/ICurrencyProvider.cs b/src/Nadeko.Bot.Common/ICurrencyProvider.cs index 4341ac31a..5e916b2c8 100644 --- a/src/Nadeko.Bot.Common/ICurrencyProvider.cs +++ b/src/Nadeko.Bot.Common/ICurrencyProvider.cs @@ -1,6 +1,29 @@ -namespace Nadeko.Bot.Common; +using System.Globalization; +using System.Numerics; + +namespace Nadeko.Bot.Common; public interface ICurrencyProvider { string GetCurrencySign(); +} + +public static class CurrencyHelper +{ + public static string N(T cur, IFormatProvider format) + where T : INumber + => cur.ToString("C0", format); + + public static string N(T cur, CultureInfo culture, string currencySign) + where T : INumber + => N(cur, GetCurrencyFormat(culture, currencySign)); + + private static IFormatProvider GetCurrencyFormat(CultureInfo culture, string currencySign) + { + var flowersCurrencyCulture = (CultureInfo)culture.Clone(); + flowersCurrencyCulture.NumberFormat.CurrencySymbol = currencySign; + flowersCurrencyCulture.NumberFormat.CurrencyNegativePattern = 5; + + return flowersCurrencyCulture; + } } \ No newline at end of file diff --git a/src/Nadeko.Bot.Common/Nadeko.Bot.Common.csproj b/src/Nadeko.Bot.Common/Nadeko.Bot.Common.csproj index 95fe5b51f..86391348e 100644 --- a/src/Nadeko.Bot.Common/Nadeko.Bot.Common.csproj +++ b/src/Nadeko.Bot.Common/Nadeko.Bot.Common.csproj @@ -25,6 +25,9 @@ all True + + + diff --git a/src/Nadeko.Bot.Common/Services/ITimezoneService.cs b/src/Nadeko.Bot.Common/Services/ITimezoneService.cs new file mode 100644 index 000000000..94662c8b8 --- /dev/null +++ b/src/Nadeko.Bot.Common/Services/ITimezoneService.cs @@ -0,0 +1,6 @@ +namespace NadekoBot.Common; + +public interface ITimezoneService +{ + TimeZoneInfo GetTimeZoneOrUtc(ulong? guildId); +} \ No newline at end of file diff --git a/src/NadekoBot/Services/Impl/StatsService.cs b/src/Nadeko.Bot.Common/Services/Impl/StatsService.cs similarity index 100% rename from src/NadekoBot/Services/Impl/StatsService.cs rename to src/Nadeko.Bot.Common/Services/Impl/StatsService.cs diff --git a/src/NadekoBot/Common/TypeReaders/GuildDateTimeTypeReader.cs b/src/Nadeko.Bot.Common/TypeReaders/GuildDateTimeTypeReader.cs similarity index 89% rename from src/NadekoBot/Common/TypeReaders/GuildDateTimeTypeReader.cs rename to src/Nadeko.Bot.Common/TypeReaders/GuildDateTimeTypeReader.cs index cf92ad24c..bce39f28e 100644 --- a/src/NadekoBot/Common/TypeReaders/GuildDateTimeTypeReader.cs +++ b/src/Nadeko.Bot.Common/TypeReaders/GuildDateTimeTypeReader.cs @@ -1,13 +1,11 @@ #nullable disable -using NadekoBot.Modules.Administration.Services; - namespace NadekoBot.Common.TypeReaders; public sealed class GuildDateTimeTypeReader : NadekoTypeReader { - private readonly GuildTimezoneService _gts; + private readonly ITimezoneService _gts; - public GuildDateTimeTypeReader(GuildTimezoneService gts) + public GuildDateTimeTypeReader(ITimezoneService gts) => _gts = gts; public override ValueTask> ReadAsync(ICommandContext context, string input) diff --git a/src/Nadeko.Bot.Db/Extensions/UserXpExtensions.cs b/src/Nadeko.Bot.Db/Extensions/UserXpExtensions.cs index 79f7da86b..5308f83d2 100644 --- a/src/Nadeko.Bot.Db/Extensions/UserXpExtensions.cs +++ b/src/Nadeko.Bot.Db/Extensions/UserXpExtensions.cs @@ -1,5 +1,6 @@ #nullable disable using LinqToDB; +using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using NadekoBot.Services.Database; using NadekoBot.Services.Database.Models; @@ -60,4 +61,12 @@ public static class UserXpExtensions public static void ResetGuildXp(this DbSet xps, ulong guildId) => xps.Delete(x => x.GuildId == guildId); + + public static async Task GetLevelDataFor(this ITable userXp, ulong guildId, ulong userId) + => await userXp + .Where(x => x.GuildId == guildId && x.UserId == userId) + .FirstOrDefaultAsyncLinqToDB() is UserXpStats uxs + ? new(uxs.Xp + uxs.AwardedXp) + : new(0); + } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Xp/_Common/LevelStats.cs b/src/Nadeko.Bot.Db/LevelStats.cs similarity index 84% rename from src/NadekoBot/Modules/Xp/_Common/LevelStats.cs rename to src/Nadeko.Bot.Db/LevelStats.cs index ce740887b..c6cb21f8c 100644 --- a/src/NadekoBot/Modules/Xp/_Common/LevelStats.cs +++ b/src/Nadeko.Bot.Db/LevelStats.cs @@ -1,10 +1,11 @@ #nullable disable -using NadekoBot.Modules.Xp.Services; -namespace NadekoBot.Modules.Xp; +namespace NadekoBot.Db; public readonly struct LevelStats { + public const int XP_REQUIRED_LVL_1 = 36; + public long Level { get; } public long LevelXp { get; } public long RequiredXp { get; } @@ -17,7 +18,7 @@ public readonly struct LevelStats TotalXp = xp; - const int baseXp = XpService.XP_REQUIRED_LVL_1; + const int baseXp = XP_REQUIRED_LVL_1; var required = baseXp; var totalXp = 0; diff --git a/src/NadekoBot/Modules/Administration/Administration.cs b/src/Nadeko.Bot.Modules.Administration/Administration.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Administration.cs rename to src/Nadeko.Bot.Modules.Administration/Administration.cs diff --git a/src/NadekoBot/Modules/Administration/AdministrationService.cs b/src/Nadeko.Bot.Modules.Administration/AdministrationService.cs similarity index 99% rename from src/NadekoBot/Modules/Administration/AdministrationService.cs rename to src/Nadeko.Bot.Modules.Administration/AdministrationService.cs index e35699725..1641b351b 100644 --- a/src/NadekoBot/Modules/Administration/AdministrationService.cs +++ b/src/Nadeko.Bot.Modules.Administration/AdministrationService.cs @@ -14,7 +14,7 @@ public class AdministrationService : INService private readonly ILogCommandService _logService; public AdministrationService( - Bot bot, + IBot bot, CommandHandler cmdHandler, DbService db, ILogCommandService logService) diff --git a/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs b/src/Nadeko.Bot.Modules.Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs rename to src/Nadeko.Bot.Modules.Administration/AutoAssignableRoles/AutoAssignRoleCommands.cs diff --git a/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleService.cs b/src/Nadeko.Bot.Modules.Administration/AutoAssignableRoles/AutoAssignRoleService.cs similarity index 98% rename from src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleService.cs rename to src/Nadeko.Bot.Modules.Administration/AutoAssignableRoles/AutoAssignRoleService.cs index 2a6f2dd6e..3cce25802 100644 --- a/src/NadekoBot/Modules/Administration/AutoAssignableRoles/AutoAssignRoleService.cs +++ b/src/Nadeko.Bot.Modules.Administration/AutoAssignableRoles/AutoAssignRoleService.cs @@ -1,11 +1,10 @@ #nullable disable -using LinqToDB; -using Microsoft.EntityFrameworkCore; -using NadekoBot.Db; using NadekoBot.Services.Database.Models; using System.Net; using System.Threading.Channels; -using Nadeko.Common; +using LinqToDB; +using Microsoft.EntityFrameworkCore; +using NadekoBot.Db; namespace NadekoBot.Modules.Administration.Services; @@ -25,7 +24,7 @@ public sealed class AutoAssignRoleService : INService SingleWriter = false }); - public AutoAssignRoleService(DiscordSocketClient client, Bot bot, DbService db) + public AutoAssignRoleService(DiscordSocketClient client, IBot bot, DbService db) { _client = client; _db = db; diff --git a/src/NadekoBot/Modules/Administration/AutoPublishService.cs b/src/Nadeko.Bot.Modules.Administration/AutoPublishService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/AutoPublishService.cs rename to src/Nadeko.Bot.Modules.Administration/AutoPublishService.cs diff --git a/src/NadekoBot/Modules/Administration/DangerousCommands/DangerousCommands.cs b/src/Nadeko.Bot.Modules.Administration/DangerousCommands/DangerousCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/DangerousCommands/DangerousCommands.cs rename to src/Nadeko.Bot.Modules.Administration/DangerousCommands/DangerousCommands.cs diff --git a/src/NadekoBot/Modules/Administration/DangerousCommands/DangerousCommandsService.cs b/src/Nadeko.Bot.Modules.Administration/DangerousCommands/DangerousCommandsService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/DangerousCommands/DangerousCommandsService.cs rename to src/Nadeko.Bot.Modules.Administration/DangerousCommands/DangerousCommandsService.cs diff --git a/src/NadekoBot/Modules/Administration/GameVoiceChannel/GameVoiceChannelCommands.cs b/src/Nadeko.Bot.Modules.Administration/GameVoiceChannel/GameVoiceChannelCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/GameVoiceChannel/GameVoiceChannelCommands.cs rename to src/Nadeko.Bot.Modules.Administration/GameVoiceChannel/GameVoiceChannelCommands.cs diff --git a/src/NadekoBot/Modules/Administration/GameVoiceChannel/GameVoiceChannelService.cs b/src/Nadeko.Bot.Modules.Administration/GameVoiceChannel/GameVoiceChannelService.cs similarity index 99% rename from src/NadekoBot/Modules/Administration/GameVoiceChannel/GameVoiceChannelService.cs rename to src/Nadeko.Bot.Modules.Administration/GameVoiceChannel/GameVoiceChannelService.cs index a09d1b031..d77d63e83 100644 --- a/src/NadekoBot/Modules/Administration/GameVoiceChannel/GameVoiceChannelService.cs +++ b/src/Nadeko.Bot.Modules.Administration/GameVoiceChannel/GameVoiceChannelService.cs @@ -10,7 +10,7 @@ public class GameVoiceChannelService : INService private readonly DbService _db; private readonly DiscordSocketClient _client; - public GameVoiceChannelService(DiscordSocketClient client, DbService db, Bot bot) + public GameVoiceChannelService(DiscordSocketClient client, DbService db, IBot bot) { _db = db; _client = client; diff --git a/src/Nadeko.Bot.Modules.Administration/GlobalUsings.cs b/src/Nadeko.Bot.Modules.Administration/GlobalUsings.cs new file mode 100644 index 000000000..f754e6165 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Administration/GlobalUsings.cs @@ -0,0 +1,32 @@ +// // global using System.Collections.Concurrent; +global using NonBlocking; +// +// // packages +global using Serilog; +global using Humanizer; +global using Newtonsoft; +// +// // nadekobot +// global using NadekoBot; +global using NadekoBot.Services; +global using Nadeko.Common; // new project +global using NadekoBot.Common; // old + nadekobot specific things +global using NadekoBot.Common.Attributes; +global using NadekoBot.Extensions; +// global using Nadeko.Snake; + +// discord +global using Discord; +global using Discord.Commands; +global using Discord.Net; +global using Discord.WebSocket; + +// aliases +global using GuildPerm = Discord.GuildPermission; +global using ChannelPerm = Discord.ChannelPermission; +global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute; +global using LeftoverAttribute = Discord.Commands.RemainderAttribute; +global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; + +// non-essential +// global using JetBrains.Annotations; \ No newline at end of file diff --git a/src/NadekoBot/Modules/Administration/GreetBye/GreetCommands.cs b/src/Nadeko.Bot.Modules.Administration/GreetBye/GreetCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/GreetBye/GreetCommands.cs rename to src/Nadeko.Bot.Modules.Administration/GreetBye/GreetCommands.cs diff --git a/src/NadekoBot/Modules/Administration/GreetBye/GreetGrouper.cs b/src/Nadeko.Bot.Modules.Administration/GreetBye/GreetGrouper.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/GreetBye/GreetGrouper.cs rename to src/Nadeko.Bot.Modules.Administration/GreetBye/GreetGrouper.cs diff --git a/src/NadekoBot/Modules/Administration/GreetBye/GreetService.cs b/src/Nadeko.Bot.Modules.Administration/GreetBye/GreetService.cs similarity index 99% rename from src/NadekoBot/Modules/Administration/GreetBye/GreetService.cs rename to src/Nadeko.Bot.Modules.Administration/GreetBye/GreetService.cs index 3bc46fc0d..2a1b2edf8 100644 --- a/src/NadekoBot/Modules/Administration/GreetBye/GreetService.cs +++ b/src/Nadeko.Bot.Modules.Administration/GreetBye/GreetService.cs @@ -21,7 +21,7 @@ public class GreetService : INService, IReadyExecutor public GreetService( DiscordSocketClient client, - Bot bot, + IBot bot, DbService db, BotConfigService bss) { diff --git a/src/NadekoBot/Modules/Administration/GreetBye/GreetSettings.cs b/src/Nadeko.Bot.Modules.Administration/GreetBye/GreetSettings.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/GreetBye/GreetSettings.cs rename to src/Nadeko.Bot.Modules.Administration/GreetBye/GreetSettings.cs diff --git a/src/NadekoBot/Modules/Administration/ImageOnlyChannelService.cs b/src/Nadeko.Bot.Modules.Administration/ImageOnlyChannelService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/ImageOnlyChannelService.cs rename to src/Nadeko.Bot.Modules.Administration/ImageOnlyChannelService.cs diff --git a/src/NadekoBot/Modules/Administration/LocalizationCommands.cs b/src/Nadeko.Bot.Modules.Administration/LocalizationCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/LocalizationCommands.cs rename to src/Nadeko.Bot.Modules.Administration/LocalizationCommands.cs diff --git a/src/NadekoBot/Modules/Administration/Mute/MuteCommands.cs b/src/Nadeko.Bot.Modules.Administration/Mute/MuteCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Mute/MuteCommands.cs rename to src/Nadeko.Bot.Modules.Administration/Mute/MuteCommands.cs diff --git a/src/NadekoBot/Modules/Administration/Mute/MuteService.cs b/src/Nadeko.Bot.Modules.Administration/Mute/MuteService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Mute/MuteService.cs rename to src/Nadeko.Bot.Modules.Administration/Mute/MuteService.cs diff --git a/src/Nadeko.Bot.Modules.Administration/Nadeko.Bot.Modules.Administration.csproj b/src/Nadeko.Bot.Modules.Administration/Nadeko.Bot.Modules.Administration.csproj new file mode 100644 index 000000000..7e53c4371 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Administration/Nadeko.Bot.Modules.Administration.csproj @@ -0,0 +1,18 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + diff --git a/src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideCommands.cs b/src/Nadeko.Bot.Modules.Administration/PermOverrides/DiscordPermOverrideCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideCommands.cs rename to src/Nadeko.Bot.Modules.Administration/PermOverrides/DiscordPermOverrideCommands.cs diff --git a/src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideService.cs b/src/Nadeko.Bot.Modules.Administration/PermOverrides/DiscordPermOverrideService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/PermOverrides/DiscordPermOverrideService.cs rename to src/Nadeko.Bot.Modules.Administration/PermOverrides/DiscordPermOverrideService.cs diff --git a/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateCommands.cs b/src/Nadeko.Bot.Modules.Administration/PlayingRotate/PlayingRotateCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateCommands.cs rename to src/Nadeko.Bot.Modules.Administration/PlayingRotate/PlayingRotateCommands.cs diff --git a/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateService.cs b/src/Nadeko.Bot.Modules.Administration/PlayingRotate/PlayingRotateService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateService.cs rename to src/Nadeko.Bot.Modules.Administration/PlayingRotate/PlayingRotateService.cs diff --git a/src/NadekoBot/Modules/Administration/Prefix/PrefixCommands.cs b/src/Nadeko.Bot.Modules.Administration/Prefix/PrefixCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Prefix/PrefixCommands.cs rename to src/Nadeko.Bot.Modules.Administration/Prefix/PrefixCommands.cs diff --git a/src/NadekoBot/Modules/Administration/Protection/ProtectionCommands.cs b/src/Nadeko.Bot.Modules.Administration/Protection/ProtectionCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Protection/ProtectionCommands.cs rename to src/Nadeko.Bot.Modules.Administration/Protection/ProtectionCommands.cs diff --git a/src/NadekoBot/Modules/Administration/Protection/ProtectionService.cs b/src/Nadeko.Bot.Modules.Administration/Protection/ProtectionService.cs similarity index 99% rename from src/NadekoBot/Modules/Administration/Protection/ProtectionService.cs rename to src/Nadeko.Bot.Modules.Administration/Protection/ProtectionService.cs index 345b089cb..bd03278f1 100644 --- a/src/NadekoBot/Modules/Administration/Protection/ProtectionService.cs +++ b/src/Nadeko.Bot.Modules.Administration/Protection/ProtectionService.cs @@ -33,7 +33,7 @@ public class ProtectionService : INService public ProtectionService( DiscordSocketClient client, - Bot bot, + IBot bot, MuteService mute, DbService db, UserPunishService punishService) diff --git a/src/NadekoBot/Modules/Administration/Protection/ProtectionStats.cs b/src/Nadeko.Bot.Modules.Administration/Protection/ProtectionStats.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Protection/ProtectionStats.cs rename to src/Nadeko.Bot.Modules.Administration/Protection/ProtectionStats.cs diff --git a/src/NadekoBot/Modules/Administration/Protection/PunishQueueItem.cs b/src/Nadeko.Bot.Modules.Administration/Protection/PunishQueueItem.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Protection/PunishQueueItem.cs rename to src/Nadeko.Bot.Modules.Administration/Protection/PunishQueueItem.cs diff --git a/src/NadekoBot/Modules/Administration/Protection/UserSpamStats.cs b/src/Nadeko.Bot.Modules.Administration/Protection/UserSpamStats.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Protection/UserSpamStats.cs rename to src/Nadeko.Bot.Modules.Administration/Protection/UserSpamStats.cs diff --git a/src/NadekoBot/Modules/Administration/Prune/PruneCommands.cs b/src/Nadeko.Bot.Modules.Administration/Prune/PruneCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Prune/PruneCommands.cs rename to src/Nadeko.Bot.Modules.Administration/Prune/PruneCommands.cs diff --git a/src/NadekoBot/Modules/Administration/Prune/PruneService.cs b/src/Nadeko.Bot.Modules.Administration/Prune/PruneService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Prune/PruneService.cs rename to src/Nadeko.Bot.Modules.Administration/Prune/PruneService.cs diff --git a/src/NadekoBot/Modules/Administration/Role/IReactionRoleService.cs b/src/Nadeko.Bot.Modules.Administration/Role/IReactionRoleService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Role/IReactionRoleService.cs rename to src/Nadeko.Bot.Modules.Administration/Role/IReactionRoleService.cs diff --git a/src/NadekoBot/Modules/Administration/Role/ReactionRoleCommands.cs b/src/Nadeko.Bot.Modules.Administration/Role/ReactionRoleCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Role/ReactionRoleCommands.cs rename to src/Nadeko.Bot.Modules.Administration/Role/ReactionRoleCommands.cs diff --git a/src/NadekoBot/Modules/Administration/Role/ReactionRolesService.cs b/src/Nadeko.Bot.Modules.Administration/Role/ReactionRolesService.cs similarity index 99% rename from src/NadekoBot/Modules/Administration/Role/ReactionRolesService.cs rename to src/Nadeko.Bot.Modules.Administration/Role/ReactionRolesService.cs index a90fe44ad..b70e4ec97 100644 --- a/src/NadekoBot/Modules/Administration/Role/ReactionRolesService.cs +++ b/src/Nadeko.Bot.Modules.Administration/Role/ReactionRolesService.cs @@ -2,8 +2,8 @@ using LinqToDB; using LinqToDB.EntityFrameworkCore; using NadekoBot.Common.ModuleBehaviors; +using NadekoBot.Db; using NadekoBot.Modules.Utility.Patronage; -using NadekoBot.Modules.Xp.Extensions; using NadekoBot.Services.Database.Models; using OneOf.Types; using OneOf; diff --git a/src/NadekoBot/Modules/Administration/Role/RoleCommands.cs b/src/Nadeko.Bot.Modules.Administration/Role/RoleCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Role/RoleCommands.cs rename to src/Nadeko.Bot.Modules.Administration/Role/RoleCommands.cs diff --git a/src/NadekoBot/Modules/Administration/Self/CheckForUpdatesService.cs b/src/Nadeko.Bot.Modules.Administration/Self/CheckForUpdatesService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Self/CheckForUpdatesService.cs rename to src/Nadeko.Bot.Modules.Administration/Self/CheckForUpdatesService.cs diff --git a/src/NadekoBot/Modules/Administration/Self/SelfCommands.cs b/src/Nadeko.Bot.Modules.Administration/Self/SelfCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Self/SelfCommands.cs rename to src/Nadeko.Bot.Modules.Administration/Self/SelfCommands.cs diff --git a/src/NadekoBot/Modules/Administration/Self/SelfService.cs b/src/Nadeko.Bot.Modules.Administration/Self/SelfService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Self/SelfService.cs rename to src/Nadeko.Bot.Modules.Administration/Self/SelfService.cs diff --git a/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs b/src/Nadeko.Bot.Modules.Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs rename to src/Nadeko.Bot.Modules.Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs diff --git a/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesService.cs b/src/Nadeko.Bot.Modules.Administration/SelfAssignableRoles/SelfAssignedRolesService.cs similarity index 99% rename from src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesService.cs rename to src/Nadeko.Bot.Modules.Administration/SelfAssignableRoles/SelfAssignedRolesService.cs index 5cf18d159..8742d8c92 100644 --- a/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesService.cs +++ b/src/Nadeko.Bot.Modules.Administration/SelfAssignableRoles/SelfAssignedRolesService.cs @@ -1,7 +1,6 @@ #nullable disable using Microsoft.EntityFrameworkCore; using NadekoBot.Db; -using NadekoBot.Modules.Xp; using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Administration.Services; diff --git a/src/NadekoBot/Modules/Administration/ServerLog/DummyLogCommandService.cs b/src/Nadeko.Bot.Modules.Administration/ServerLog/DummyLogCommandService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/ServerLog/DummyLogCommandService.cs rename to src/Nadeko.Bot.Modules.Administration/ServerLog/DummyLogCommandService.cs diff --git a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs b/src/Nadeko.Bot.Modules.Administration/ServerLog/ServerLogCommandService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs rename to src/Nadeko.Bot.Modules.Administration/ServerLog/ServerLogCommandService.cs diff --git a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommands.cs b/src/Nadeko.Bot.Modules.Administration/ServerLog/ServerLogCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommands.cs rename to src/Nadeko.Bot.Modules.Administration/ServerLog/ServerLogCommands.cs diff --git a/src/NadekoBot/Modules/Administration/Timezone/GuildTimezoneService.cs b/src/Nadeko.Bot.Modules.Administration/Timezone/GuildTimezoneService.cs similarity index 84% rename from src/NadekoBot/Modules/Administration/Timezone/GuildTimezoneService.cs rename to src/Nadeko.Bot.Modules.Administration/Timezone/GuildTimezoneService.cs index a4bf5b1d9..7b6efd09b 100644 --- a/src/NadekoBot/Modules/Administration/Timezone/GuildTimezoneService.cs +++ b/src/Nadeko.Bot.Modules.Administration/Timezone/GuildTimezoneService.cs @@ -1,17 +1,16 @@ #nullable disable -using Nadeko.Common; using NadekoBot.Db; using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Administration.Services; -public class GuildTimezoneService : INService +public sealed class GuildTimezoneService : ITimezoneService, INService { public static ConcurrentDictionary AllServices { get; } = new(); private readonly ConcurrentDictionary _timezones; private readonly DbService _db; - public GuildTimezoneService(DiscordSocketClient client, Bot bot, DbService db) + public GuildTimezoneService(DiscordSocketClient client, IBot bot, DbService db) { _timezones = bot.AllGuildConfigs.Select(GetTimzezoneTuple) .Where(x => x.Timezone is not null) @@ -52,10 +51,11 @@ public class GuildTimezoneService : INService return (x.GuildId, Timezone: tz); } - public TimeZoneInfo GetTimeZoneOrDefault(ulong guildId) + public TimeZoneInfo GetTimeZoneOrDefault(ulong? guildId) { - if (_timezones.TryGetValue(guildId, out var tz)) + if (guildId is ulong gid && _timezones.TryGetValue(gid, out var tz)) return tz; + return null; } @@ -73,6 +73,6 @@ public class GuildTimezoneService : INService _timezones.AddOrUpdate(guildId, tz, (_, _) => tz); } - public TimeZoneInfo GetTimeZoneOrUtc(ulong guildId) + public TimeZoneInfo GetTimeZoneOrUtc(ulong? guildId) => GetTimeZoneOrDefault(guildId) ?? TimeZoneInfo.Utc; } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Administration/Timezone/TimeZoneCommands.cs b/src/Nadeko.Bot.Modules.Administration/Timezone/TimeZoneCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/Timezone/TimeZoneCommands.cs rename to src/Nadeko.Bot.Modules.Administration/Timezone/TimeZoneCommands.cs diff --git a/src/NadekoBot/Modules/Administration/UserPunish/UserPunishCommands.cs b/src/Nadeko.Bot.Modules.Administration/UserPunish/UserPunishCommands.cs similarity index 99% rename from src/NadekoBot/Modules/Administration/UserPunish/UserPunishCommands.cs rename to src/Nadeko.Bot.Modules.Administration/UserPunish/UserPunishCommands.cs index e9142d8ea..bdac03dba 100644 --- a/src/NadekoBot/Modules/Administration/UserPunish/UserPunishCommands.cs +++ b/src/Nadeko.Bot.Modules.Administration/UserPunish/UserPunishCommands.cs @@ -3,7 +3,6 @@ using CommandLine; using Humanizer.Localisation; using NadekoBot.Common.TypeReaders.Models; using NadekoBot.Modules.Administration.Services; -using NadekoBot.Modules.Permissions.Services; using NadekoBot.Services.Database.Models; namespace NadekoBot.Modules.Administration; @@ -19,12 +18,10 @@ public partial class Administration } private readonly MuteService _mute; - private readonly BlacklistService _blacklistService; - public UserPunishCommands(MuteService mute, BlacklistService blacklistService) + public UserPunishCommands(MuteService mute) { _mute = mute; - _blacklistService = blacklistService; } private async Task CheckRoleHierarchy(IGuildUser target) diff --git a/src/NadekoBot/Modules/Administration/UserPunish/UserPunishService.cs b/src/Nadeko.Bot.Modules.Administration/UserPunish/UserPunishService.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/UserPunish/UserPunishService.cs rename to src/Nadeko.Bot.Modules.Administration/UserPunish/UserPunishService.cs diff --git a/src/NadekoBot/Modules/Administration/VcRole/VcRoleCommands.cs b/src/Nadeko.Bot.Modules.Administration/VcRole/VcRoleCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Administration/VcRole/VcRoleCommands.cs rename to src/Nadeko.Bot.Modules.Administration/VcRole/VcRoleCommands.cs diff --git a/src/NadekoBot/Modules/Administration/VcRole/VcRoleService.cs b/src/Nadeko.Bot.Modules.Administration/VcRole/VcRoleService.cs similarity index 98% rename from src/NadekoBot/Modules/Administration/VcRole/VcRoleService.cs rename to src/Nadeko.Bot.Modules.Administration/VcRole/VcRoleService.cs index eedf04a4e..1f5ac2c68 100644 --- a/src/NadekoBot/Modules/Administration/VcRole/VcRoleService.cs +++ b/src/Nadeko.Bot.Modules.Administration/VcRole/VcRoleService.cs @@ -13,7 +13,7 @@ public class VcRoleService : INService private readonly DbService _db; private readonly DiscordSocketClient _client; - public VcRoleService(DiscordSocketClient client, Bot bot, DbService db) + public VcRoleService(DiscordSocketClient client, IBot bot, DbService db) { _db = db; _client = client; diff --git a/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs index 2fe50e876..08bcf27f2 100644 --- a/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs +++ b/src/Nadeko.Bot.Modules.Gambling/Gambling/GamblingTopLevelModule.cs @@ -3,6 +3,7 @@ using NadekoBot.Modules.Gambling.Services; using System.Globalization; using System.Numerics; using Discord; +using Nadeko.Bot.Common; using NadekoBot.Common; namespace NadekoBot.Modules.Gambling.Common; @@ -42,21 +43,9 @@ public abstract class GamblingModule : NadekoModule return true; } - public static string N(T cur, IFormatProvider format) - where T : INumber - => cur.ToString("C0", format); - protected string N(T cur) where T : INumber - => N(cur, GetFlowersCiInternal()); - - protected IFormatProvider GetFlowersCiInternal() - { - var flowersCi = (CultureInfo)Culture.Clone(); - flowersCi.NumberFormat.CurrencySymbol = CurrencySign; - flowersCi.NumberFormat.CurrencyNegativePattern = 5; - return flowersCi; - } + => CurrencyHelper.N(cur, Culture, CurrencySign); protected Task CheckBetMandatory(long amount) { diff --git a/src/NadekoBot/Modules/Help/CommandJsonObject.cs b/src/Nadeko.Bot.Modules.Help/CommandJsonObject.cs similarity index 100% rename from src/NadekoBot/Modules/Help/CommandJsonObject.cs rename to src/Nadeko.Bot.Modules.Help/CommandJsonObject.cs diff --git a/src/NadekoBot/Modules/Help/CommandsOptions.cs b/src/Nadeko.Bot.Modules.Help/CommandsOptions.cs similarity index 96% rename from src/NadekoBot/Modules/Help/CommandsOptions.cs rename to src/Nadeko.Bot.Modules.Help/CommandsOptions.cs index b65df3b25..d74d6b59c 100644 --- a/src/NadekoBot/Modules/Help/CommandsOptions.cs +++ b/src/Nadeko.Bot.Modules.Help/CommandsOptions.cs @@ -1,5 +1,6 @@ #nullable disable using CommandLine; +using NadekoBot.Common; namespace NadekoBot.Modules.Help.Common; diff --git a/src/Nadeko.Bot.Modules.Help/GlobalUsings.cs b/src/Nadeko.Bot.Modules.Help/GlobalUsings.cs new file mode 100644 index 000000000..f754e6165 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Help/GlobalUsings.cs @@ -0,0 +1,32 @@ +// // global using System.Collections.Concurrent; +global using NonBlocking; +// +// // packages +global using Serilog; +global using Humanizer; +global using Newtonsoft; +// +// // nadekobot +// global using NadekoBot; +global using NadekoBot.Services; +global using Nadeko.Common; // new project +global using NadekoBot.Common; // old + nadekobot specific things +global using NadekoBot.Common.Attributes; +global using NadekoBot.Extensions; +// global using Nadeko.Snake; + +// discord +global using Discord; +global using Discord.Commands; +global using Discord.Net; +global using Discord.WebSocket; + +// aliases +global using GuildPerm = Discord.GuildPermission; +global using ChannelPerm = Discord.ChannelPermission; +global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute; +global using LeftoverAttribute = Discord.Commands.RemainderAttribute; +global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; + +// non-essential +// global using JetBrains.Annotations; \ No newline at end of file diff --git a/src/NadekoBot/Modules/Help/Help.cs b/src/Nadeko.Bot.Modules.Help/Help.cs similarity index 99% rename from src/NadekoBot/Modules/Help/Help.cs rename to src/Nadeko.Bot.Modules.Help/Help.cs index ab0da1fb9..e52a865d5 100644 --- a/src/NadekoBot/Modules/Help/Help.cs +++ b/src/Nadeko.Bot.Modules.Help/Help.cs @@ -3,11 +3,9 @@ using Amazon.S3; using Nadeko.Medusa; using NadekoBot.Modules.Help.Common; using NadekoBot.Modules.Help.Services; -using NadekoBot.Modules.Permissions.Services; using Newtonsoft.Json; using System.Text; using System.Text.Json; -using Nadeko.Common; using JsonSerializer = System.Text.Json.JsonSerializer; namespace NadekoBot.Modules.Help; diff --git a/src/NadekoBot/Modules/Help/HelpService.cs b/src/Nadeko.Bot.Modules.Help/HelpService.cs similarity index 99% rename from src/NadekoBot/Modules/Help/HelpService.cs rename to src/Nadeko.Bot.Modules.Help/HelpService.cs index bc2076952..678a0ce7b 100644 --- a/src/NadekoBot/Modules/Help/HelpService.cs +++ b/src/Nadeko.Bot.Modules.Help/HelpService.cs @@ -3,7 +3,6 @@ using CommandLine; using Nadeko.Common; using Nadeko.Medusa; using NadekoBot.Common.ModuleBehaviors; -using NadekoBot.Modules.Administration.Services; namespace NadekoBot.Modules.Help.Services; diff --git a/src/Nadeko.Bot.Modules.Help/Nadeko.Bot.Modules.Help.csproj b/src/Nadeko.Bot.Modules.Help/Nadeko.Bot.Modules.Help.csproj new file mode 100644 index 000000000..88326f525 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Help/Nadeko.Bot.Modules.Help.csproj @@ -0,0 +1,17 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + diff --git a/src/Nadeko.Bot.Modules.Music/GlobalUsings.cs b/src/Nadeko.Bot.Modules.Music/GlobalUsings.cs new file mode 100644 index 000000000..f36328bd4 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Music/GlobalUsings.cs @@ -0,0 +1,31 @@ +// global using System.Collections.Concurrent; +global using NonBlocking; + +// packages +global using Serilog; +global using Humanizer; + +// nadekobot +global using NadekoBot; +global using NadekoBot.Services; +global using Nadeko.Common; // new project +global using NadekoBot.Common; // old + nadekobot specific things +global using NadekoBot.Common.Attributes; +global using NadekoBot.Extensions; +global using Nadeko.Snake; + +// discord +global using Discord; +global using Discord.Commands; +global using Discord.Net; +global using Discord.WebSocket; + +// aliases +global using GuildPerm = Discord.GuildPermission; +global using ChannelPerm = Discord.ChannelPermission; +global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute; +global using LeftoverAttribute = Discord.Commands.RemainderAttribute; +global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; + +// non-essential +global using JetBrains.Annotations; \ No newline at end of file diff --git a/src/NadekoBot/Modules/Music/Music.cs b/src/Nadeko.Bot.Modules.Music/Music.cs similarity index 99% rename from src/NadekoBot/Modules/Music/Music.cs rename to src/Nadeko.Bot.Modules.Music/Music.cs index 0d424950b..20bf14a3e 100644 --- a/src/NadekoBot/Modules/Music/Music.cs +++ b/src/Nadeko.Bot.Modules.Music/Music.cs @@ -16,7 +16,7 @@ public sealed partial class Music : NadekoModule Q = 2, Queue = 2, Playlist = 2, Pl = 2 } - public const string MUSIC_ICON_URL = "http://i.imgur.com/nhKS3PT.png"; + public const string MUSIC_ICON_URL = "https://i.imgur.com/nhKS3PT.png"; private const int LQ_ITEMS_PER_PAGE = 9; diff --git a/src/Nadeko.Bot.Modules.Music/Nadeko.Bot.Modules.Music.csproj b/src/Nadeko.Bot.Modules.Music/Nadeko.Bot.Modules.Music.csproj new file mode 100644 index 000000000..00a63d5fa --- /dev/null +++ b/src/Nadeko.Bot.Modules.Music/Nadeko.Bot.Modules.Music.csproj @@ -0,0 +1,19 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + diff --git a/src/NadekoBot/Modules/Music/PlaylistCommands.cs b/src/Nadeko.Bot.Modules.Music/PlaylistCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Music/PlaylistCommands.cs rename to src/Nadeko.Bot.Modules.Music/PlaylistCommands.cs diff --git a/src/NadekoBot/Modules/Music/Services/AyuVoiceStateService.cs b/src/Nadeko.Bot.Modules.Music/Services/AyuVoiceStateService.cs similarity index 100% rename from src/NadekoBot/Modules/Music/Services/AyuVoiceStateService.cs rename to src/Nadeko.Bot.Modules.Music/Services/AyuVoiceStateService.cs diff --git a/src/NadekoBot/Modules/Music/Services/IMusicService.cs b/src/Nadeko.Bot.Modules.Music/Services/IMusicService.cs similarity index 100% rename from src/NadekoBot/Modules/Music/Services/IMusicService.cs rename to src/Nadeko.Bot.Modules.Music/Services/IMusicService.cs diff --git a/src/NadekoBot/Modules/Music/Services/MusicService.cs b/src/Nadeko.Bot.Modules.Music/Services/MusicService.cs similarity index 100% rename from src/NadekoBot/Modules/Music/Services/MusicService.cs rename to src/Nadeko.Bot.Modules.Music/Services/MusicService.cs diff --git a/src/NadekoBot/Services/Impl/SoundCloudApiService.cs b/src/Nadeko.Bot.Modules.Music/Services/SoundCloudApiService.cs similarity index 100% rename from src/NadekoBot/Services/Impl/SoundCloudApiService.cs rename to src/Nadeko.Bot.Modules.Music/Services/SoundCloudApiService.cs diff --git a/src/NadekoBot/Modules/Music/Services/extractor/Misc.cs b/src/Nadeko.Bot.Modules.Music/Services/extractor/Misc.cs similarity index 100% rename from src/NadekoBot/Modules/Music/Services/extractor/Misc.cs rename to src/Nadeko.Bot.Modules.Music/Services/extractor/Misc.cs diff --git a/src/NadekoBot/Modules/Music/Services/extractor/YtLoader.cs b/src/Nadeko.Bot.Modules.Music/Services/extractor/YtLoader.cs similarity index 100% rename from src/NadekoBot/Modules/Music/Services/extractor/YtLoader.cs rename to src/Nadeko.Bot.Modules.Music/Services/extractor/YtLoader.cs diff --git a/src/NadekoBot/Modules/Music/_Common/ICachableTrackData.cs b/src/Nadeko.Bot.Modules.Music/_Common/ICachableTrackData.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/ICachableTrackData.cs rename to src/Nadeko.Bot.Modules.Music/_Common/ICachableTrackData.cs diff --git a/src/NadekoBot/Modules/Music/_Common/ILocalTrackResolver.cs b/src/Nadeko.Bot.Modules.Music/_Common/ILocalTrackResolver.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/ILocalTrackResolver.cs rename to src/Nadeko.Bot.Modules.Music/_Common/ILocalTrackResolver.cs diff --git a/src/NadekoBot/Modules/Music/_Common/IMusicPlayer.cs b/src/Nadeko.Bot.Modules.Music/_Common/IMusicPlayer.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/IMusicPlayer.cs rename to src/Nadeko.Bot.Modules.Music/_Common/IMusicPlayer.cs diff --git a/src/NadekoBot/Modules/Music/_Common/IMusicQueue.cs b/src/Nadeko.Bot.Modules.Music/_Common/IMusicQueue.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/IMusicQueue.cs rename to src/Nadeko.Bot.Modules.Music/_Common/IMusicQueue.cs diff --git a/src/NadekoBot/Modules/Music/_Common/IPlatformQueryResolver.cs b/src/Nadeko.Bot.Modules.Music/_Common/IPlatformQueryResolver.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/IPlatformQueryResolver.cs rename to src/Nadeko.Bot.Modules.Music/_Common/IPlatformQueryResolver.cs diff --git a/src/NadekoBot/Modules/Music/_Common/IQueuedTrackInfo.cs b/src/Nadeko.Bot.Modules.Music/_Common/IQueuedTrackInfo.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/IQueuedTrackInfo.cs rename to src/Nadeko.Bot.Modules.Music/_Common/IQueuedTrackInfo.cs diff --git a/src/NadekoBot/Modules/Music/_Common/IRadioResolver.cs b/src/Nadeko.Bot.Modules.Music/_Common/IRadioResolver.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/IRadioResolver.cs rename to src/Nadeko.Bot.Modules.Music/_Common/IRadioResolver.cs diff --git a/src/NadekoBot/Modules/Music/_Common/ISoundcloudResolver.cs b/src/Nadeko.Bot.Modules.Music/_Common/ISoundcloudResolver.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/ISoundcloudResolver.cs rename to src/Nadeko.Bot.Modules.Music/_Common/ISoundcloudResolver.cs diff --git a/src/NadekoBot/Modules/Music/_Common/ITrackCacher.cs b/src/Nadeko.Bot.Modules.Music/_Common/ITrackCacher.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/ITrackCacher.cs rename to src/Nadeko.Bot.Modules.Music/_Common/ITrackCacher.cs diff --git a/src/NadekoBot/Modules/Music/_Common/ITrackInfo.cs b/src/Nadeko.Bot.Modules.Music/_Common/ITrackInfo.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/ITrackInfo.cs rename to src/Nadeko.Bot.Modules.Music/_Common/ITrackInfo.cs diff --git a/src/NadekoBot/Modules/Music/_Common/ITrackResolveProvider.cs b/src/Nadeko.Bot.Modules.Music/_Common/ITrackResolveProvider.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/ITrackResolveProvider.cs rename to src/Nadeko.Bot.Modules.Music/_Common/ITrackResolveProvider.cs diff --git a/src/NadekoBot/Modules/Music/_Common/IVoiceProxy.cs b/src/Nadeko.Bot.Modules.Music/_Common/IVoiceProxy.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/IVoiceProxy.cs rename to src/Nadeko.Bot.Modules.Music/_Common/IVoiceProxy.cs diff --git a/src/NadekoBot/Modules/Music/_Common/IYoutubeResolver.cs b/src/Nadeko.Bot.Modules.Music/_Common/IYoutubeResolver.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/IYoutubeResolver.cs rename to src/Nadeko.Bot.Modules.Music/_Common/IYoutubeResolver.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Impl/CachableTrackData.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/CachableTrackData.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Impl/CachableTrackData.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Impl/CachableTrackData.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Impl/MultimediaTimer.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/MultimediaTimer.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Impl/MultimediaTimer.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Impl/MultimediaTimer.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Impl/MusicExtensions.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicExtensions.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Impl/MusicExtensions.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicExtensions.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Impl/MusicPlatform.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicPlatform.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Impl/MusicPlatform.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicPlatform.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Impl/MusicPlayer.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicPlayer.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Impl/MusicPlayer.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicPlayer.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Impl/MusicQueue.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicQueue.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Impl/MusicQueue.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Impl/MusicQueue.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Impl/RemoteTrackInfo.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/RemoteTrackInfo.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Impl/RemoteTrackInfo.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Impl/RemoteTrackInfo.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Impl/SimpleTrackInfo.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/SimpleTrackInfo.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Impl/SimpleTrackInfo.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Impl/SimpleTrackInfo.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Impl/TrackCacher.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/TrackCacher.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Impl/TrackCacher.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Impl/TrackCacher.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Impl/VoiceProxy.cs b/src/Nadeko.Bot.Modules.Music/_Common/Impl/VoiceProxy.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Impl/VoiceProxy.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Impl/VoiceProxy.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Resolvers/LocalTrackResolver.cs b/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/LocalTrackResolver.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Resolvers/LocalTrackResolver.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Resolvers/LocalTrackResolver.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Resolvers/RadioResolveStrategy.cs b/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/RadioResolveStrategy.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Resolvers/RadioResolveStrategy.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Resolvers/RadioResolveStrategy.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Resolvers/SoundcloudResolver.cs b/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/SoundcloudResolver.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Resolvers/SoundcloudResolver.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Resolvers/SoundcloudResolver.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Resolvers/TrackResolveProvider.cs b/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/TrackResolveProvider.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Resolvers/TrackResolveProvider.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Resolvers/TrackResolveProvider.cs diff --git a/src/NadekoBot/Modules/Music/_Common/Resolvers/YtdlYoutubeResolver.cs b/src/Nadeko.Bot.Modules.Music/_Common/Resolvers/YtdlYoutubeResolver.cs similarity index 100% rename from src/NadekoBot/Modules/Music/_Common/Resolvers/YtdlYoutubeResolver.cs rename to src/Nadeko.Bot.Modules.Music/_Common/Resolvers/YtdlYoutubeResolver.cs diff --git a/src/NadekoBot/Modules/Permissions/Blacklist/BlacklistCommands.cs b/src/Nadeko.Bot.Modules.Permisssions/Blacklist/BlacklistCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/Blacklist/BlacklistCommands.cs rename to src/Nadeko.Bot.Modules.Permisssions/Blacklist/BlacklistCommands.cs diff --git a/src/NadekoBot/Modules/Permissions/Blacklist/BlacklistService.cs b/src/Nadeko.Bot.Modules.Permisssions/Blacklist/BlacklistService.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/Blacklist/BlacklistService.cs rename to src/Nadeko.Bot.Modules.Permisssions/Blacklist/BlacklistService.cs diff --git a/src/NadekoBot/Modules/Permissions/CommandCooldown/CleverbotResponseCmdCdTypeReader.cs b/src/Nadeko.Bot.Modules.Permisssions/CommandCooldown/CleverbotResponseCmdCdTypeReader.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/CommandCooldown/CleverbotResponseCmdCdTypeReader.cs rename to src/Nadeko.Bot.Modules.Permisssions/CommandCooldown/CleverbotResponseCmdCdTypeReader.cs diff --git a/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdService.cs b/src/Nadeko.Bot.Modules.Permisssions/CommandCooldown/CmdCdService.cs similarity index 99% rename from src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdService.cs rename to src/Nadeko.Bot.Modules.Permisssions/CommandCooldown/CmdCdService.cs index f85306bff..1f351f104 100644 --- a/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdService.cs +++ b/src/Nadeko.Bot.Modules.Permisssions/CommandCooldown/CmdCdService.cs @@ -14,7 +14,7 @@ public sealed class CmdCdService : IExecPreCommand, IReadyExecutor, INService public int Priority => 0; - public CmdCdService(Bot bot, DbService db) + public CmdCdService(IBot bot, DbService db) { _db = db; _settings = bot diff --git a/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdsCommands.cs b/src/Nadeko.Bot.Modules.Permisssions/CommandCooldown/CmdCdsCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdsCommands.cs rename to src/Nadeko.Bot.Modules.Permisssions/CommandCooldown/CmdCdsCommands.cs diff --git a/src/NadekoBot/Modules/Permissions/Filter/FilterCommands.cs b/src/Nadeko.Bot.Modules.Permisssions/Filter/FilterCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/Filter/FilterCommands.cs rename to src/Nadeko.Bot.Modules.Permisssions/Filter/FilterCommands.cs diff --git a/src/NadekoBot/Modules/Permissions/Filter/FilterService.cs b/src/Nadeko.Bot.Modules.Permisssions/Filter/FilterService.cs similarity index 99% rename from src/NadekoBot/Modules/Permissions/Filter/FilterService.cs rename to src/Nadeko.Bot.Modules.Permisssions/Filter/FilterService.cs index a17fd32fc..c625c3c58 100644 --- a/src/NadekoBot/Modules/Permissions/Filter/FilterService.cs +++ b/src/Nadeko.Bot.Modules.Permisssions/Filter/FilterService.cs @@ -1,5 +1,4 @@ #nullable disable -using AngleSharp.Dom; using Microsoft.EntityFrameworkCore; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Db; diff --git a/src/NadekoBot/Modules/Permissions/Filter/ServerFilterSettings.cs b/src/Nadeko.Bot.Modules.Permisssions/Filter/ServerFilterSettings.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/Filter/ServerFilterSettings.cs rename to src/Nadeko.Bot.Modules.Permisssions/Filter/ServerFilterSettings.cs diff --git a/src/NadekoBot/Modules/Permissions/GlobalPermissions/GlobalPermissionCommands.cs b/src/Nadeko.Bot.Modules.Permisssions/GlobalPermissions/GlobalPermissionCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/GlobalPermissions/GlobalPermissionCommands.cs rename to src/Nadeko.Bot.Modules.Permisssions/GlobalPermissions/GlobalPermissionCommands.cs diff --git a/src/NadekoBot/Modules/Permissions/GlobalPermissions/GlobalPermissionService.cs b/src/Nadeko.Bot.Modules.Permisssions/GlobalPermissions/GlobalPermissionService.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/GlobalPermissions/GlobalPermissionService.cs rename to src/Nadeko.Bot.Modules.Permisssions/GlobalPermissions/GlobalPermissionService.cs diff --git a/src/Nadeko.Bot.Modules.Permisssions/GlobalUsings.cs b/src/Nadeko.Bot.Modules.Permisssions/GlobalUsings.cs new file mode 100644 index 000000000..f754e6165 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Permisssions/GlobalUsings.cs @@ -0,0 +1,32 @@ +// // global using System.Collections.Concurrent; +global using NonBlocking; +// +// // packages +global using Serilog; +global using Humanizer; +global using Newtonsoft; +// +// // nadekobot +// global using NadekoBot; +global using NadekoBot.Services; +global using Nadeko.Common; // new project +global using NadekoBot.Common; // old + nadekobot specific things +global using NadekoBot.Common.Attributes; +global using NadekoBot.Extensions; +// global using Nadeko.Snake; + +// discord +global using Discord; +global using Discord.Commands; +global using Discord.Net; +global using Discord.WebSocket; + +// aliases +global using GuildPerm = Discord.GuildPermission; +global using ChannelPerm = Discord.ChannelPermission; +global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute; +global using LeftoverAttribute = Discord.Commands.RemainderAttribute; +global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; + +// non-essential +// global using JetBrains.Annotations; \ No newline at end of file diff --git a/src/Nadeko.Bot.Modules.Permisssions/Nadeko.Bot.Modules.Permisssions.csproj b/src/Nadeko.Bot.Modules.Permisssions/Nadeko.Bot.Modules.Permisssions.csproj new file mode 100644 index 000000000..3a88c91f3 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Permisssions/Nadeko.Bot.Modules.Permisssions.csproj @@ -0,0 +1,18 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + diff --git a/src/NadekoBot/Modules/Permissions/PermissionCache.cs b/src/Nadeko.Bot.Modules.Permisssions/PermissionCache.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/PermissionCache.cs rename to src/Nadeko.Bot.Modules.Permisssions/PermissionCache.cs diff --git a/src/NadekoBot/Modules/Permissions/PermissionExtensions.cs b/src/Nadeko.Bot.Modules.Permisssions/PermissionExtensions.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/PermissionExtensions.cs rename to src/Nadeko.Bot.Modules.Permisssions/PermissionExtensions.cs diff --git a/src/NadekoBot/Modules/Permissions/Permissions.cs b/src/Nadeko.Bot.Modules.Permisssions/Permissions.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/Permissions.cs rename to src/Nadeko.Bot.Modules.Permisssions/Permissions.cs diff --git a/src/NadekoBot/Modules/Permissions/PermissionsCollection.cs b/src/Nadeko.Bot.Modules.Permisssions/PermissionsCollection.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/PermissionsCollection.cs rename to src/Nadeko.Bot.Modules.Permisssions/PermissionsCollection.cs diff --git a/src/NadekoBot/Modules/Permissions/PermissionsService.cs b/src/Nadeko.Bot.Modules.Permisssions/PermissionsService.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/PermissionsService.cs rename to src/Nadeko.Bot.Modules.Permisssions/PermissionsService.cs diff --git a/src/NadekoBot/Modules/Permissions/ResetPermissionsCommands.cs b/src/Nadeko.Bot.Modules.Permisssions/ResetPermissionsCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Permissions/ResetPermissionsCommands.cs rename to src/Nadeko.Bot.Modules.Permisssions/ResetPermissionsCommands.cs diff --git a/src/NadekoBot/Modules/Searches/Anime/AnimeResult.cs b/src/Nadeko.Bot.Modules.Searches/Anime/AnimeResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Anime/AnimeResult.cs rename to src/Nadeko.Bot.Modules.Searches/Anime/AnimeResult.cs diff --git a/src/NadekoBot/Modules/Searches/Anime/AnimeSearchCommands.cs b/src/Nadeko.Bot.Modules.Searches/Anime/AnimeSearchCommands.cs similarity index 99% rename from src/NadekoBot/Modules/Searches/Anime/AnimeSearchCommands.cs rename to src/Nadeko.Bot.Modules.Searches/Anime/AnimeSearchCommands.cs index f756a0739..7bb3489cd 100644 --- a/src/NadekoBot/Modules/Searches/Anime/AnimeSearchCommands.cs +++ b/src/Nadeko.Bot.Modules.Searches/Anime/AnimeSearchCommands.cs @@ -1,7 +1,6 @@ #nullable disable using AngleSharp; using AngleSharp.Html.Dom; -using Nadeko.Common; using NadekoBot.Modules.Searches.Services; namespace NadekoBot.Modules.Searches; diff --git a/src/NadekoBot/Modules/Searches/Anime/AnimeSearchService.cs b/src/Nadeko.Bot.Modules.Searches/Anime/AnimeSearchService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Anime/AnimeSearchService.cs rename to src/Nadeko.Bot.Modules.Searches/Anime/AnimeSearchService.cs diff --git a/src/NadekoBot/Modules/Searches/Anime/MangaResult.cs b/src/Nadeko.Bot.Modules.Searches/Anime/MangaResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Anime/MangaResult.cs rename to src/Nadeko.Bot.Modules.Searches/Anime/MangaResult.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/CryptoCommands.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/CryptoCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/CryptoCommands.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/CryptoCommands.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/CryptoService.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/CryptoService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/CryptoService.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/CryptoService.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/DefaultStockDataService.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/DefaultStockDataService.cs similarity index 95% rename from src/NadekoBot/Modules/Searches/Crypto/DefaultStockDataService.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/DefaultStockDataService.cs index 1203550ab..8e47e104c 100644 --- a/src/NadekoBot/Modules/Searches/Crypto/DefaultStockDataService.cs +++ b/src/Nadeko.Bot.Modules.Searches/Crypto/DefaultStockDataService.cs @@ -1,10 +1,8 @@ using CsvHelper; using CsvHelper.Configuration; -using Google.Protobuf.WellKnownTypes; using System.Globalization; using System.Net.Http.Json; using System.Text.Json; -using Nadeko.Common; namespace NadekoBot.Modules.Searches; @@ -84,13 +82,15 @@ public sealed class DefaultStockDataService : IStockDataService, INService PrepareHeaderForMatch = args => args.Header.Humanize(LetterCasing.Title) }; + // todo replace .ToTimestamp() and remove google protobuf dependency + // todo this needs testing public async Task> GetCandleDataAsync(string query) { using var http = _httpClientFactory.CreateClient(); await using var resStream = await http.GetStreamAsync( $"https://query1.finance.yahoo.com/v7/finance/download/{query}" - + $"?period1={DateTime.UtcNow.Subtract(30.Days()).ToTimestamp().Seconds}" - + $"&period2={DateTime.UtcNow.ToTimestamp().Seconds}" + + $"?period1={DateTime.UtcNow.Subtract(30.Days()).ToTimestamp()}" + + $"&period2={DateTime.UtcNow.ToTimestamp()}" + "&interval=1d"); using var textReader = new StreamReader(resStream); diff --git a/src/NadekoBot/Modules/Searches/Crypto/Drawing/CandleDrawingData.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/Drawing/CandleDrawingData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/Drawing/CandleDrawingData.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/Drawing/CandleDrawingData.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/Drawing/IStockChartDrawingService.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/Drawing/IStockChartDrawingService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/Drawing/IStockChartDrawingService.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/Drawing/IStockChartDrawingService.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/Drawing/ImagesharpStockChartDrawingService.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/Drawing/ImagesharpStockChartDrawingService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/Drawing/ImagesharpStockChartDrawingService.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/Drawing/ImagesharpStockChartDrawingService.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/IStockDataService.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/IStockDataService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/IStockDataService.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/IStockDataService.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/Polygon/FinnHubSearchResponse.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/FinnHubSearchResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/Polygon/FinnHubSearchResponse.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/FinnHubSearchResponse.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/Polygon/FinnHubSearchResult.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/FinnHubSearchResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/Polygon/FinnHubSearchResult.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/FinnHubSearchResult.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/Polygon/PolygonApiClient.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/PolygonApiClient.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/Polygon/PolygonApiClient.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/PolygonApiClient.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/Polygon/PolygonStockDataService.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/PolygonStockDataService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/Polygon/PolygonStockDataService.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/PolygonStockDataService.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/Polygon/PolygonTickerData.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/PolygonTickerData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/Polygon/PolygonTickerData.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/PolygonTickerData.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/Polygon/PolygonTickerResponse.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/PolygonTickerResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/Polygon/PolygonTickerResponse.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/Polygon/PolygonTickerResponse.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/_Common/CandleData.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/_Common/CandleData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/_Common/CandleData.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/_Common/CandleData.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/_Common/ImageData.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/_Common/ImageData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/_Common/ImageData.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/_Common/ImageData.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/_Common/QuoteResponse.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/_Common/QuoteResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/_Common/QuoteResponse.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/_Common/QuoteResponse.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/_Common/StockData.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/_Common/StockData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/_Common/StockData.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/_Common/StockData.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/_Common/SymbolData.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/_Common/SymbolData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/_Common/SymbolData.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/_Common/SymbolData.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/_Common/YahooFinanceCandleData.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/_Common/YahooFinanceCandleData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/_Common/YahooFinanceCandleData.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/_Common/YahooFinanceCandleData.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/_Common/YahooFinanceSearchResponse.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/_Common/YahooFinanceSearchResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/_Common/YahooFinanceSearchResponse.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/_Common/YahooFinanceSearchResponse.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/_Common/YahooFinanceSearchResponseItem.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/_Common/YahooFinanceSearchResponseItem.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/_Common/YahooFinanceSearchResponseItem.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/_Common/YahooFinanceSearchResponseItem.cs diff --git a/src/NadekoBot/Modules/Searches/Crypto/_Common/YahooQueryModel.cs b/src/Nadeko.Bot.Modules.Searches/Crypto/_Common/YahooQueryModel.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Crypto/_Common/YahooQueryModel.cs rename to src/Nadeko.Bot.Modules.Searches/Crypto/_Common/YahooQueryModel.cs diff --git a/src/NadekoBot/Modules/Searches/Feeds/FeedCommands.cs b/src/Nadeko.Bot.Modules.Searches/Feeds/FeedCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Feeds/FeedCommands.cs rename to src/Nadeko.Bot.Modules.Searches/Feeds/FeedCommands.cs diff --git a/src/NadekoBot/Modules/Searches/Feeds/FeedsService.cs b/src/Nadeko.Bot.Modules.Searches/Feeds/FeedsService.cs similarity index 99% rename from src/NadekoBot/Modules/Searches/Feeds/FeedsService.cs rename to src/Nadeko.Bot.Modules.Searches/Feeds/FeedsService.cs index 32da00482..774652f27 100644 --- a/src/NadekoBot/Modules/Searches/Feeds/FeedsService.cs +++ b/src/Nadeko.Bot.Modules.Searches/Feeds/FeedsService.cs @@ -21,7 +21,7 @@ public class FeedsService : INService private readonly Dictionary _errorCounters = new(); public FeedsService( - Bot bot, + IBot bot, DbService db, DiscordSocketClient client, IEmbedBuilderService eb) diff --git a/src/Nadeko.Bot.Modules.Searches/GlobalUsings.cs b/src/Nadeko.Bot.Modules.Searches/GlobalUsings.cs new file mode 100644 index 000000000..f754e6165 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Searches/GlobalUsings.cs @@ -0,0 +1,32 @@ +// // global using System.Collections.Concurrent; +global using NonBlocking; +// +// // packages +global using Serilog; +global using Humanizer; +global using Newtonsoft; +// +// // nadekobot +// global using NadekoBot; +global using NadekoBot.Services; +global using Nadeko.Common; // new project +global using NadekoBot.Common; // old + nadekobot specific things +global using NadekoBot.Common.Attributes; +global using NadekoBot.Extensions; +// global using Nadeko.Snake; + +// discord +global using Discord; +global using Discord.Commands; +global using Discord.Net; +global using Discord.WebSocket; + +// aliases +global using GuildPerm = Discord.GuildPermission; +global using ChannelPerm = Discord.ChannelPermission; +global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute; +global using LeftoverAttribute = Discord.Commands.RemainderAttribute; +global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; + +// non-essential +// global using JetBrains.Annotations; \ No newline at end of file diff --git a/src/NadekoBot/Modules/Searches/JokeCommands.cs b/src/Nadeko.Bot.Modules.Searches/JokeCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/JokeCommands.cs rename to src/Nadeko.Bot.Modules.Searches/JokeCommands.cs diff --git a/src/NadekoBot/Modules/Searches/MemegenCommands.cs b/src/Nadeko.Bot.Modules.Searches/MemegenCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/MemegenCommands.cs rename to src/Nadeko.Bot.Modules.Searches/MemegenCommands.cs diff --git a/src/Nadeko.Bot.Modules.Searches/Nadeko.Bot.Modules.Searches.csproj b/src/Nadeko.Bot.Modules.Searches/Nadeko.Bot.Modules.Searches.csproj new file mode 100644 index 000000000..99c3e8660 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Searches/Nadeko.Bot.Modules.Searches.csproj @@ -0,0 +1,31 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NadekoBot/Modules/Searches/OsuCommands.cs b/src/Nadeko.Bot.Modules.Searches/OsuCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/OsuCommands.cs rename to src/Nadeko.Bot.Modules.Searches/OsuCommands.cs diff --git a/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs b/src/Nadeko.Bot.Modules.Searches/PathOfExileCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/PathOfExileCommands.cs rename to src/Nadeko.Bot.Modules.Searches/PathOfExileCommands.cs diff --git a/src/NadekoBot/Modules/Searches/PlaceCommands.cs b/src/Nadeko.Bot.Modules.Searches/PlaceCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/PlaceCommands.cs rename to src/Nadeko.Bot.Modules.Searches/PlaceCommands.cs diff --git a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs b/src/Nadeko.Bot.Modules.Searches/PokemonSearchCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs rename to src/Nadeko.Bot.Modules.Searches/PokemonSearchCommands.cs diff --git a/src/NadekoBot/Modules/Searches/Search/DefaultSearchServiceFactory.cs b/src/Nadeko.Bot.Modules.Searches/Search/DefaultSearchServiceFactory.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/DefaultSearchServiceFactory.cs rename to src/Nadeko.Bot.Modules.Searches/Search/DefaultSearchServiceFactory.cs diff --git a/src/NadekoBot/Modules/Searches/Search/DuckDuckGoScrape/DuckDuckGoSeachService.cs b/src/Nadeko.Bot.Modules.Searches/Search/DuckDuckGoScrape/DuckDuckGoSeachService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/DuckDuckGoScrape/DuckDuckGoSeachService.cs rename to src/Nadeko.Bot.Modules.Searches/Search/DuckDuckGoScrape/DuckDuckGoSeachService.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Google/GoogleCustomSearchResult.cs b/src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleCustomSearchResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Google/GoogleCustomSearchResult.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleCustomSearchResult.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Google/GoogleImageData.cs b/src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleImageData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Google/GoogleImageData.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleImageData.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Google/GoogleImageResult.cs b/src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleImageResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Google/GoogleImageResult.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleImageResult.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Google/GoogleImageResultEntry.cs b/src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleImageResultEntry.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Google/GoogleImageResultEntry.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleImageResultEntry.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Google/GoogleSearchResultInformation.cs b/src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleSearchResultInformation.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Google/GoogleSearchResultInformation.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleSearchResultInformation.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Google/GoogleSearchService.cs b/src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleSearchService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Google/GoogleSearchService.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Google/GoogleSearchService.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Google/OfficialGoogleSearchResultEntry.cs b/src/Nadeko.Bot.Modules.Searches/Search/Google/OfficialGoogleSearchResultEntry.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Google/OfficialGoogleSearchResultEntry.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Google/OfficialGoogleSearchResultEntry.cs diff --git a/src/NadekoBot/Modules/Searches/Search/GoogleScrape/GoogleScrapeService.cs b/src/Nadeko.Bot.Modules.Searches/Search/GoogleScrape/GoogleScrapeService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/GoogleScrape/GoogleScrapeService.cs rename to src/Nadeko.Bot.Modules.Searches/Search/GoogleScrape/GoogleScrapeService.cs diff --git a/src/NadekoBot/Modules/Searches/Search/GoogleScrape/PlainGoogleScrapeSearchResult.cs b/src/Nadeko.Bot.Modules.Searches/Search/GoogleScrape/PlainGoogleScrapeSearchResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/GoogleScrape/PlainGoogleScrapeSearchResult.cs rename to src/Nadeko.Bot.Modules.Searches/Search/GoogleScrape/PlainGoogleScrapeSearchResult.cs diff --git a/src/NadekoBot/Modules/Searches/Search/GoogleScrape/PlainSearchResultEntry.cs b/src/Nadeko.Bot.Modules.Searches/Search/GoogleScrape/PlainSearchResultEntry.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/GoogleScrape/PlainSearchResultEntry.cs rename to src/Nadeko.Bot.Modules.Searches/Search/GoogleScrape/PlainSearchResultEntry.cs diff --git a/src/NadekoBot/Modules/Searches/Search/GoogleScrape/PlainSearchResultInfo.cs b/src/Nadeko.Bot.Modules.Searches/Search/GoogleScrape/PlainSearchResultInfo.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/GoogleScrape/PlainSearchResultInfo.cs rename to src/Nadeko.Bot.Modules.Searches/Search/GoogleScrape/PlainSearchResultInfo.cs diff --git a/src/NadekoBot/Modules/Searches/Search/IImageSearchResult.cs b/src/Nadeko.Bot.Modules.Searches/Search/IImageSearchResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/IImageSearchResult.cs rename to src/Nadeko.Bot.Modules.Searches/Search/IImageSearchResult.cs diff --git a/src/NadekoBot/Modules/Searches/Search/ISearchResult.cs b/src/Nadeko.Bot.Modules.Searches/Search/ISearchResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/ISearchResult.cs rename to src/Nadeko.Bot.Modules.Searches/Search/ISearchResult.cs diff --git a/src/NadekoBot/Modules/Searches/Search/ISearchResultEntry.cs b/src/Nadeko.Bot.Modules.Searches/Search/ISearchResultEntry.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/ISearchResultEntry.cs rename to src/Nadeko.Bot.Modules.Searches/Search/ISearchResultEntry.cs diff --git a/src/NadekoBot/Modules/Searches/Search/ISearchResultInformation.cs b/src/Nadeko.Bot.Modules.Searches/Search/ISearchResultInformation.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/ISearchResultInformation.cs rename to src/Nadeko.Bot.Modules.Searches/Search/ISearchResultInformation.cs diff --git a/src/NadekoBot/Modules/Searches/Search/ISearchService.cs b/src/Nadeko.Bot.Modules.Searches/Search/ISearchService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/ISearchService.cs rename to src/Nadeko.Bot.Modules.Searches/Search/ISearchService.cs diff --git a/src/NadekoBot/Modules/Searches/Search/ISearchServiceFactory.cs b/src/Nadeko.Bot.Modules.Searches/Search/ISearchServiceFactory.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/ISearchServiceFactory.cs rename to src/Nadeko.Bot.Modules.Searches/Search/ISearchServiceFactory.cs diff --git a/src/NadekoBot/Modules/Searches/Search/SearchCommands.cs b/src/Nadeko.Bot.Modules.Searches/Search/SearchCommands.cs similarity index 98% rename from src/NadekoBot/Modules/Searches/Search/SearchCommands.cs rename to src/Nadeko.Bot.Modules.Searches/Search/SearchCommands.cs index dbb5a7ca7..4dc568829 100644 --- a/src/NadekoBot/Modules/Searches/Search/SearchCommands.cs +++ b/src/Nadeko.Bot.Modules.Searches/Search/SearchCommands.cs @@ -1,8 +1,4 @@ using NadekoBot.Modules.Searches.Youtube; -using StackExchange.Redis; -using System.Net.Http.Json; -using System.Text.Json.Serialization; -using Nadeko.Common; namespace NadekoBot.Modules.Searches; diff --git a/src/NadekoBot/Modules/Searches/Search/SearchServiceBase.cs b/src/Nadeko.Bot.Modules.Searches/Search/SearchServiceBase.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/SearchServiceBase.cs rename to src/Nadeko.Bot.Modules.Searches/Search/SearchServiceBase.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Searx/SearxImageSearchResult.cs b/src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxImageSearchResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Searx/SearxImageSearchResult.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxImageSearchResult.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Searx/SearxImageSearchResultEntry.cs b/src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxImageSearchResultEntry.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Searx/SearxImageSearchResultEntry.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxImageSearchResultEntry.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Searx/SearxInfobox.cs b/src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxInfobox.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Searx/SearxInfobox.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxInfobox.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Searx/SearxSearchAttribute.cs b/src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxSearchAttribute.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Searx/SearxSearchAttribute.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxSearchAttribute.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Searx/SearxSearchResult.cs b/src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxSearchResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Searx/SearxSearchResult.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxSearchResult.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Searx/SearxSearchResultEntry.cs b/src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxSearchResultEntry.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Searx/SearxSearchResultEntry.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxSearchResultEntry.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Searx/SearxSearchResultInformation.cs b/src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxSearchResultInformation.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Searx/SearxSearchResultInformation.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxSearchResultInformation.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Searx/SearxSearchService.cs b/src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxSearchService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Searx/SearxSearchService.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxSearchService.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Searx/SearxUrlData.cs b/src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxUrlData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Searx/SearxUrlData.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Searx/SearxUrlData.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Youtube/IYoutubeSearchService.cs b/src/Nadeko.Bot.Modules.Searches/Search/Youtube/IYoutubeSearchService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Youtube/IYoutubeSearchService.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Youtube/IYoutubeSearchService.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Youtube/InvidiousSearchResponse.cs b/src/Nadeko.Bot.Modules.Searches/Search/Youtube/InvidiousSearchResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Youtube/InvidiousSearchResponse.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Youtube/InvidiousSearchResponse.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Youtube/InvidiousYtSearchService.cs b/src/Nadeko.Bot.Modules.Searches/Search/Youtube/InvidiousYtSearchService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Youtube/InvidiousYtSearchService.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Youtube/InvidiousYtSearchService.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Youtube/VideoInfo.cs b/src/Nadeko.Bot.Modules.Searches/Search/Youtube/VideoInfo.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Youtube/VideoInfo.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Youtube/VideoInfo.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Youtube/YoutubeDataApiSearchService.cs b/src/Nadeko.Bot.Modules.Searches/Search/Youtube/YoutubeDataApiSearchService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Youtube/YoutubeDataApiSearchService.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Youtube/YoutubeDataApiSearchService.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Youtube/YtdlYoutubeSearchService.cs b/src/Nadeko.Bot.Modules.Searches/Search/Youtube/YtdlYoutubeSearchService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Youtube/YtdlYoutubeSearchService.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Youtube/YtdlYoutubeSearchService.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Youtube/YtdlpYoutubeSearchService.cs b/src/Nadeko.Bot.Modules.Searches/Search/Youtube/YtdlpYoutubeSearchService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Youtube/YtdlpYoutubeSearchService.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Youtube/YtdlpYoutubeSearchService.cs diff --git a/src/NadekoBot/Modules/Searches/Search/Youtube/YtdlxServiceBase.cs b/src/Nadeko.Bot.Modules.Searches/Search/Youtube/YtdlxServiceBase.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Search/Youtube/YtdlxServiceBase.cs rename to src/Nadeko.Bot.Modules.Searches/Search/Youtube/YtdlxServiceBase.cs diff --git a/src/NadekoBot/Modules/Searches/Searches.cs b/src/Nadeko.Bot.Modules.Searches/Searches.cs similarity index 82% rename from src/NadekoBot/Modules/Searches/Searches.cs rename to src/Nadeko.Bot.Modules.Searches/Searches.cs index c928c308a..44c5aa0c0 100644 --- a/src/NadekoBot/Modules/Searches/Searches.cs +++ b/src/Nadeko.Bot.Modules.Searches/Searches.cs @@ -1,6 +1,5 @@ #nullable disable using Microsoft.Extensions.Caching.Memory; -using NadekoBot.Modules.Administration.Services; using NadekoBot.Modules.Searches.Common; using NadekoBot.Modules.Searches.Services; using Newtonsoft.Json; @@ -11,7 +10,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using System.Diagnostics.CodeAnalysis; using System.Net; -using Nadeko.Common; using Color = SixLabors.ImageSharp.Color; namespace NadekoBot.Modules.Searches; @@ -23,14 +21,14 @@ public partial class Searches : NadekoModule private readonly IGoogleApiService _google; private readonly IHttpClientFactory _httpFactory; private readonly IMemoryCache _cache; - private readonly GuildTimezoneService _tzSvc; + private readonly ITimezoneService _tzSvc; public Searches( IBotCredentials creds, IGoogleApiService google, IHttpClientFactory factory, IMemoryCache cache, - GuildTimezoneService tzSvc) + ITimezoneService tzSvc) { _creds = creds; _google = google; @@ -64,7 +62,7 @@ public partial class Searches : NadekoModule { var f = StandardConversions.CelsiusToFahrenheit; - var tz = ctx.Guild is null ? TimeZoneInfo.Utc : _tzSvc.GetTimeZoneOrUtc(ctx.Guild.Id); + var tz = _tzSvc.GetTimeZoneOrUtc(ctx.Guild?.Id); var sunrise = data.Sys.Sunrise.ToUnixTimestamp(); var sunset = data.Sys.Sunset.ToUnixTimestamp(); sunrise = sunrise.ToOffset(tz.GetUtcOffset(sunrise)); @@ -136,11 +134,11 @@ public partial class Searches : NadekoModule } var eb = _eb.Create() - .WithOkColor() - .WithTitle(GetText(strs.time_new)) - .WithDescription(Format.Code(data.Time.ToString(Culture))) - .AddField(GetText(strs.location), string.Join('\n', data.Address.Split(", ")), true) - .AddField(GetText(strs.timezone), data.TimeZoneName, true); + .WithOkColor() + .WithTitle(GetText(strs.time_new)) + .WithDescription(Format.Code(data.Time.ToString(Culture))) + .AddField(GetText(strs.location), string.Join('\n', data.Address.Split(", ")), true) + .AddField(GetText(strs.timezone), data.TimeZoneName, true); await ctx.Channel.SendMessageAsync(embed: eb.Build()); } @@ -161,14 +159,14 @@ public partial class Searches : NadekoModule } await ctx.Channel.EmbedAsync(_eb.Create() - .WithOkColor() - .WithTitle(movie.Title) - .WithUrl($"https://www.imdb.com/title/{movie.ImdbId}/") - .WithDescription(movie.Plot.TrimTo(1000)) - .AddField("Rating", movie.ImdbRating, true) - .AddField("Genre", movie.Genre, true) - .AddField("Year", movie.Year, true) - .WithImageUrl(movie.Poster)); + .WithOkColor() + .WithTitle(movie.Title) + .WithUrl($"https://www.imdb.com/title/{movie.ImdbId}/") + .WithDescription(movie.Plot.TrimTo(1000)) + .AddField("Rating", movie.ImdbRating, true) + .AddField("Genre", movie.Genre, true) + .AddField("Year", movie.Year, true) + .WithImageUrl(movie.Poster)); } [Cmd] @@ -241,9 +239,9 @@ public partial class Searches : NadekoModule } await ctx.Channel.EmbedAsync(_eb.Create() - .WithOkColor() - .AddField(GetText(strs.original_url), $"<{query}>") - .AddField(GetText(strs.short_url), $"<{shortLink}>")); + .WithOkColor() + .AddField(GetText(strs.original_url), $"<{query}>") + .AddField(GetText(strs.short_url), $"<{shortLink}>")); } [Cmd] @@ -262,13 +260,13 @@ public partial class Searches : NadekoModule } var embed = _eb.Create() - .WithOkColor() - .WithTitle(card.Name) - .WithDescription(card.Description) - .WithImageUrl(card.ImageUrl) - .AddField(GetText(strs.store_url), card.StoreUrl, true) - .AddField(GetText(strs.cost), card.ManaCost, true) - .AddField(GetText(strs.types), card.Types, true); + .WithOkColor() + .WithTitle(card.Name) + .WithDescription(card.Description) + .WithImageUrl(card.ImageUrl) + .AddField(GetText(strs.store_url), card.StoreUrl, true) + .AddField(GetText(strs.cost), card.ManaCost, true) + .AddField(GetText(strs.types), card.Types, true); await ctx.Channel.EmbedAsync(embed); } @@ -323,10 +321,10 @@ public partial class Searches : NadekoModule { var item = items[p]; return _eb.Create() - .WithOkColor() - .WithUrl(item.Permalink) - .WithTitle(item.Word) - .WithDescription(item.Definition); + .WithOkColor() + .WithUrl(item.Permalink) + .WithTitle(item.Word) + .WithDescription(item.Definition); }, items.Length, 1); @@ -362,11 +360,11 @@ public partial class Searches : NadekoModule var data = JsonConvert.DeserializeObject(res); var datas = data.Results - .Where(x => x.Senses is not null - && x.Senses.Count > 0 - && x.Senses[0].Definition is not null) - .Select(x => (Sense: x.Senses[0], x.PartOfSpeech)) - .ToList(); + .Where(x => x.Senses is not null + && x.Senses.Count > 0 + && x.Senses[0].Definition is not null) + .Select(x => (Sense: x.Senses[0], x.PartOfSpeech)) + .ToList(); if (!datas.Any()) { @@ -376,14 +374,14 @@ public partial class Searches : NadekoModule var col = datas.Select(x => ( - Definition: x.Sense.Definition is string - ? x.Sense.Definition.ToString() - : ((JArray)JToken.Parse(x.Sense.Definition.ToString())).First.ToString(), - Example: x.Sense.Examples is null || x.Sense.Examples.Count == 0 - ? string.Empty - : x.Sense.Examples[0].Text, Word: word, - WordType: string.IsNullOrWhiteSpace(x.PartOfSpeech) ? "-" : x.PartOfSpeech)) - .ToList(); + Definition: x.Sense.Definition is string + ? x.Sense.Definition.ToString() + : ((JArray)JToken.Parse(x.Sense.Definition.ToString())).First.ToString(), + Example: x.Sense.Examples is null || x.Sense.Examples.Count == 0 + ? string.Empty + : x.Sense.Examples[0].Text, Word: word, + WordType: string.IsNullOrWhiteSpace(x.PartOfSpeech) ? "-" : x.PartOfSpeech)) + .ToList(); Log.Information("Sending {Count} definition for: {Word}", col.Count, word); @@ -392,11 +390,11 @@ public partial class Searches : NadekoModule { var model = col.Skip(page).First(); var embed = _eb.Create() - .WithDescription(ctx.User.Mention) - .AddField(GetText(strs.word), model.Word, true) - .AddField(GetText(strs._class), model.WordType, true) - .AddField(GetText(strs.definition), model.Definition) - .WithOkColor(); + .WithDescription(ctx.User.Mention) + .AddField(GetText(strs.word), model.Word, true) + .AddField(GetText(strs._class), model.WordType, true) + .AddField(GetText(strs.definition), model.Definition) + .WithOkColor(); if (!string.IsNullOrWhiteSpace(model.Example)) embed.AddField(GetText(strs.example), model.Example); @@ -495,10 +493,10 @@ public partial class Searches : NadekoModule await ctx.Channel.EmbedAsync( _eb.Create() - .WithOkColor() - .AddField("Username", usr.ToString()) - .AddField("Avatar Url", avatarUrl) - .WithThumbnailUrl(avatarUrl.ToString()), + .WithOkColor() + .AddField("Username", usr.ToString()) + .AddField("Avatar Url", avatarUrl) + .WithThumbnailUrl(avatarUrl.ToString()), ctx.User.Mention); } @@ -564,9 +562,9 @@ public partial class Searches : NadekoModule { var v = obj.Verses[0]; await ctx.Channel.EmbedAsync(_eb.Create() - .WithOkColor() - .WithTitle($"{v.BookName} {v.Chapter}:{v.Verse}") - .WithDescription(v.Text)); + .WithOkColor() + .WithTitle($"{v.BookName} {v.Chapter}:{v.Verse}") + .WithDescription(v.Text)); } } @@ -609,7 +607,6 @@ public partial class Searches : NadekoModule public class ShortenData { - [JsonProperty("result_url")] - public string ResultUrl { get; set; } + [JsonProperty("result_url")] public string ResultUrl { get; set; } } -} +} \ No newline at end of file diff --git a/src/NadekoBot/Modules/Searches/SearchesService.cs b/src/Nadeko.Bot.Modules.Searches/SearchesService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/SearchesService.cs rename to src/Nadeko.Bot.Modules.Searches/SearchesService.cs diff --git a/src/NadekoBot/Modules/Searches/StreamNotification/StreamNotificationCommands.cs b/src/Nadeko.Bot.Modules.Searches/StreamNotification/StreamNotificationCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/StreamNotification/StreamNotificationCommands.cs rename to src/Nadeko.Bot.Modules.Searches/StreamNotification/StreamNotificationCommands.cs diff --git a/src/NadekoBot/Modules/Searches/StreamNotification/StreamNotificationService.cs b/src/Nadeko.Bot.Modules.Searches/StreamNotification/StreamNotificationService.cs similarity index 99% rename from src/NadekoBot/Modules/Searches/StreamNotification/StreamNotificationService.cs rename to src/Nadeko.Bot.Modules.Searches/StreamNotification/StreamNotificationService.cs index 8385c0db7..a755d3235 100644 --- a/src/NadekoBot/Modules/Searches/StreamNotification/StreamNotificationService.cs +++ b/src/Nadeko.Bot.Modules.Searches/StreamNotification/StreamNotificationService.cs @@ -1,10 +1,8 @@ #nullable disable using Microsoft.EntityFrameworkCore; -using Nadeko.Common; using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Db; using NadekoBot.Db.Models; -using NadekoBot.Modules.Searches._Common; using NadekoBot.Modules.Searches.Common; using NadekoBot.Modules.Searches.Common.StreamNotifications; using NadekoBot.Services.Database.Models; @@ -48,7 +46,7 @@ public sealed class StreamNotificationService : INService, IReadyExecutor IBotStrings strings, IBotCredsProvider creds, IHttpClientFactory httpFactory, - Bot bot, + IBot bot, IPubSub pubSub, IEmbedBuilderService eb) { diff --git a/src/NadekoBot/Modules/Searches/StreamNotification/StreamOnlineMessageDeleterService.cs b/src/Nadeko.Bot.Modules.Searches/StreamNotification/StreamOnlineMessageDeleterService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/StreamNotification/StreamOnlineMessageDeleterService.cs rename to src/Nadeko.Bot.Modules.Searches/StreamNotification/StreamOnlineMessageDeleterService.cs diff --git a/src/NadekoBot/Modules/Searches/Translate/ITranslateService.cs b/src/Nadeko.Bot.Modules.Searches/Translate/ITranslateService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Translate/ITranslateService.cs rename to src/Nadeko.Bot.Modules.Searches/Translate/ITranslateService.cs diff --git a/src/NadekoBot/Modules/Searches/Translate/TranslateService.cs b/src/Nadeko.Bot.Modules.Searches/Translate/TranslateService.cs similarity index 99% rename from src/NadekoBot/Modules/Searches/Translate/TranslateService.cs rename to src/Nadeko.Bot.Modules.Searches/Translate/TranslateService.cs index 9f0e91a53..8fb6f60e4 100644 --- a/src/NadekoBot/Modules/Searches/Translate/TranslateService.cs +++ b/src/Nadeko.Bot.Modules.Searches/Translate/TranslateService.cs @@ -13,7 +13,7 @@ public sealed class TranslateService : ITranslateService, IExecNoCommand, IReady private readonly IGoogleApiService _google; private readonly DbService _db; private readonly IEmbedBuilderService _eb; - private readonly Bot _bot; + private readonly IBot _bot; private readonly ConcurrentDictionary _atcs = new(); private readonly ConcurrentDictionary> _users = new(); @@ -22,7 +22,7 @@ public sealed class TranslateService : ITranslateService, IExecNoCommand, IReady IGoogleApiService google, DbService db, IEmbedBuilderService eb, - Bot bot) + IBot bot) { _google = google; _db = db; diff --git a/src/NadekoBot/Modules/Searches/Translate/TranslatorCommands.cs b/src/Nadeko.Bot.Modules.Searches/Translate/TranslatorCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/Translate/TranslatorCommands.cs rename to src/Nadeko.Bot.Modules.Searches/Translate/TranslatorCommands.cs diff --git a/src/NadekoBot/Modules/Searches/XkcdCommands.cs b/src/Nadeko.Bot.Modules.Searches/XkcdCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/XkcdCommands.cs rename to src/Nadeko.Bot.Modules.Searches/XkcdCommands.cs diff --git a/src/NadekoBot/Modules/Searches/YoutubeTrack/YtTrackService.cs b/src/Nadeko.Bot.Modules.Searches/YoutubeTrack/YtTrackService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/YoutubeTrack/YtTrackService.cs rename to src/Nadeko.Bot.Modules.Searches/YoutubeTrack/YtTrackService.cs diff --git a/src/NadekoBot/Modules/Searches/YoutubeTrack/YtUploadCommands.cs b/src/Nadeko.Bot.Modules.Searches/YoutubeTrack/YtUploadCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/YoutubeTrack/YtUploadCommands.cs rename to src/Nadeko.Bot.Modules.Searches/YoutubeTrack/YtUploadCommands.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/AtlExtensions.cs b/src/Nadeko.Bot.Modules.Searches/_Common/AtlExtensions.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/AtlExtensions.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/AtlExtensions.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/BibleVerses.cs b/src/Nadeko.Bot.Modules.Searches/_Common/BibleVerses.cs similarity index 90% rename from src/NadekoBot/Modules/Searches/_Common/BibleVerses.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/BibleVerses.cs index d11a9b5f3..3892658b5 100644 --- a/src/NadekoBot/Modules/Searches/_Common/BibleVerses.cs +++ b/src/Nadeko.Bot.Modules.Searches/_Common/BibleVerses.cs @@ -3,6 +3,7 @@ using Newtonsoft.Json; namespace NadekoBot.Modules.Searches.Common; +// todo replace newtonsoft with json.text public class BibleVerses { public string Error { get; set; } diff --git a/src/NadekoBot/Modules/Searches/_Common/Config/ImgSearchEngine.cs b/src/Nadeko.Bot.Modules.Searches/_Common/Config/ImgSearchEngine.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/Config/ImgSearchEngine.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/Config/ImgSearchEngine.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/Config/SearchesConfig.cs b/src/Nadeko.Bot.Modules.Searches/_Common/Config/SearchesConfig.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/Config/SearchesConfig.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/Config/SearchesConfig.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/Config/SearchesConfigService.cs b/src/Nadeko.Bot.Modules.Searches/_Common/Config/SearchesConfigService.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/Config/SearchesConfigService.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/Config/SearchesConfigService.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/Config/WebSearchEngine.cs b/src/Nadeko.Bot.Modules.Searches/_Common/Config/WebSearchEngine.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/Config/WebSearchEngine.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/Config/WebSearchEngine.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/CryptoData.cs b/src/Nadeko.Bot.Modules.Searches/_Common/CryptoData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/CryptoData.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/CryptoData.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/DefineModel.cs b/src/Nadeko.Bot.Modules.Searches/_Common/DefineModel.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/DefineModel.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/DefineModel.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/E621Object.cs b/src/Nadeko.Bot.Modules.Searches/_Common/E621Object.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/E621Object.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/E621Object.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/Exceptions/StreamNotFoundException.cs b/src/Nadeko.Bot.Modules.Searches/_Common/Exceptions/StreamNotFoundException.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/Exceptions/StreamNotFoundException.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/Exceptions/StreamNotFoundException.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/Extensions.cs b/src/Nadeko.Bot.Modules.Searches/_Common/Extensions.cs similarity index 82% rename from src/NadekoBot/Modules/Searches/_Common/Extensions.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/Extensions.cs index 718f09742..e78f2a490 100644 --- a/src/NadekoBot/Modules/Searches/_Common/Extensions.cs +++ b/src/Nadeko.Bot.Modules.Searches/_Common/Extensions.cs @@ -1,7 +1,7 @@ using NadekoBot.Db.Models; using NadekoBot.Modules.Searches.Common; -namespace NadekoBot.Modules.Searches._Common; +namespace NadekoBot.Modules.Searches.Common; public static class Extensions { diff --git a/src/NadekoBot/Modules/Searches/_Common/Gallery.cs b/src/Nadeko.Bot.Modules.Searches/_Common/Gallery.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/Gallery.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/Gallery.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/GatariUserResponse.cs b/src/Nadeko.Bot.Modules.Searches/_Common/GatariUserResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/GatariUserResponse.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/GatariUserResponse.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/GatariUserStatsResponse.cs b/src/Nadeko.Bot.Modules.Searches/_Common/GatariUserStatsResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/GatariUserStatsResponse.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/GatariUserStatsResponse.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/GoogleSearchResult.cs b/src/Nadeko.Bot.Modules.Searches/_Common/GoogleSearchResult.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/GoogleSearchResult.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/GoogleSearchResult.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/HearthstoneCardData.cs b/src/Nadeko.Bot.Modules.Searches/_Common/HearthstoneCardData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/HearthstoneCardData.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/HearthstoneCardData.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/LowerCaseNamingPolicy.cs b/src/Nadeko.Bot.Modules.Searches/_Common/LowerCaseNamingPolicy.cs similarity index 84% rename from src/NadekoBot/Modules/Searches/_Common/LowerCaseNamingPolicy.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/LowerCaseNamingPolicy.cs index 0d31cfcc8..6bf7b4b74 100644 --- a/src/NadekoBot/Modules/Searches/_Common/LowerCaseNamingPolicy.cs +++ b/src/Nadeko.Bot.Modules.Searches/_Common/LowerCaseNamingPolicy.cs @@ -1,7 +1,7 @@ #nullable disable using System.Text.Json; -namespace SystemTextJsonSamples; +namespace NadekoBot.Modules.Searches.Common; public class LowerCaseNamingPolicy : JsonNamingPolicy { diff --git a/src/NadekoBot/Modules/Searches/_Common/MagicItem.cs b/src/Nadeko.Bot.Modules.Searches/_Common/MagicItem.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/MagicItem.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/MagicItem.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/MtgData.cs b/src/Nadeko.Bot.Modules.Searches/_Common/MtgData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/MtgData.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/MtgData.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/NovelData.cs b/src/Nadeko.Bot.Modules.Searches/_Common/NovelData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/NovelData.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/NovelData.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/OmdbMovie.cs b/src/Nadeko.Bot.Modules.Searches/_Common/OmdbMovie.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/OmdbMovie.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/OmdbMovie.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/OsuUserData.cs b/src/Nadeko.Bot.Modules.Searches/_Common/OsuUserData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/OsuUserData.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/OsuUserData.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/PathOfExileModels.cs b/src/Nadeko.Bot.Modules.Searches/_Common/PathOfExileModels.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/PathOfExileModels.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/PathOfExileModels.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/SteamGameId.cs b/src/Nadeko.Bot.Modules.Searches/_Common/SteamGameId.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/SteamGameId.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/SteamGameId.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/HelixStreamsResponse.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/HelixStreamsResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/HelixStreamsResponse.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/HelixStreamsResponse.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/HelixUsersResponse.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/HelixUsersResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/HelixUsersResponse.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/HelixUsersResponse.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/PicartoChannelResponse.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/PicartoChannelResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/PicartoChannelResponse.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/PicartoChannelResponse.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/StreamData.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/StreamData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/StreamData.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/StreamData.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/StreamDataKey.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/StreamDataKey.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/StreamDataKey.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/StreamDataKey.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/TrovoGetUsersResponse.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/TrovoGetUsersResponse.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/TrovoGetUsersResponse.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/TrovoGetUsersResponse.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/TrovoRequestData.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/TrovoRequestData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/TrovoRequestData.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/TrovoRequestData.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/TrovoSocialLink.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/TrovoSocialLink.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/TrovoSocialLink.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/TrovoSocialLink.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/TwitchResponseV5.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/TwitchResponseV5.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/TwitchResponseV5.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/TwitchResponseV5.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/TwitchUsersResponseV5.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/TwitchUsersResponseV5.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Models/TwitchUsersResponseV5.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Models/TwitchUsersResponseV5.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/NotifChecker.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/NotifChecker.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/NotifChecker.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/NotifChecker.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/PicartoProvider.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/PicartoProvider.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/PicartoProvider.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/PicartoProvider.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/Provider.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/Provider.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/Provider.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/Provider.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/TrovoProvider.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/TrovoProvider.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/TrovoProvider.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/TrovoProvider.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/TwitchHelixProvider.cs b/src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/TwitchHelixProvider.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/TwitchHelixProvider.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/StreamNotifications/Providers/TwitchHelixProvider.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/TimeData.cs b/src/Nadeko.Bot.Modules.Searches/_Common/TimeData.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/TimeData.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/TimeData.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/TimeModels.cs b/src/Nadeko.Bot.Modules.Searches/_Common/TimeModels.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/TimeModels.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/TimeModels.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/UrbanDef.cs b/src/Nadeko.Bot.Modules.Searches/_Common/UrbanDef.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/UrbanDef.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/UrbanDef.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/WeatherModels.cs b/src/Nadeko.Bot.Modules.Searches/_Common/WeatherModels.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/WeatherModels.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/WeatherModels.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/WikipediaApiModel.cs b/src/Nadeko.Bot.Modules.Searches/_Common/WikipediaApiModel.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/WikipediaApiModel.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/WikipediaApiModel.cs diff --git a/src/NadekoBot/Modules/Searches/_Common/WoWJoke.cs b/src/Nadeko.Bot.Modules.Searches/_Common/WoWJoke.cs similarity index 100% rename from src/NadekoBot/Modules/Searches/_Common/WoWJoke.cs rename to src/Nadeko.Bot.Modules.Searches/_Common/WoWJoke.cs diff --git a/src/NadekoBot/Modules/Utility/Alias/AliasCommands.cs b/src/Nadeko.Bot.Modules.Utility/Alias/AliasCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Alias/AliasCommands.cs rename to src/Nadeko.Bot.Modules.Utility/Alias/AliasCommands.cs diff --git a/src/NadekoBot/Modules/Utility/Alias/AliasService.cs b/src/Nadeko.Bot.Modules.Utility/Alias/AliasService.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Alias/AliasService.cs rename to src/Nadeko.Bot.Modules.Utility/Alias/AliasService.cs diff --git a/src/NadekoBot/Modules/Utility/Calc/CalcCommands.cs b/src/Nadeko.Bot.Modules.Utility/Calc/CalcCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Calc/CalcCommands.cs rename to src/Nadeko.Bot.Modules.Utility/Calc/CalcCommands.cs diff --git a/src/NadekoBot/Modules/Utility/ConfigCommands.cs b/src/Nadeko.Bot.Modules.Utility/ConfigCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/ConfigCommands.cs rename to src/Nadeko.Bot.Modules.Utility/ConfigCommands.cs diff --git a/src/Nadeko.Bot.Modules.Utility/GlobalUsings.cs b/src/Nadeko.Bot.Modules.Utility/GlobalUsings.cs new file mode 100644 index 000000000..f754e6165 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Utility/GlobalUsings.cs @@ -0,0 +1,32 @@ +// // global using System.Collections.Concurrent; +global using NonBlocking; +// +// // packages +global using Serilog; +global using Humanizer; +global using Newtonsoft; +// +// // nadekobot +// global using NadekoBot; +global using NadekoBot.Services; +global using Nadeko.Common; // new project +global using NadekoBot.Common; // old + nadekobot specific things +global using NadekoBot.Common.Attributes; +global using NadekoBot.Extensions; +// global using Nadeko.Snake; + +// discord +global using Discord; +global using Discord.Commands; +global using Discord.Net; +global using Discord.WebSocket; + +// aliases +global using GuildPerm = Discord.GuildPermission; +global using ChannelPerm = Discord.ChannelPermission; +global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute; +global using LeftoverAttribute = Discord.Commands.RemainderAttribute; +global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; + +// non-essential +// global using JetBrains.Annotations; \ No newline at end of file diff --git a/src/NadekoBot/Modules/Utility/Info/InfoCommands.cs b/src/Nadeko.Bot.Modules.Utility/Info/InfoCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Info/InfoCommands.cs rename to src/Nadeko.Bot.Modules.Utility/Info/InfoCommands.cs diff --git a/src/NadekoBot/Modules/Utility/Info/InviteCommands.cs b/src/Nadeko.Bot.Modules.Utility/Info/InviteCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Info/InviteCommands.cs rename to src/Nadeko.Bot.Modules.Utility/Info/InviteCommands.cs diff --git a/src/NadekoBot/Modules/Utility/Invite/InviteService.cs b/src/Nadeko.Bot.Modules.Utility/Invite/InviteService.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Invite/InviteService.cs rename to src/Nadeko.Bot.Modules.Utility/Invite/InviteService.cs diff --git a/src/Nadeko.Bot.Modules.Utility/Nadeko.Bot.Modules.Utility.csproj b/src/Nadeko.Bot.Modules.Utility/Nadeko.Bot.Modules.Utility.csproj new file mode 100644 index 000000000..6a30e8002 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Utility/Nadeko.Bot.Modules.Utility.csproj @@ -0,0 +1,25 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + + + + + + + diff --git a/src/NadekoBot/Modules/Utility/Patronage/Config/PatronageConfig.cs b/src/Nadeko.Bot.Modules.Utility/Patronage/Config/PatronageConfig.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/Config/PatronageConfig.cs rename to src/Nadeko.Bot.Modules.Utility/Patronage/Config/PatronageConfig.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/CurrencyRewardService.cs b/src/Nadeko.Bot.Modules.Utility/Patronage/CurrencyRewardService.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/CurrencyRewardService.cs rename to src/Nadeko.Bot.Modules.Utility/Patronage/CurrencyRewardService.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/InsufficientTier.cs b/src/Nadeko.Bot.Modules.Utility/Patronage/InsufficientTier.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/InsufficientTier.cs rename to src/Nadeko.Bot.Modules.Utility/Patronage/InsufficientTier.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/Patreon/PatreonClient.cs b/src/Nadeko.Bot.Modules.Utility/Patronage/Patreon/PatreonClient.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/Patreon/PatreonClient.cs rename to src/Nadeko.Bot.Modules.Utility/Patronage/Patreon/PatreonClient.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/Patreon/PatreonCredentials.cs b/src/Nadeko.Bot.Modules.Utility/Patronage/Patreon/PatreonCredentials.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/Patreon/PatreonCredentials.cs rename to src/Nadeko.Bot.Modules.Utility/Patronage/Patreon/PatreonCredentials.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/Patreon/PatreonMemberData.cs b/src/Nadeko.Bot.Modules.Utility/Patronage/Patreon/PatreonMemberData.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/Patreon/PatreonMemberData.cs rename to src/Nadeko.Bot.Modules.Utility/Patronage/Patreon/PatreonMemberData.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/Patreon/PatreonRefreshData.cs b/src/Nadeko.Bot.Modules.Utility/Patronage/Patreon/PatreonRefreshData.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/Patreon/PatreonRefreshData.cs rename to src/Nadeko.Bot.Modules.Utility/Patronage/Patreon/PatreonRefreshData.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/Patreon/PatreonSubscriptionHandler.cs b/src/Nadeko.Bot.Modules.Utility/Patronage/Patreon/PatreonSubscriptionHandler.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/Patreon/PatreonSubscriptionHandler.cs rename to src/Nadeko.Bot.Modules.Utility/Patronage/Patreon/PatreonSubscriptionHandler.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/PatronageCommands.cs b/src/Nadeko.Bot.Modules.Utility/Patronage/PatronageCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Patronage/PatronageCommands.cs rename to src/Nadeko.Bot.Modules.Utility/Patronage/PatronageCommands.cs diff --git a/src/NadekoBot/Modules/Utility/Patronage/PatronageService.cs b/src/Nadeko.Bot.Modules.Utility/Patronage/PatronageService.cs similarity index 99% rename from src/NadekoBot/Modules/Utility/Patronage/PatronageService.cs rename to src/Nadeko.Bot.Modules.Utility/Patronage/PatronageService.cs index 3c831f737..761ec55bc 100644 --- a/src/NadekoBot/Modules/Utility/Patronage/PatronageService.cs +++ b/src/Nadeko.Bot.Modules.Utility/Patronage/PatronageService.cs @@ -4,7 +4,6 @@ using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Db.Models; using OneOf; using OneOf.Types; -using StackExchange.Redis; using CommandInfo = Discord.Commands.CommandInfo; namespace NadekoBot.Modules.Utility.Patronage; diff --git a/src/NadekoBot/Modules/Utility/Quote/IQuoteService.cs b/src/Nadeko.Bot.Modules.Utility/Quote/IQuoteService.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Quote/IQuoteService.cs rename to src/Nadeko.Bot.Modules.Utility/Quote/IQuoteService.cs diff --git a/src/NadekoBot/Modules/Utility/Quote/QuoteCommands.cs b/src/Nadeko.Bot.Modules.Utility/Quote/QuoteCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Quote/QuoteCommands.cs rename to src/Nadeko.Bot.Modules.Utility/Quote/QuoteCommands.cs diff --git a/src/NadekoBot/Modules/Utility/Quote/QuoteService.cs b/src/Nadeko.Bot.Modules.Utility/Quote/QuoteService.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Quote/QuoteService.cs rename to src/Nadeko.Bot.Modules.Utility/Quote/QuoteService.cs diff --git a/src/NadekoBot/Modules/Utility/Remind/RemindCommands.cs b/src/Nadeko.Bot.Modules.Utility/Remind/RemindCommands.cs similarity index 97% rename from src/NadekoBot/Modules/Utility/Remind/RemindCommands.cs rename to src/Nadeko.Bot.Modules.Utility/Remind/RemindCommands.cs index 9a7cd6125..3f67921e2 100644 --- a/src/NadekoBot/Modules/Utility/Remind/RemindCommands.cs +++ b/src/Nadeko.Bot.Modules.Utility/Remind/RemindCommands.cs @@ -1,7 +1,6 @@ #nullable disable using Humanizer.Localisation; using NadekoBot.Db; -using NadekoBot.Modules.Administration.Services; using NadekoBot.Modules.Utility.Services; using NadekoBot.Services.Database.Models; @@ -27,9 +26,9 @@ public partial class Utility } private readonly DbService _db; - private readonly GuildTimezoneService _tz; + private readonly ITimezoneService _tz; - public RemindCommands(DbService db, GuildTimezoneService tz) + public RemindCommands(DbService db, ITimezoneService tz) { _db = db; _tz = tz; diff --git a/src/NadekoBot/Modules/Utility/Remind/RemindService.cs b/src/Nadeko.Bot.Modules.Utility/Remind/RemindService.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Remind/RemindService.cs rename to src/Nadeko.Bot.Modules.Utility/Remind/RemindService.cs diff --git a/src/NadekoBot/Modules/Utility/Repeater/RepeatCommands.cs b/src/Nadeko.Bot.Modules.Utility/Repeater/RepeatCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Repeater/RepeatCommands.cs rename to src/Nadeko.Bot.Modules.Utility/Repeater/RepeatCommands.cs diff --git a/src/NadekoBot/Modules/Utility/Repeater/RepeaterService.cs b/src/Nadeko.Bot.Modules.Utility/Repeater/RepeaterService.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Repeater/RepeaterService.cs rename to src/Nadeko.Bot.Modules.Utility/Repeater/RepeaterService.cs diff --git a/src/NadekoBot/Modules/Utility/Repeater/RunningRepeater.cs b/src/Nadeko.Bot.Modules.Utility/Repeater/RunningRepeater.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/Repeater/RunningRepeater.cs rename to src/Nadeko.Bot.Modules.Utility/Repeater/RunningRepeater.cs diff --git a/src/NadekoBot/Modules/Utility/StreamRole/StreamRoleCommands.cs b/src/Nadeko.Bot.Modules.Utility/StreamRole/StreamRoleCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/StreamRole/StreamRoleCommands.cs rename to src/Nadeko.Bot.Modules.Utility/StreamRole/StreamRoleCommands.cs diff --git a/src/NadekoBot/Modules/Utility/StreamRole/StreamRoleService.cs b/src/Nadeko.Bot.Modules.Utility/StreamRole/StreamRoleService.cs similarity index 99% rename from src/NadekoBot/Modules/Utility/StreamRole/StreamRoleService.cs rename to src/Nadeko.Bot.Modules.Utility/StreamRole/StreamRoleService.cs index 99a73de57..fc69021b7 100644 --- a/src/NadekoBot/Modules/Utility/StreamRole/StreamRoleService.cs +++ b/src/Nadeko.Bot.Modules.Utility/StreamRole/StreamRoleService.cs @@ -14,7 +14,7 @@ public class StreamRoleService : IReadyExecutor, INService private readonly ConcurrentDictionary _guildSettings; private readonly QueueRunner _queueRunner; - public StreamRoleService(DiscordSocketClient client, DbService db, Bot bot) + public StreamRoleService(DiscordSocketClient client, DbService db, IBot bot) { _db = db; _client = client; diff --git a/src/NadekoBot/Modules/Utility/UnitConversion/ConverterService.cs b/src/Nadeko.Bot.Modules.Utility/UnitConversion/ConverterService.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/UnitConversion/ConverterService.cs rename to src/Nadeko.Bot.Modules.Utility/UnitConversion/ConverterService.cs diff --git a/src/NadekoBot/Modules/Utility/UnitConversion/UnitConversionCommands.cs b/src/Nadeko.Bot.Modules.Utility/UnitConversion/UnitConversionCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/UnitConversion/UnitConversionCommands.cs rename to src/Nadeko.Bot.Modules.Utility/UnitConversion/UnitConversionCommands.cs diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/Nadeko.Bot.Modules.Utility/Utility.cs similarity index 99% rename from src/NadekoBot/Modules/Utility/Utility.cs rename to src/Nadeko.Bot.Modules.Utility/Utility.cs index 374bba0ac..131ce47e8 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/Nadeko.Bot.Modules.Utility/Utility.cs @@ -1,14 +1,11 @@ #nullable disable -using Microsoft.CodeAnalysis.CSharp.Scripting; -using Microsoft.CodeAnalysis.Scripting; using NadekoBot.Modules.Utility.Services; using Newtonsoft.Json; using System.Diagnostics; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; -using Nadeko.Common; -using SystemTextJsonSamples; +using NadekoBot.Modules.Searches.Common; namespace NadekoBot.Modules.Utility; diff --git a/src/NadekoBot/Modules/Utility/VerboseErrors/EvalCommands.cs b/src/Nadeko.Bot.Modules.Utility/VerboseErrors/EvalCommands.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/VerboseErrors/EvalCommands.cs rename to src/Nadeko.Bot.Modules.Utility/VerboseErrors/EvalCommands.cs diff --git a/src/NadekoBot/Modules/Utility/VerboseErrors/EvalGlobals.cs b/src/Nadeko.Bot.Modules.Utility/VerboseErrors/EvalGlobals.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/VerboseErrors/EvalGlobals.cs rename to src/Nadeko.Bot.Modules.Utility/VerboseErrors/EvalGlobals.cs diff --git a/src/NadekoBot/Modules/Utility/VerboseErrorsService.cs b/src/Nadeko.Bot.Modules.Utility/VerboseErrorsService.cs similarity index 99% rename from src/NadekoBot/Modules/Utility/VerboseErrorsService.cs rename to src/Nadeko.Bot.Modules.Utility/VerboseErrorsService.cs index 8da8266e8..2829995a9 100644 --- a/src/NadekoBot/Modules/Utility/VerboseErrorsService.cs +++ b/src/Nadeko.Bot.Modules.Utility/VerboseErrorsService.cs @@ -12,7 +12,7 @@ public class VerboseErrorsService : INService private readonly HelpService _hs; public VerboseErrorsService( - Bot bot, + IBot bot, DbService db, CommandHandler ch, HelpService hs) diff --git a/src/NadekoBot/Modules/Utility/_Common/ConvertUnit.cs b/src/Nadeko.Bot.Modules.Utility/_Common/ConvertUnit.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/_Common/ConvertUnit.cs rename to src/Nadeko.Bot.Modules.Utility/_Common/ConvertUnit.cs diff --git a/src/NadekoBot/Modules/Utility/_Common/Exceptions/StreamRoleNotFoundException.cs b/src/Nadeko.Bot.Modules.Utility/_Common/Exceptions/StreamRoleNotFoundException.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/_Common/Exceptions/StreamRoleNotFoundException.cs rename to src/Nadeko.Bot.Modules.Utility/_Common/Exceptions/StreamRoleNotFoundException.cs diff --git a/src/NadekoBot/Modules/Utility/_Common/Exceptions/StreamRolePermissionException.cs b/src/Nadeko.Bot.Modules.Utility/_Common/Exceptions/StreamRolePermissionException.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/_Common/Exceptions/StreamRolePermissionException.cs rename to src/Nadeko.Bot.Modules.Utility/_Common/Exceptions/StreamRolePermissionException.cs diff --git a/src/NadekoBot/Modules/Utility/_Common/Patreon/PatreonData.cs b/src/Nadeko.Bot.Modules.Utility/_Common/Patreon/PatreonData.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/_Common/Patreon/PatreonData.cs rename to src/Nadeko.Bot.Modules.Utility/_Common/Patreon/PatreonData.cs diff --git a/src/NadekoBot/Modules/Utility/_Common/StreamRoleListType.cs b/src/Nadeko.Bot.Modules.Utility/_Common/StreamRoleListType.cs similarity index 100% rename from src/NadekoBot/Modules/Utility/_Common/StreamRoleListType.cs rename to src/Nadeko.Bot.Modules.Utility/_Common/StreamRoleListType.cs diff --git a/src/NadekoBot/Modules/Xp/Club/Club.cs b/src/Nadeko.Bot.Modules.Xp/Club/Club.cs similarity index 97% rename from src/NadekoBot/Modules/Xp/Club/Club.cs rename to src/Nadeko.Bot.Modules.Xp/Club/Club.cs index a58642f7d..cc6b21c52 100644 --- a/src/NadekoBot/Modules/Xp/Club/Club.cs +++ b/src/Nadeko.Bot.Modules.Xp/Club/Club.cs @@ -1,4 +1,5 @@ #nullable disable +using NadekoBot.Db; using NadekoBot.Db.Models; using NadekoBot.Modules.Xp.Services; @@ -21,9 +22,9 @@ public partial class Xp if (!result.TryPickT0(out var club, out var error)) { - if(error == ClubTransferError.NotOwner) + if (error == ClubTransferError.NotOwner) await ReplyErrorLocalizedAsync(strs.club_owner_only); - else + else await ReplyErrorLocalizedAsync(strs.club_target_not_member); } else @@ -96,7 +97,7 @@ public partial class Xp } var result = await _service.SetClubIconAsync(ctx.User.Id, url); - if(result == SetClubIconResult.Success) + if (result == SetClubIconResult.Success) await ReplyConfirmLocalizedAsync(strs.club_icon_set); else if (result == SetClubIconResult.NotOwner) await ReplyErrorLocalizedAsync(strs.club_owner_only); @@ -277,9 +278,9 @@ public partial class Xp var result = _service.AcceptApplication(ctx.User.Id, userName, out var discordUser); if (result == ClubAcceptResult.Accepted) await ReplyConfirmLocalizedAsync(strs.club_accepted(Format.Bold(discordUser.ToString()))); - else if(result == ClubAcceptResult.NoSuchApplicant) + else if (result == ClubAcceptResult.NoSuchApplicant) await ReplyErrorLocalizedAsync(strs.club_accept_invalid_applicant); - else if(result == ClubAcceptResult.NotOwnerOrAdmin) + else if (result == ClubAcceptResult.NotOwnerOrAdmin) await ReplyErrorLocalizedAsync(strs.club_admin_perms); } @@ -306,7 +307,7 @@ public partial class Xp public Task ClubKick([Leftover] string userName) { var result = _service.Kick(ctx.User.Id, userName, out var club); - if(result == ClubKickResult.Success) + if (result == ClubKickResult.Success) { return ReplyConfirmLocalizedAsync(strs.club_user_kick(Format.Bold(userName), Format.Bold(club.ToString()))); @@ -317,7 +318,7 @@ public partial class Xp if (result == ClubKickResult.NotOwnerOrAdmin) return ReplyErrorLocalizedAsync(strs.club_admin_perms); - + return ReplyErrorLocalizedAsync(strs.club_target_not_member); } diff --git a/src/NadekoBot/Modules/Xp/Club/ClubService.cs b/src/Nadeko.Bot.Modules.Xp/Club/ClubService.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/ClubService.cs rename to src/Nadeko.Bot.Modules.Xp/Club/ClubService.cs diff --git a/src/NadekoBot/Modules/Xp/Club/IClubService.cs b/src/Nadeko.Bot.Modules.Xp/Club/IClubService.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/IClubService.cs rename to src/Nadeko.Bot.Modules.Xp/Club/IClubService.cs diff --git a/src/NadekoBot/Modules/Xp/Club/Results/ClubAcceptResult.cs b/src/Nadeko.Bot.Modules.Xp/Club/Results/ClubAcceptResult.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/Results/ClubAcceptResult.cs rename to src/Nadeko.Bot.Modules.Xp/Club/Results/ClubAcceptResult.cs diff --git a/src/NadekoBot/Modules/Xp/Club/Results/ClubBanResult.cs b/src/Nadeko.Bot.Modules.Xp/Club/Results/ClubBanResult.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/Results/ClubBanResult.cs rename to src/Nadeko.Bot.Modules.Xp/Club/Results/ClubBanResult.cs diff --git a/src/NadekoBot/Modules/Xp/Club/Results/ClubCreateResult.cs b/src/Nadeko.Bot.Modules.Xp/Club/Results/ClubCreateResult.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/Results/ClubCreateResult.cs rename to src/Nadeko.Bot.Modules.Xp/Club/Results/ClubCreateResult.cs diff --git a/src/NadekoBot/Modules/Xp/Club/Results/ClubKickResult.cs b/src/Nadeko.Bot.Modules.Xp/Club/Results/ClubKickResult.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/Results/ClubKickResult.cs rename to src/Nadeko.Bot.Modules.Xp/Club/Results/ClubKickResult.cs diff --git a/src/NadekoBot/Modules/Xp/Club/Results/ClubLeaveResult.cs b/src/Nadeko.Bot.Modules.Xp/Club/Results/ClubLeaveResult.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/Results/ClubLeaveResult.cs rename to src/Nadeko.Bot.Modules.Xp/Club/Results/ClubLeaveResult.cs diff --git a/src/NadekoBot/Modules/Xp/Club/Results/ClubTransferError.cs b/src/Nadeko.Bot.Modules.Xp/Club/Results/ClubTransferError.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/Results/ClubTransferError.cs rename to src/Nadeko.Bot.Modules.Xp/Club/Results/ClubTransferError.cs diff --git a/src/NadekoBot/Modules/Xp/Club/Results/ClubUnbanResult.cs b/src/Nadeko.Bot.Modules.Xp/Club/Results/ClubUnbanResult.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/Results/ClubUnbanResult.cs rename to src/Nadeko.Bot.Modules.Xp/Club/Results/ClubUnbanResult.cs diff --git a/src/NadekoBot/Modules/Xp/Club/Results/SetClubIconResult.cs b/src/Nadeko.Bot.Modules.Xp/Club/Results/SetClubIconResult.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/Results/SetClubIconResult.cs rename to src/Nadeko.Bot.Modules.Xp/Club/Results/SetClubIconResult.cs diff --git a/src/NadekoBot/Modules/Xp/Club/Results/ToggleAdminResult.cs b/src/Nadeko.Bot.Modules.Xp/Club/Results/ToggleAdminResult.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/Club/Results/ToggleAdminResult.cs rename to src/Nadeko.Bot.Modules.Xp/Club/Results/ToggleAdminResult.cs diff --git a/src/Nadeko.Bot.Modules.Xp/GlobalUsings.cs b/src/Nadeko.Bot.Modules.Xp/GlobalUsings.cs new file mode 100644 index 000000000..f754e6165 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Xp/GlobalUsings.cs @@ -0,0 +1,32 @@ +// // global using System.Collections.Concurrent; +global using NonBlocking; +// +// // packages +global using Serilog; +global using Humanizer; +global using Newtonsoft; +// +// // nadekobot +// global using NadekoBot; +global using NadekoBot.Services; +global using Nadeko.Common; // new project +global using NadekoBot.Common; // old + nadekobot specific things +global using NadekoBot.Common.Attributes; +global using NadekoBot.Extensions; +// global using Nadeko.Snake; + +// discord +global using Discord; +global using Discord.Commands; +global using Discord.Net; +global using Discord.WebSocket; + +// aliases +global using GuildPerm = Discord.GuildPermission; +global using ChannelPerm = Discord.ChannelPermission; +global using BotPermAttribute = Discord.Commands.RequireBotPermissionAttribute; +global using LeftoverAttribute = Discord.Commands.RemainderAttribute; +global using TypeReaderResult = NadekoBot.Common.TypeReaders.TypeReaderResult; + +// non-essential +// global using JetBrains.Annotations; \ No newline at end of file diff --git a/src/Nadeko.Bot.Modules.Xp/Nadeko.Bot.Modules.Xp.csproj b/src/Nadeko.Bot.Modules.Xp/Nadeko.Bot.Modules.Xp.csproj new file mode 100644 index 000000000..1233b9592 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Xp/Nadeko.Bot.Modules.Xp.csproj @@ -0,0 +1,18 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + diff --git a/src/NadekoBot/Modules/Xp/Xp.cs b/src/Nadeko.Bot.Modules.Xp/Xp.cs similarity index 88% rename from src/NadekoBot/Modules/Xp/Xp.cs rename to src/Nadeko.Bot.Modules.Xp/Xp.cs index 7ff05075b..fd861a339 100644 --- a/src/NadekoBot/Modules/Xp/Xp.cs +++ b/src/Nadeko.Bot.Modules.Xp/Xp.cs @@ -1,8 +1,9 @@ #nullable disable warnings -using NadekoBot.Modules.Gambling.Services; using NadekoBot.Modules.Xp.Services; using NadekoBot.Services.Database.Models; using System.Globalization; +using Nadeko.Bot.Common; +using NadekoBot.Db; using NadekoBot.Db.Models; using NadekoBot.Modules.Utility.Patronage; @@ -10,7 +11,10 @@ namespace NadekoBot.Modules.Xp; public partial class Xp : NadekoModule { - public enum Channel { Channel } + public enum Channel + { + Channel + } public enum NotifyPlace { @@ -19,14 +23,20 @@ public partial class Xp : NadekoModule Global = 1 } - public enum Role { Role } + public enum Role + { + Role + } - public enum Server { Server } + public enum Server + { + Server + } private readonly DownloadTracker _tracker; - private readonly GamblingConfigService _gss; + private readonly ICurrencyProvider _gss; - public Xp(DownloadTracker tracker, GamblingConfigService gss) + public Xp(DownloadTracker tracker, ICurrencyProvider gss) { _tracker = tracker; _gss = gss; @@ -53,9 +63,9 @@ public partial class Xp : NadekoModule var serverSetting = _service.GetNotificationType(ctx.User.Id, ctx.Guild.Id); var embed = _eb.Create() - .WithOkColor() - .AddField(GetText(strs.xpn_setting_global), GetNotifLocationString(globalSetting)) - .AddField(GetText(strs.xpn_setting_server), GetNotifLocationString(serverSetting)); + .WithOkColor() + .AddField(GetText(strs.xpn_setting_global), GetNotifLocationString(globalSetting)) + .AddField(GetText(strs.xpn_setting_server), GetNotifLocationString(serverSetting)); await ctx.Channel.EmbedAsync(embed); } @@ -120,16 +130,16 @@ public partial class Xp : NadekoModule { var serverExcluded = _service.IsServerExcluded(ctx.Guild.Id); var roles = _service.GetExcludedRoles(ctx.Guild.Id) - .Select(x => ctx.Guild.GetRole(x)) - .Where(x => x is not null) - .Select(x => $"`role` {x.Mention}") - .ToList(); + .Select(x => ctx.Guild.GetRole(x)) + .Where(x => x is not null) + .Select(x => $"`role` {x.Mention}") + .ToList(); var chans = (await _service.GetExcludedChannels(ctx.Guild.Id) - .Select(x => ctx.Guild.GetChannelAsync(x)) - .WhenAll()).Where(x => x is not null) - .Select(x => $"`channel` <#{x.Id}>") - .ToList(); + .Select(x => ctx.Guild.GetChannelAsync(x)) + .WhenAll()).Where(x => x is not null) + .Select(x => $"`channel` <#{x.Id}>") + .ToList(); var rolesStr = roles.Any() ? string.Join("\n", roles) + "\n" : string.Empty; var chansStr = chans.Count > 0 ? string.Join("\n", chans) + "\n" : string.Empty; @@ -144,9 +154,9 @@ public partial class Xp : NadekoModule curpage => { var embed = _eb.Create() - .WithTitle(GetText(strs.exclusion_list)) - .WithDescription(string.Join('\n', lines.Skip(15 * curpage).Take(15))) - .WithOkColor(); + .WithTitle(GetText(strs.exclusion_list)) + .WithDescription(string.Join('\n', lines.Skip(15 * curpage).Take(15))) + .WithOkColor(); return embed; }, @@ -182,8 +192,8 @@ public partial class Xp : NadekoModule await _tracker.EnsureUsersDownloadedAsync(ctx.Guild); allUsers = _service.GetTopUserXps(ctx.Guild.Id, 1000) - .Where(user => socketGuild.GetUser(user.UserId) is not null) - .ToList(); + .Where(user => socketGuild.GetUser(user.UserId) is not null) + .ToList(); } await ctx.SendPaginatedConfirmAsync(page, @@ -262,9 +272,10 @@ public partial class Xp : NadekoModule return; var count = await _service.AddXpToUsersAsync(ctx.Guild.Id, amount, role.Members.Select(x => x.Id).ToArray()); - await ReplyConfirmLocalizedAsync(strs.xpadd_users(Format.Bold(amount.ToString()), Format.Bold(count.ToString()))); + await ReplyConfirmLocalizedAsync( + strs.xpadd_users(Format.Bold(amount.ToString()), Format.Bold(count.ToString()))); } - + [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] @@ -295,7 +306,7 @@ public partial class Xp : NadekoModule await Task.Delay(1000); await ReplyConfirmLocalizedAsync(strs.template_reloaded); } - + [Cmd] [RequireContext(ContextType.Guild)] [UserPerm(GuildPerm.Administrator)] @@ -360,7 +371,7 @@ public partial class Xp : NadekoModule *{GetText(strs.xpshop_website)}*"); } - + [Cmd] public async Task XpShop(XpShopInputType type, int page = 1) { @@ -368,7 +379,7 @@ public partial class Xp : NadekoModule if (page < 0) return; - + var items = type == XpShopInputType.Backgrounds ? await _service.GetShopBgs() : await _service.GetShopFrames(); @@ -384,10 +395,6 @@ public partial class Xp : NadekoModule await ReplyErrorLocalizedAsync(strs.not_found); return; } - - var culture = (CultureInfo)Culture.Clone(); - culture.NumberFormat.CurrencySymbol = _gss.Data.Currency.Sign; - culture.NumberFormat.CurrencyNegativePattern = 5; await ctx.SendPaginatedConfirmAsync<(string, XpShopItemType)?>(page, current => @@ -397,7 +404,7 @@ public partial class Xp : NadekoModule var eb = _eb.Create(ctx) .WithOkColor() .WithTitle(item.Name) - .AddField(GetText(strs.price), Gambling.Gambling.N(item.Price, culture), true) + .AddField(GetText(strs.price), CurrencyHelper.N(item.Price, Culture, _gss.GetCurrencySign()), true) .WithImageUrl(string.IsNullOrWhiteSpace(item.Preview) ? item.Url : item.Preview); @@ -419,7 +426,6 @@ public partial class Xp : NadekoModule }, async current => { - var (key, _) = items.Skip(current).First(); var itemType = type == XpShopInputType.Backgrounds @@ -475,14 +481,15 @@ public partial class Xp : NadekoModule async (smc, _) => await XpShopUse(type, key) )); } - + if (result != BuyResult.Success) { var _ = result switch { BuyResult.XpShopDisabled => await ReplyErrorLocalizedAsync(strs.xp_shop_disabled), - BuyResult.InsufficientFunds => await ReplyErrorLocalizedAsync(strs.not_enough(_gss.Data.Currency.Sign)), - BuyResult.AlreadyOwned => await ReplyErrorLocalizedAsync(strs.xpshop_already_owned, GetUseInteraction()), + BuyResult.InsufficientFunds => await ReplyErrorLocalizedAsync(strs.not_enough(_gss.GetCurrencySign())), + BuyResult.AlreadyOwned => + await ReplyErrorLocalizedAsync(strs.xpshop_already_owned, GetUseInteraction()), BuyResult.UnknownItem => await ReplyErrorLocalizedAsync(strs.xpshop_item_not_found), BuyResult.InsufficientPatronTier => await ReplyErrorLocalizedAsync(strs.patron_insuff_tier), _ => throw new ArgumentOutOfRangeException() @@ -494,7 +501,7 @@ public partial class Xp : NadekoModule key.ToLowerInvariant()), GetUseInteraction()); } - + [Cmd] public async Task XpShopUse(XpShopInputType type, string key) { @@ -508,14 +515,14 @@ public partial class Xp : NadekoModule await ctx.OkAsync(); } - + private async Task OnShopUse(SocketMessageComponent smc, (string? key, XpShopItemType type)? maybeState) { if (maybeState is not { } state) return; - + var (key, type) = state; - + var result = await _service.UseShopItemAsync(ctx.User.Id, type, key); @@ -524,19 +531,19 @@ public partial class Xp : NadekoModule await ReplyConfirmLocalizedAsync(strs.xp_shop_item_cant_use); } } - + private async Task OnShopBuy(SocketMessageComponent smc, (string? key, XpShopItemType type)? maybeState) { if (maybeState is not { } state) return; - + var (key, type) = state; - + var result = await _service.BuyShopItemAsync(ctx.User.Id, type, key); if (result == BuyResult.InsufficientFunds) { - await ReplyErrorLocalizedAsync(strs.not_enough(_gss.Data.Currency.Sign)); + await ReplyErrorLocalizedAsync(strs.not_enough(_gss.GetCurrencySign())); } } diff --git a/src/NadekoBot/Modules/Xp/XpConfig.cs b/src/Nadeko.Bot.Modules.Xp/XpConfig.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/XpConfig.cs rename to src/Nadeko.Bot.Modules.Xp/XpConfig.cs diff --git a/src/NadekoBot/Modules/Xp/XpConfigService.cs b/src/Nadeko.Bot.Modules.Xp/XpConfigService.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/XpConfigService.cs rename to src/Nadeko.Bot.Modules.Xp/XpConfigService.cs diff --git a/src/NadekoBot/Modules/Xp/XpRewards.cs b/src/Nadeko.Bot.Modules.Xp/XpRewards.cs similarity index 93% rename from src/NadekoBot/Modules/Xp/XpRewards.cs rename to src/Nadeko.Bot.Modules.Xp/XpRewards.cs index 36c152eb7..2bbc8ba41 100644 --- a/src/NadekoBot/Modules/Xp/XpRewards.cs +++ b/src/Nadeko.Bot.Modules.Xp/XpRewards.cs @@ -1,4 +1,4 @@ -using NadekoBot.Modules.Gambling.Services; +using Nadeko.Bot.Common; using NadekoBot.Modules.Xp.Services; namespace NadekoBot.Modules.Xp; @@ -7,10 +7,10 @@ public partial class Xp { public partial class XpRewards : NadekoModule { - private readonly GamblingConfigService _gss; + private readonly ICurrencyProvider _cp; - public XpRewards(GamblingConfigService gcs) - => _gss = gcs; + public XpRewards(ICurrencyProvider cp) + => _cp = cp; [Cmd] [RequireContext(ContextType.Guild)] @@ -62,7 +62,7 @@ public partial class Xp .Concat(_service.GetCurrencyRewards(ctx.Guild.Id) .OrderBy(x => x.Level) .Select(x => (x.Level, - Format.Bold(x.Amount + _gss.Data.Currency.Sign)))) + Format.Bold(x.Amount + _cp.GetCurrencySign())))) .GroupBy(x => x.Level) .OrderBy(x => x.Key) .ToList(); @@ -126,14 +126,13 @@ public partial class Xp if (level < 1 || amount < 0) return; + // todo, shouldn't all amount + sign be N(amount) _service.SetCurrencyReward(ctx.Guild.Id, level, amount); - var config = _gss.Data; - if (amount == 0) - await ReplyConfirmLocalizedAsync(strs.cur_reward_cleared(level, config.Currency.Sign)); + await ReplyConfirmLocalizedAsync(strs.cur_reward_cleared(level, _cp.GetCurrencySign())); else await ReplyConfirmLocalizedAsync(strs.cur_reward_added(level, - Format.Bold(amount + config.Currency.Sign))); + Format.Bold(amount + _cp.GetCurrencySign()))); } } } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Xp/XpService.cs b/src/Nadeko.Bot.Modules.Xp/XpService.cs similarity index 99% rename from src/NadekoBot/Modules/Xp/XpService.cs rename to src/Nadeko.Bot.Modules.Xp/XpService.cs index 83306dc71..9fca4e642 100644 --- a/src/NadekoBot/Modules/Xp/XpService.cs +++ b/src/Nadeko.Bot.Modules.Xp/XpService.cs @@ -15,6 +15,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using System.Threading.Channels; using LinqToDB.EntityFrameworkCore; +using NadekoBot.Services; using Color = SixLabors.ImageSharp.Color; using Exception = System.Exception; using Image = SixLabors.ImageSharp.Image; @@ -23,7 +24,6 @@ namespace NadekoBot.Modules.Xp.Services; public class XpService : INService, IReadyExecutor, IExecNoCommand { - public const int XP_REQUIRED_LVL_1 = 36; private readonly DbService _db; private readonly IImageCache _images; @@ -53,7 +53,7 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand public XpService( DiscordSocketClient client, - Bot bot, + IBot bot, DbService db, IBotStrings strings, IImageCache images, diff --git a/src/Nadeko.Bot.Modules.Xp/_Common/Extensions.cs b/src/Nadeko.Bot.Modules.Xp/_Common/Extensions.cs new file mode 100644 index 000000000..31205dd40 --- /dev/null +++ b/src/Nadeko.Bot.Modules.Xp/_Common/Extensions.cs @@ -0,0 +1,10 @@ +#nullable disable +using LinqToDB; +using NadekoBot.Services.Database.Models; + +namespace NadekoBot.Modules.Xp.Extensions; + +public static class Extensions +{ + +} \ No newline at end of file diff --git a/src/NadekoBot/Modules/Xp/_Common/FullUserStats.cs b/src/Nadeko.Bot.Modules.Xp/_Common/FullUserStats.cs similarity index 97% rename from src/NadekoBot/Modules/Xp/_Common/FullUserStats.cs rename to src/Nadeko.Bot.Modules.Xp/_Common/FullUserStats.cs index 368a305da..0b6901ef4 100644 --- a/src/NadekoBot/Modules/Xp/_Common/FullUserStats.cs +++ b/src/Nadeko.Bot.Modules.Xp/_Common/FullUserStats.cs @@ -1,4 +1,5 @@ #nullable disable +using NadekoBot.Db; using NadekoBot.Db.Models; using NadekoBot.Services.Database.Models; diff --git a/src/NadekoBot/Modules/Xp/_Common/UserCacheItem.cs b/src/Nadeko.Bot.Modules.Xp/_Common/UserCacheItem.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/_Common/UserCacheItem.cs rename to src/Nadeko.Bot.Modules.Xp/_Common/UserCacheItem.cs diff --git a/src/NadekoBot/Modules/Xp/_Common/XpTemplate.cs b/src/Nadeko.Bot.Modules.Xp/_Common/XpTemplate.cs similarity index 100% rename from src/NadekoBot/Modules/Xp/_Common/XpTemplate.cs rename to src/Nadeko.Bot.Modules.Xp/_Common/XpTemplate.cs diff --git a/src/Nadeko.Common/Extensions/Extensions.cs b/src/Nadeko.Common/Extensions/Extensions.cs new file mode 100644 index 000000000..8eca3ec5e --- /dev/null +++ b/src/Nadeko.Common/Extensions/Extensions.cs @@ -0,0 +1,7 @@ +namespace Nadeko.Common; + +public static class Extensions +{ + public static long ToTimestamp(this in DateTime value) + => (value.Ticks - 621355968000000000) / 10000000; +} \ No newline at end of file diff --git a/src/NadekoBot.Tests/NadekoBot.Tests.csproj b/src/NadekoBot.Tests/NadekoBot.Tests.csproj index 874320c22..4f0b4b54d 100644 --- a/src/NadekoBot.Tests/NadekoBot.Tests.csproj +++ b/src/NadekoBot.Tests/NadekoBot.Tests.csproj @@ -12,6 +12,7 @@ + diff --git a/src/NadekoBot/Modules/Xp/_Common/Extensions.cs b/src/NadekoBot/Modules/Xp/_Common/Extensions.cs deleted file mode 100644 index cf909879f..000000000 --- a/src/NadekoBot/Modules/Xp/_Common/Extensions.cs +++ /dev/null @@ -1,15 +0,0 @@ -#nullable disable -using LinqToDB; -using NadekoBot.Services.Database.Models; - -namespace NadekoBot.Modules.Xp.Extensions; - -public static class Extensions -{ - public static async Task GetLevelDataFor(this ITable userXp, ulong guildId, ulong userId) - => await userXp - .Where(x => x.GuildId == guildId && x.UserId == userId) - .FirstOrDefaultAsync() is UserXpStats uxs - ? new(uxs.Xp + uxs.AwardedXp) - : new(0); -} \ No newline at end of file diff --git a/src/NadekoBot/NadekoBot.csproj b/src/NadekoBot/NadekoBot.csproj index e57f8a740..f59eeb8b1 100644 --- a/src/NadekoBot/NadekoBot.csproj +++ b/src/NadekoBot/NadekoBot.csproj @@ -27,7 +27,6 @@ - @@ -102,6 +101,9 @@ + + + @@ -126,10 +128,7 @@ - - - - +