diff --git a/NadekoBot/Commands/DiscordCommand.cs b/NadekoBot/Commands/DiscordCommand.cs index 56dbffac..9d7c4198 100644 --- a/NadekoBot/Commands/DiscordCommand.cs +++ b/NadekoBot/Commands/DiscordCommand.cs @@ -1,7 +1,5 @@ -using System; -using System.Threading.Tasks; -using Discord; -using Discord.Commands; +using Discord.Commands; +using NadekoBot.Modules; namespace NadekoBot.Commands { @@ -9,31 +7,28 @@ namespace NadekoBot.Commands /// Base DiscordCommand Class. /// Inherit this class to create your own command. /// - public abstract class DiscordCommand + internal abstract class DiscordCommand { - /// - /// Client at the moment of creating this object - /// - public DiscordClient client { get; set; } /// - /// Constructor of the base class + /// Parent module /// - /// CommandBuilder which will be modified - protected DiscordCommand() - { - client = NadekoBot.Client; - } + protected DiscordModule Module { get; } + /// - /// Function containing the behaviour of the command. + /// Creates a new instance of discord command, + /// use ": base(module)" in the derived class' + /// constructor to make sure module is assigned /// - /// Client who will handle the message sending, etc, if any. - /// - public abstract Func DoFunc(); + /// Module this command resides in + protected DiscordCommand(DiscordModule module) + { + this.Module = module; + } /// /// Initializes the CommandBuilder with values using CommandGroupBuilder /// - public abstract void Init(CommandGroupBuilder cgb); + internal abstract void Init(CommandGroupBuilder cgb); } } diff --git a/NadekoBot/Commands/IDiscordCommand.cs b/NadekoBot/Commands/IDiscordCommand.cs deleted file mode 100644 index 8d165f63..00000000 --- a/NadekoBot/Commands/IDiscordCommand.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Discord.Commands; -using NadekoBot.Modules; - -namespace NadekoBot.Commands { - /// - /// Base DiscordCommand Class. - /// Inherit this class to create your own command. - /// - internal abstract class DiscordCommand { - - /// - /// Parent module - /// - protected DiscordModule Module { get; } - - /// - /// Creates a new instance of discord command, - /// use ": base(module)" in the derived class' - /// constructor to make sure module is assigned - /// - /// Module this command resides in - protected DiscordCommand(DiscordModule module) { - this.Module = module; - } - - /// - /// Initializes the CommandBuilder with values using CommandGroupBuilder - /// - internal abstract void Init(CommandGroupBuilder cgb); - } -} diff --git a/NadekoBot/Modules/Search/Commands/ConverterCommand.cs b/NadekoBot/Modules/Searches/Commands/ConverterCommand.cs similarity index 99% rename from NadekoBot/Modules/Search/Commands/ConverterCommand.cs rename to NadekoBot/Modules/Searches/Commands/ConverterCommand.cs index bb08c5af..baf53e5e 100644 --- a/NadekoBot/Modules/Search/Commands/ConverterCommand.cs +++ b/NadekoBot/Modules/Searches/Commands/ConverterCommand.cs @@ -7,7 +7,7 @@ using System.Globalization; using System.Threading; using System.Threading.Tasks; -namespace NadekoBot.Modules.Search.Commands +namespace NadekoBot.Modules.Searches.Commands { class ConverterCommand : DiscordCommand { diff --git a/NadekoBot/Commands/LoLCommands.cs b/NadekoBot/Modules/Searches/Commands/LoLCommands.cs similarity index 99% rename from NadekoBot/Commands/LoLCommands.cs rename to NadekoBot/Modules/Searches/Commands/LoLCommands.cs index 4b706745..68db5c36 100644 --- a/NadekoBot/Commands/LoLCommands.cs +++ b/NadekoBot/Modules/Searches/Commands/LoLCommands.cs @@ -1,7 +1,7 @@ using Discord.Commands; using NadekoBot.Classes; +using NadekoBot.Commands; using NadekoBot.Extensions; -using NadekoBot.Modules; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -10,7 +10,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace NadekoBot.Commands +namespace NadekoBot.Modules.Searches.Commands { internal class LoLCommands : DiscordCommand { @@ -108,7 +108,8 @@ namespace NadekoBot.Commands return; } } - else { + else + { data = allData[0]; role = allData[0]["role"].ToString(); resolvedRole = ResolvePos(role); diff --git a/NadekoBot/Modules/Searches/Commands/RedditCommand.cs b/NadekoBot/Modules/Searches/Commands/RedditCommand.cs new file mode 100644 index 00000000..c40da49e --- /dev/null +++ b/NadekoBot/Modules/Searches/Commands/RedditCommand.cs @@ -0,0 +1,18 @@ +using Discord.Commands; +using NadekoBot.Commands; +using System; + +namespace NadekoBot.Modules.Searches.Commands +{ + class RedditCommand : DiscordCommand + { + public RedditCommand(DiscordModule module) : base(module) + { + } + + internal override void Init(CommandGroupBuilder cgb) + { + throw new NotImplementedException(); + } + } +} diff --git a/NadekoBot/Commands/StreamNotifications.cs b/NadekoBot/Modules/Searches/Commands/StreamNotifications.cs similarity index 99% rename from NadekoBot/Commands/StreamNotifications.cs rename to NadekoBot/Modules/Searches/Commands/StreamNotifications.cs index 60afd8d8..79c7ef98 100644 --- a/NadekoBot/Commands/StreamNotifications.cs +++ b/NadekoBot/Modules/Searches/Commands/StreamNotifications.cs @@ -2,7 +2,7 @@ using NadekoBot.Classes; using NadekoBot.Classes.JSONModels; using NadekoBot.Classes.Permissions; -using NadekoBot.Modules; +using NadekoBot.Commands; using Newtonsoft.Json.Linq; using System; using System.Collections.Concurrent; @@ -10,7 +10,7 @@ using System.Linq; using System.Threading.Tasks; using System.Timers; -namespace NadekoBot.Commands +namespace NadekoBot.Modules.Searches.Commands { internal class StreamNotifications : DiscordCommand { diff --git a/NadekoBot/Modules/Searches.cs b/NadekoBot/Modules/Searches/Searches.cs similarity index 99% rename from NadekoBot/Modules/Searches.cs rename to NadekoBot/Modules/Searches/Searches.cs index 07a3435e..847d5926 100644 --- a/NadekoBot/Modules/Searches.cs +++ b/NadekoBot/Modules/Searches/Searches.cs @@ -3,9 +3,8 @@ using Discord.Modules; using NadekoBot.Classes; using NadekoBot.Classes.IMDB; using NadekoBot.Classes.JSONModels; -using NadekoBot.Commands; using NadekoBot.Extensions; -using NadekoBot.Modules.Search.Commands; +using NadekoBot.Modules.Searches.Commands; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; @@ -15,7 +14,7 @@ using System.IO; using System.Linq; using System.Net; -namespace NadekoBot.Modules +namespace NadekoBot.Modules.Searches { internal class Searches : DiscordModule { @@ -25,6 +24,7 @@ namespace NadekoBot.Modules commands.Add(new LoLCommands(this)); commands.Add(new StreamNotifications(this)); commands.Add(new ConverterCommand(this)); + commands.Add(new RedditCommand(this)); rng = new Random(); } diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index 59d6a718..eb596fca 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -170,10 +170,10 @@ - + - + @@ -205,8 +205,9 @@ - - + + +