diff --git a/NadekoBot/Modules/Conversations/Conversations.cs b/NadekoBot/Modules/Conversations/Conversations.cs
index 9c349152..14c9bc10 100644
--- a/NadekoBot/Modules/Conversations/Conversations.cs
+++ b/NadekoBot/Modules/Conversations/Conversations.cs
@@ -1,7 +1,6 @@
using Discord;
using Discord.Commands;
using Discord.Modules;
-using NadekoBot.Classes;
using NadekoBot.Classes.Conversations.Commands;
using NadekoBot.Extensions;
using NadekoBot.Modules.Permissions.Classes;
@@ -489,21 +488,6 @@ namespace NadekoBot.Modules.Conversations
await e.Channel.SendMessage(await usr.AvatarUrl.ShortenUrl());
});
- cgb.CreateCommand("leet")
- .Parameter("level", ParameterType.Required)
- .Parameter("text", ParameterType.Unparsed)
- .Do(async e =>
- {
- var text = e.GetArg("text")?.Trim();
- var levelStr = e.GetArg("level")?.Trim();
- int level;
- if (!int.TryParse(levelStr, out level))
- return;
- if (string.IsNullOrWhiteSpace(text))
- return;
- await e.Channel.SendMessage(text.ToLeet(level));
- });
-
});
}
diff --git a/NadekoBot/Classes/Leet.cs b/NadekoBot/Modules/Games/Commands/LeetCommand.cs
similarity index 88%
rename from NadekoBot/Classes/Leet.cs
rename to NadekoBot/Modules/Games/Commands/LeetCommand.cs
index ec85b3a7..81e5370d 100644
--- a/NadekoBot/Classes/Leet.cs
+++ b/NadekoBot/Modules/Games/Commands/LeetCommand.cs
@@ -1,21 +1,25 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using Discord.Commands;
+using NadekoBot.Classes;
using System.Text;
-using System.Threading.Tasks;
//taken from
//http://www.codeproject.com/Tips/207582/L-t-Tr-nsl-t-r-Leet-Translator (thanks)
// because i don't want to waste my time on this cancerous command
-namespace NadekoBot.Classes {
- public static class Leet {
+namespace NadekoBot.Modules.Games.Commands
+{
+ internal class Leet : DiscordCommand
+ {
+ public Leet(DiscordModule module) : base(module)
+ {
+ }
+
///
/// Translate text to Leet - Extension methods for string class
///
/// Orginal text
/// Degree of translation (1 - 3)
/// Leet translated text
- public static string ToLeet(this string text, int degree = 1) =>
+ public static string ToLeet(string text, int degree = 1) =>
Translate(text, degree);
///
@@ -24,7 +28,8 @@ namespace NadekoBot.Classes {
/// Orginal text
/// Degree of translation (1 - 3)
/// Leet translated text
- public static string Translate(string text, int degree = 1) {
+ public static string Translate(string text, int degree = 1)
+ {
if (degree > 6)
degree = 6;
if (degree <= 0)
@@ -32,10 +37,13 @@ namespace NadekoBot.Classes {
// StringBuilder to store result.
StringBuilder sb = new StringBuilder(text.Length);
- foreach (char c in text) {
+ foreach (char c in text)
+ {
#region Degree 1
- if (degree == 1) {
- switch (c) {
+ if (degree == 1)
+ {
+ switch (c)
+ {
case 'a': sb.Append("4"); break;
case 'e': sb.Append("3"); break;
case 'i': sb.Append("1"); break;
@@ -49,8 +57,10 @@ namespace NadekoBot.Classes {
}
#endregion
#region Degree 2
- else if (degree == 2) {
- switch (c) {
+ else if (degree == 2)
+ {
+ switch (c)
+ {
case 'a': sb.Append("4"); break;
case 'e': sb.Append("3"); break;
case 'i': sb.Append("1"); break;
@@ -76,8 +86,10 @@ namespace NadekoBot.Classes {
}
#endregion
#region Degree 3
- else if (degree == 3) {
- switch (c) {
+ else if (degree == 3)
+ {
+ switch (c)
+ {
case 'a': sb.Append("4"); break;
case 'e': sb.Append("3"); break;
case 'i': sb.Append("1"); break;
@@ -113,8 +125,10 @@ namespace NadekoBot.Classes {
}
#endregion
#region Degree 4
- else if (degree == 4) {
- switch (c) {
+ else if (degree == 4)
+ {
+ switch (c)
+ {
case 'a': sb.Append("4"); break;
case 'e': sb.Append("3"); break;
case 'i': sb.Append("1"); break;
@@ -160,8 +174,10 @@ namespace NadekoBot.Classes {
}
#endregion
#region Degree 5
- else if (degree == 5) {
- switch (c) {
+ else if (degree == 5)
+ {
+ switch (c)
+ {
case 'a': sb.Append("4"); break;
case 'e': sb.Append("3"); break;
case 'i': sb.Append("1"); break;
@@ -215,8 +231,10 @@ namespace NadekoBot.Classes {
}
#endregion
#region Degree 6
- else if (degree == 6) {
- switch (c) {
+ else if (degree == 6)
+ {
+ switch (c)
+ {
case 'a': sb.Append("4"); break;
case 'e': sb.Append("3"); break;
case 'i': sb.Append("1"); break;
@@ -275,5 +293,23 @@ namespace NadekoBot.Classes {
}
return sb.ToString(); // Return result.
}
+
+ internal override void Init(CommandGroupBuilder cgb)
+ {
+ cgb.CreateCommand(Module.Prefix + "leet")
+ .Parameter("level", ParameterType.Required)
+ .Parameter("text", ParameterType.Unparsed)
+ .Do(async e =>
+ {
+ var text = e.GetArg("text")?.Trim();
+ var levelStr = e.GetArg("level")?.Trim();
+ int level;
+ if (!int.TryParse(levelStr, out level))
+ return;
+ if (string.IsNullOrWhiteSpace(text))
+ return;
+ await e.Channel.SendMessage(ToLeet(text, level));
+ });
+ }
}
}
diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj
index 798488db..aabd69d7 100644
--- a/NadekoBot/NadekoBot.csproj
+++ b/NadekoBot/NadekoBot.csproj
@@ -133,7 +133,7 @@
-
+