Refactored Searches
This commit is contained in:
parent
73cda7336a
commit
eeaf4c4920
@ -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.
|
||||
/// </summary>
|
||||
public abstract class DiscordCommand
|
||||
internal abstract class DiscordCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Client at the moment of creating this object
|
||||
/// </summary>
|
||||
public DiscordClient client { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor of the base class
|
||||
/// Parent module
|
||||
/// </summary>
|
||||
/// <param name="cb">CommandBuilder which will be modified</param>
|
||||
protected DiscordCommand()
|
||||
{
|
||||
client = NadekoBot.Client;
|
||||
}
|
||||
protected DiscordModule Module { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <param name="client">Client who will handle the message sending, etc, if any.</param>
|
||||
/// <returns></returns>
|
||||
public abstract Func<CommandEventArgs,Task> DoFunc();
|
||||
/// <param name="module">Module this command resides in</param>
|
||||
protected DiscordCommand(DiscordModule module)
|
||||
{
|
||||
this.Module = module;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the CommandBuilder with values using CommandGroupBuilder
|
||||
/// </summary>
|
||||
public abstract void Init(CommandGroupBuilder cgb);
|
||||
internal abstract void Init(CommandGroupBuilder cgb);
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
/// <summary>
|
||||
/// Base DiscordCommand Class.
|
||||
/// Inherit this class to create your own command.
|
||||
/// </summary>
|
||||
internal abstract class DiscordCommand {
|
||||
|
||||
/// <summary>
|
||||
/// Parent module
|
||||
/// </summary>
|
||||
protected DiscordModule Module { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of discord command,
|
||||
/// use ": base(module)" in the derived class'
|
||||
/// constructor to make sure module is assigned
|
||||
/// </summary>
|
||||
/// <param name="module">Module this command resides in</param>
|
||||
protected DiscordCommand(DiscordModule module) {
|
||||
this.Module = module;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the CommandBuilder with values using CommandGroupBuilder
|
||||
/// </summary>
|
||||
internal abstract void Init(CommandGroupBuilder cgb);
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
@ -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);
|
18
NadekoBot/Modules/Searches/Commands/RedditCommand.cs
Normal file
18
NadekoBot/Modules/Searches/Commands/RedditCommand.cs
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
@ -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();
|
||||
}
|
||||
|
@ -170,10 +170,10 @@
|
||||
<Compile Include="Commands\FilterWordsCommand.cs" />
|
||||
<Compile Include="Commands\FilterInvitesCommand.cs" />
|
||||
<Compile Include="Modules\Administration\Commands\LogCommand.cs" />
|
||||
<Compile Include="Commands\LoLCommands.cs" />
|
||||
<Compile Include="Modules\Searches\Commands\LoLCommands.cs" />
|
||||
<Compile Include="Modules\Administration\Commands\MessageRepeater.cs" />
|
||||
<Compile Include="Modules\Administration\Commands\PlayingRotate.cs" />
|
||||
<Compile Include="Commands\StreamNotifications.cs" />
|
||||
<Compile Include="Modules\Searches\Commands\StreamNotifications.cs" />
|
||||
<Compile Include="Commands\TriviaCommand.cs" />
|
||||
<Compile Include="Classes\Trivia\TriviaGame.cs" />
|
||||
<Compile Include="Classes\Trivia\TriviaQuestion.cs" />
|
||||
@ -205,8 +205,9 @@
|
||||
<Compile Include="Modules\Administration\Commands\RatelimitCommand.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonModule.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokeStats.cs" />
|
||||
<Compile Include="Modules\Searches.cs" />
|
||||
<Compile Include="Modules\Search\Commands\ConverterCommand.cs" />
|
||||
<Compile Include="Modules\Searches\Searches.cs" />
|
||||
<Compile Include="Modules\Searches\Commands\ConverterCommand.cs" />
|
||||
<Compile Include="Modules\Searches\Commands\RedditCommand.cs" />
|
||||
<Compile Include="Modules\Translator\Helpers\GoogleTranslator.cs" />
|
||||
<Compile Include="Modules\Translator\TranslateCommand.cs" />
|
||||
<Compile Include="Modules\Translator\TranslatorModule.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user