Initial split of the modules
This commit is contained in:
NadekoBot.Core
Common
AsyncLazy.cs
Attributes
BotConfigEditType.csCREmbed.csCollections
CommandData.csModuleBehaviors
IEarlyBlocker.csIEarlyBlockingExecutor.csIEarlyExecutor.csIINputTransformer.csILateBlocker.csILateBlockingExecutor.csILateExecutor.cs
NadekoModule.csNadekoModuleExtensions.csNadekoRandom.csNoPublicBotPrecondition.csPlatformHelper.csReplacements
Shard0Precondition.csShardCom
SocketMessageEventWrapper.csTypeReaders
Migrations
20161011200458_first.Designer.cs20161011200458_first.cs20161015005020_CurrencyTransaction.Designer.cs20161015005020_CurrencyTransaction.cs20161015102407_coc.Designer.cs20161015102407_coc.cs20161019055137_MuteRoleName.Designer.cs20161019055137_MuteRoleName.cs20161107213222_Cleverbot.Designer.cs20161107213222_Cleverbot.cs20161122100602_Greet and bye improved.Designer.cs20161122100602_Greet and bye improved.cs20161127233843_PokeGame.Designer.cs20161127233843_PokeGame.cs20161213025624_mutedusers.Designer.cs20161213025624_mutedusers.cs20161224032833_logsettings.Designer.cs20161224032833_logsettings.cs20170110111159_repeater-drop.Designer.cs20170110111159_repeater-drop.cs20170110111302_repeater-new.Designer.cs20170110111302_repeater-new.cs20170110180534_protection.Designer.cs20170110180534_protection.cs20170112185538_currency-modifications.Designer.cs20170112185538_currency-modifications.cs20170118202307_ok-error-colors.Designer.cs20170118202307_ok-error-colors.cs20170122044958_waifus.Designer.cs20170122044958_waifus.cs20170213164350_guild-timezone-and-locale.Designer.cs20170213164350_guild-timezone-and-locale.cs20170222162505_dateadded.Designer.cs20170222162505_dateadded.cs20170308033058_permsv2.Designer.cs20170308033058_permsv2.cs20170310210952_unmute-timers.Designer.cs20170310210952_unmute-timers.cs20170311054632_vcrole.Designer.cs20170311054632_vcrole.cs20170318190018_crad-and-crdm.Designer.cs20170318190018_crad-and-crdm.cs20170320090138_command-aliasing.Designer.cs20170320090138_command-aliasing.cs20170330000613_warning-commands.Designer.cs20170330000613_warning-commands.cs20170331093025_startup-commands.Designer.cs20170331093025_startup-commands.cs20170401161600_slowmode-whitelist.Designer.cs20170401161600_slowmode-whitelist.cs20170401205753_patreon-rewards.Designer.cs20170401205753_patreon-rewards.cs20170405161814_flower-shop.Designer.cs20170405161814_flower-shop.cs20170408162851_game-voice-channel.Designer.cs20170408162851_game-voice-channel.cs20170409193757_gmod-and-cmod.Designer.cs20170409193757_gmod-and-cmod.cs20170501103455_patreon-id.Designer.cs20170501103455_patreon-id.cs20170528001839_permissions-version.Designer.cs20170528001839_permissions-version.cs20170530033406_guild-prefixes.Designer.cs20170530033406_guild-prefixes.cs20170612094138_verbose-errors.Designer.cs20170612094138_verbose-errors.cs20170612234751_repeat time of day.Designer.cs20170612234751_repeat time of day.cs20170613231358_maxdropamount.Designer.cs20170613231358_maxdropamount.cs20170616154106_crstartswith.Designer.cs20170616154106_crstartswith.cs20170714021615_stream-role.Designer.cs20170714021615_stream-role.cs20170719023924_streamrole-kw-bl-wl.Designer.cs20170719023924_streamrole-kw-bl-wl.cs20170721004230_nsfw-blacklist.Designer.cs20170721004230_nsfw-blacklist.cs20170722074959_cr-ca.Designer.cs20170722074959_cr-ca.cs20170814044636_waifu-items.Designer.cs20170814044636_waifu-items.cs20170815222316_mute-time-antispam.Designer.cs20170815222316_mute-time-antispam.cs20170908230730_xp-and-clubs.Designer.cs20170908230730_xp-and-clubs.cs20170911200031_lastXpGain.Designer.cs20170911200031_lastXpGain.cs20170913022654_total-xp.Designer.cs20170913022654_total-xp.cs20170915034808_club-admins.Designer.cs20170915034808_club-admins.cs20170921185313_feeds.Designer.cs20170921185313_feeds.cs20170923002439_xprr-fix.Designer.cs20170923002439_xprr-fix.csMigrationQueries.csNadekoSqliteContextModelSnapshot.cs
Modules
Administration
Administration.csAutoAssignRoleCommands.cs
Common
GameChannelCommands.csLocalizationCommands.csLogCommands.csMigrationCommands.csMuteCommands.csPlayingRotateCommands.csPrefixCommands.csProtectionCommands.csPruneCommands.csRatelimitCommands.csSelfAssignedRolesCommands.csSelfCommands.csServerGreetCommands.csServices
AdministrationService.csAutoAssignRoleService.csGameVoiceChannelService.csGuildTimezoneService.csLogCommandService.csMuteService.csPlayingRotateService.csProtectionService.csPruneService.csRatelimitService.csSelfService.csUserPunishService.csVcRoleService.csVplusTService.cs
TimeZoneCommands.csUserPunishCommands.csVcRoleCommands.csVoicePlusTextCommands.csHelp
Permissions
Services
CommandHandler.csCurrencyService.cs
Database
IUnitOfWork.cs
DbService.csGreetSettingsService.csIBotConfigProvider.csIBotCredentials.csIDataCache.csIGoogleApiService.csIImagesService.csILocalization.csINService.csIStatsService.csModels
AntiProtection.csBotConfig.csClashCaller.csClashWar.csClubInfo.csCommandCooldown.csCommandCost.csCommandPrice.csConvertUnit.csCurrency.csCurrencyTransaction.csCustomReaction.csDbEntity.csDiscordUser.csDonator.csFeedSub.csFollowedStream.csGuildConfig.csIgnoredLogChannel.csLogSetting.csMusicPlaylist.csPermission.csPlaylistSong.csPokeType.csQuote.csReminder.csRepeater.csRewardedUser.csSelfAssignableRole.csShopEntry.csStreamRoleSettings.csUserXpStats.csVoicePresenceChannel.csWaifu.csWaifuItem.csWaifuUpdate.csWarning.csXpSettings.cs
NadekoContext.csRepositories
IBotConfigRepository.csIClashOfClansRepository.csIClubRepository.csICurrencyRepository.csICurrencyTransactionsRepository.csICustomReactionRepository.csIDiscordUserRepository.csIDonatorsRepository.csIGuildConfigRepository.csIMusicPlaylistRepository.csIPokeGameRepository.csIQuoteRepository.csIReminderRepository.csIRepository.csISelfAssignedRolesRepository.csIUnitConverterRepository.csIWaifuRepository.csIWarningsRepository.csIXpRepository.cs
UnitOfWork.csImpl
BotConfigRepository.csClashOfClansRepository.csClubRepository.csCurrencyRepository.csCurrencyTransactionsRepository.csCustomReactionRepository.csDiscordUserRepository.csDonatorsRepository.csGuildConfigRepository.csMusicPlaylistRepository.csPokeGameRepository.csQuoteRepository.csReminderRepository.csRepository.csSelfAssignedRolesRepository.csUnitCOnverterRepository.csWaifuRepository.csWarningsRepository.csXpRepository.cs
Impl
BotConfigProvider.csBotCredentials.csGoogleApiService.csImagesService.csLocalization.csNadekoStrings.csRedisCache.csSoundCloudApiService.csStartingGuildsListService.csStatsService.csSyncPreconditionService.csYtdl.cs
LogSetup.csNadekoBot.csServiceProvider.csShardsCoordinator.cs_Extensions
Extensions.csIEnumerableExtensions.csIMessageChannelExtensions.csIUserExtensions.csMusicExtensions.csNumberExtensions.csStringExtensions.cs
_libs
_strings
ResponseStrings.ar.jsonResponseStrings.cs-CZ.jsonResponseStrings.da-DK.jsonResponseStrings.de-DE.jsonResponseStrings.en-US.jsonResponseStrings.es-ES.jsonResponseStrings.fr-FR.jsonResponseStrings.he-IL.jsonResponseStrings.id-ID.jsonResponseStrings.it-IT.jsonResponseStrings.ja-JP.jsonResponseStrings.ko-KR.jsonResponseStrings.nb-NO.jsonResponseStrings.nl-NL.jsonResponseStrings.pl-PL.jsonResponseStrings.pt-BR.jsonResponseStrings.ro-RO.jsonResponseStrings.ru-RU.jsonResponseStrings.sr-cyrl-rs.jsonResponseStrings.sv-SE.jsonResponseStrings.tr-TR.jsonResponseStrings.zh-CN.jsonResponseStrings.zh-TW.json
NadekoBot.Module.Searches
AnimeSearchCommands.cs
Common
AnimeResult.csDefineModel.cs
FeedCommands.csJokeCommands.csLoLCommands.csMemegenCommands.csNadekoBot.Modules.Searches.csprojOsuCommands.csOverwatchCommands.csPlaceCommands.csPokemonSearchCommands.csSearches.csExceptions
GoogleSearchResult.csMagicItem.csMangaResult.csOmdbProvider.csOverwatchApiModel.csSearchImageCacher.csSearchPokemon.csStreamResponses.csTimeModels.csWeatherModels.csWikipediaApiModel.csWoWJoke.csServices
StreamNotificationCommands.csTranslatorCommands.csXkcdCommands.csNadekoBot.Modules.CustomReactions
NadekoBot.Modules.Gambling
AnimalRacingCommands.cs
Common
CurrencyEventsCommands.csDiceRollCommands.csDrawCommands.csFlipCoinCommands.csFlowerShopCommands.csGambling.csNadekoBot.Modules.Gambling.csprojSlotCommands.csWaifuClaimCommands.csWheelOfFortuneCommands.csNadekoBot.Modules.Games
AcropobiaCommands.csCleverBotCommands.csConnect4Commands.csGames.csHangmanCommands.csLeetCommands.csNadekoBot.Modules.Games.csprojNunchiCommands.csPlantAndPickCommands.csPollCommands.cs
Common
Acrophobia
ChatterBot
ChatterBotResponse.csChatterBotSession.csCleverbotResponse.csIChatterBotSession.csOfficialCleverbotSession.cs
Connect4
GirlRating.csHangman
Nunchi
Poll.csTrivia
TypingArticle.csTypingGame.csServices
SpeedTypingCommands.csTicTacToeCommands.csTriviaCommands.csNadekoBot.Modules.Music
Common
Extensions
Music.csNadekoBot.Modules.Music.csprojServices
NadekoBot.Modules.Nsfw
NadekoBot.Modules.Pokemon
NadekoBot.Modules.Utility
BotConfigCommands.csCalcCommands.csCommandMapCommands.cs
Common
Extensions
InfoCommands.csNadekoBot.Modules.Utility.csprojPatreonCommands.csQuoteCommands.csRemindCommands.csRepeatCommands.csServices
CommandMapService.csConverterService.csMessageRepeaterService.csPatreonRewardsService.csRemindService.csStreamRoleService.csVerboseErrorsService.cs
StreamRoleCommands.csUnitConversionCommands.csUtility.csVerboseErrorCommands.csNadekoBot.Modules.Xp
NadekoBot.slndocs
src/NadekoBot
0
src/NadekoBot/Common/Attributes/NadekoCommand.cs → NadekoBot.Core/Common/Attributes/NadekoCommand.cs
0
src/NadekoBot/Common/Attributes/NadekoCommand.cs → NadekoBot.Core/Common/Attributes/NadekoCommand.cs
0
src/NadekoBot/Common/NoPublicBotPrecondition.cs → NadekoBot.Core/Common/NoPublicBotPrecondition.cs
0
src/NadekoBot/Common/NoPublicBotPrecondition.cs → NadekoBot.Core/Common/NoPublicBotPrecondition.cs
@ -6,8 +6,6 @@ using Discord;
|
|||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using NadekoBot.Modules.Administration.Services;
|
|
||||||
using NadekoBot.Modules.Music.Services;
|
|
||||||
|
|
||||||
namespace NadekoBot.Common.Replacements
|
namespace NadekoBot.Common.Replacements
|
||||||
{
|
{
|
||||||
@ -46,19 +44,19 @@ namespace NadekoBot.Common.Replacements
|
|||||||
|
|
||||||
_reps.TryAdd("%sid%", () => g == null ? "DM" : g.Id.ToString());
|
_reps.TryAdd("%sid%", () => g == null ? "DM" : g.Id.ToString());
|
||||||
_reps.TryAdd("%server%", () => g == null ? "DM" : g.Name);
|
_reps.TryAdd("%server%", () => g == null ? "DM" : g.Name);
|
||||||
_reps.TryAdd("%server_time%", () =>
|
//_reps.TryAdd("%server_time%", () =>
|
||||||
{
|
//{
|
||||||
TimeZoneInfo to = TimeZoneInfo.Local;
|
// TimeZoneInfo to = TimeZoneInfo.Local;
|
||||||
if (g != null)
|
// if (g != null)
|
||||||
{
|
// {
|
||||||
if (GuildTimezoneService.AllServices.TryGetValue(client.CurrentUser.Id, out var tz))
|
// if (GuildTimezoneService.AllServices.TryGetValue(client.CurrentUser.Id, out var tz))
|
||||||
to = tz.GetTimeZoneOrDefault(g.Id) ?? TimeZoneInfo.Local;
|
// to = tz.GetTimeZoneOrDefault(g.Id) ?? TimeZoneInfo.Local;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return TimeZoneInfo.ConvertTime(DateTime.UtcNow,
|
// return TimeZoneInfo.ConvertTime(DateTime.UtcNow,
|
||||||
TimeZoneInfo.Utc,
|
// TimeZoneInfo.Utc,
|
||||||
to).ToString("HH:mm ") + to.StandardName.GetInitials();
|
// to).ToString("HH:mm ") + to.StandardName.GetInitials();
|
||||||
});
|
//});
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,26 +86,26 @@ namespace NadekoBot.Common.Replacements
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReplacementBuilder WithMusic(MusicService ms)
|
//public ReplacementBuilder WithMusic(MusicService ms)
|
||||||
{
|
//{
|
||||||
_reps.TryAdd("%playing%", () =>
|
// _reps.TryAdd("%playing%", () =>
|
||||||
{
|
// {
|
||||||
var cnt = ms.MusicPlayers.Count(kvp => kvp.Value.Current.Current != null);
|
// var cnt = ms.MusicPlayers.Count(kvp => kvp.Value.Current.Current != null);
|
||||||
if (cnt != 1) return cnt.ToString();
|
// if (cnt != 1) return cnt.ToString();
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
var mp = ms.MusicPlayers.FirstOrDefault();
|
// var mp = ms.MusicPlayers.FirstOrDefault();
|
||||||
var title = mp.Value?.Current.Current?.Title;
|
// var title = mp.Value?.Current.Current?.Title;
|
||||||
return title ?? "No songs";
|
// return title ?? "No songs";
|
||||||
}
|
// }
|
||||||
catch
|
// catch
|
||||||
{
|
// {
|
||||||
return "error";
|
// return "error";
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
_reps.TryAdd("%queued%", () => ms.MusicPlayers.Sum(kvp => kvp.Value.QueueArray().Songs.Length).ToString());
|
// _reps.TryAdd("%queued%", () => ms.MusicPlayers.Sum(kvp => kvp.Value.QueueArray().Songs.Length).ToString());
|
||||||
return this;
|
// return this;
|
||||||
}
|
//}
|
||||||
|
|
||||||
public ReplacementBuilder WithRngRegex()
|
public ReplacementBuilder WithRngRegex()
|
||||||
{
|
{
|
0
src/NadekoBot/Common/ShardCom/ShardComClient.cs → NadekoBot.Core/Common/ShardCom/ShardComClient.cs
0
src/NadekoBot/Common/ShardCom/ShardComClient.cs → NadekoBot.Core/Common/ShardCom/ShardComClient.cs
0
src/NadekoBot/Common/ShardCom/ShardComServer.cs → NadekoBot.Core/Common/ShardCom/ShardComServer.cs
0
src/NadekoBot/Common/ShardCom/ShardComServer.cs → NadekoBot.Core/Common/ShardCom/ShardComServer.cs
@ -3,7 +3,7 @@ using Discord.WebSocket;
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NadekoBot.Services.Discord
|
namespace NadekoBot.Common
|
||||||
{
|
{
|
||||||
public class ReactionEventWrapper : IDisposable
|
public class ReactionEventWrapper : IDisposable
|
||||||
{
|
{
|
73
NadekoBot.Core/Common/TypeReaders/BotCommandTypeReader.cs
Normal file
73
NadekoBot.Core/Common/TypeReaders/BotCommandTypeReader.cs
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Discord.Commands;
|
||||||
|
using NadekoBot.Services;
|
||||||
|
|
||||||
|
namespace NadekoBot.Common.TypeReaders
|
||||||
|
{
|
||||||
|
public class CommandTypeReader : TypeReader
|
||||||
|
{
|
||||||
|
public override Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider services)
|
||||||
|
{
|
||||||
|
var _cmds = ((INServiceProvider)services).GetService<CommandService>();
|
||||||
|
var _cmdHandler = ((INServiceProvider)services).GetService<CommandHandler>();
|
||||||
|
input = input.ToUpperInvariant();
|
||||||
|
var prefix = _cmdHandler.GetPrefix(context.Guild);
|
||||||
|
if (!input.StartsWith(prefix.ToUpperInvariant()))
|
||||||
|
return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "No such command found."));
|
||||||
|
|
||||||
|
input = input.Substring(prefix.Length);
|
||||||
|
|
||||||
|
var cmd = _cmds.Commands.FirstOrDefault(c =>
|
||||||
|
c.Aliases.Select(a => a.ToUpperInvariant()).Contains(input));
|
||||||
|
if (cmd == null)
|
||||||
|
return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "No such command found."));
|
||||||
|
|
||||||
|
return Task.FromResult(TypeReaderResult.FromSuccess(cmd));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//todo dependency on the module
|
||||||
|
//public class CommandOrCrTypeReader : CommandTypeReader
|
||||||
|
//{
|
||||||
|
// public override async Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider services)
|
||||||
|
// {
|
||||||
|
// input = input.ToUpperInvariant();
|
||||||
|
|
||||||
|
// var _crs = ((INServiceProvider)services).GetService<CustomReactionsService>();
|
||||||
|
|
||||||
|
// if (_crs.GlobalReactions.Any(x => x.Trigger.ToUpperInvariant() == input))
|
||||||
|
// {
|
||||||
|
// return TypeReaderResult.FromSuccess(new CommandOrCrInfo(input));
|
||||||
|
// }
|
||||||
|
// var guild = context.Guild;
|
||||||
|
// if (guild != null)
|
||||||
|
// {
|
||||||
|
// if (_crs.GuildReactions.TryGetValue(guild.Id, out var crs))
|
||||||
|
// {
|
||||||
|
// if (crs.Concat(_crs.GlobalReactions).Any(x => x.Trigger.ToUpperInvariant() == input))
|
||||||
|
// {
|
||||||
|
// return TypeReaderResult.FromSuccess(new CommandOrCrInfo(input));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var cmd = await base.Read(context, input, services);
|
||||||
|
// if (cmd.IsSuccess)
|
||||||
|
// {
|
||||||
|
// return TypeReaderResult.FromSuccess(new CommandOrCrInfo(((CommandInfo)cmd.Values.First().Value).Name));
|
||||||
|
// }
|
||||||
|
// return TypeReaderResult.FromError(CommandError.ParseFailed, "No such command or cr found.");
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
public class CommandOrCrInfo
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public CommandOrCrInfo(string input)
|
||||||
|
{
|
||||||
|
this.Name = input;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
40
NadekoBot.Core/Common/TypeReaders/GuildDateTimeTypeReader.cs
Normal file
40
NadekoBot.Core/Common/TypeReaders/GuildDateTimeTypeReader.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
//using System;
|
||||||
|
//using System.Threading.Tasks;
|
||||||
|
//using Discord.Commands;
|
||||||
|
//using NadekoBot.Modules.Administration.Services;
|
||||||
|
|
||||||
|
//namespace NadekoBot.Common.TypeReaders
|
||||||
|
//{
|
||||||
|
// public class GuildDateTimeTypeReader : TypeReader
|
||||||
|
// {
|
||||||
|
// public override Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider services)
|
||||||
|
// {
|
||||||
|
// var _gts = (GuildTimezoneService)services.GetService(typeof(GuildTimezoneService));
|
||||||
|
// if (!DateTime.TryParse(input, out var dt))
|
||||||
|
// return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "Input string is in an incorrect format."));
|
||||||
|
|
||||||
|
// var tz = _gts.GetTimeZoneOrUtc(context.Guild.Id);
|
||||||
|
|
||||||
|
// return Task.FromResult(TypeReaderResult.FromSuccess(new GuildDateTime(tz, dt)));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public class GuildDateTime
|
||||||
|
// {
|
||||||
|
// public TimeZoneInfo Timezone { get; }
|
||||||
|
// public DateTime CurrentGuildTime { get; }
|
||||||
|
// public DateTime InputTime { get; }
|
||||||
|
// public DateTime InputTimeUtc { get; }
|
||||||
|
|
||||||
|
// private GuildDateTime() { }
|
||||||
|
|
||||||
|
// public GuildDateTime(TimeZoneInfo guildTimezone, DateTime inputTime)
|
||||||
|
// {
|
||||||
|
// var now = DateTime.UtcNow;
|
||||||
|
// Timezone = guildTimezone;
|
||||||
|
// CurrentGuildTime = TimeZoneInfo.ConvertTime(now, TimeZoneInfo.Utc, Timezone);
|
||||||
|
// InputTime = inputTime;
|
||||||
|
// InputTimeUtc = TimeZoneInfo.ConvertTime(inputTime, Timezone, TimeZoneInfo.Utc);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
0
src/NadekoBot/Migrations/20161011200458_first.cs → NadekoBot.Core/Migrations/20161011200458_first.cs
0
src/NadekoBot/Migrations/20161011200458_first.cs → NadekoBot.Core/Migrations/20161011200458_first.cs
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user