diff --git a/NadekoBot/Classes/DiscordCommand.cs b/NadekoBot/Classes/DiscordCommand.cs
index 9d7c4198..c6fa8b78 100644
--- a/NadekoBot/Classes/DiscordCommand.cs
+++ b/NadekoBot/Classes/DiscordCommand.cs
@@ -1,7 +1,7 @@
using Discord.Commands;
using NadekoBot.Modules;
-namespace NadekoBot.Commands
+namespace NadekoBot.Classes
{
///
/// Base DiscordCommand Class.
diff --git a/NadekoBot/Modules/Administration/AdministrationModule.cs b/NadekoBot/Modules/Administration/AdministrationModule.cs
index f209c7de..b09c61be 100644
--- a/NadekoBot/Modules/Administration/AdministrationModule.cs
+++ b/NadekoBot/Modules/Administration/AdministrationModule.cs
@@ -3,9 +3,9 @@ using Discord.Commands;
using Discord.Modules;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels;
-using NadekoBot.Classes.Permissions;
using NadekoBot.Extensions;
using NadekoBot.Modules.Administration.Commands;
+using NadekoBot.Modules.Permissions.Classes;
using Newtonsoft.Json.Linq;
using System;
using System.IO;
diff --git a/NadekoBot/Modules/Administration/Commands/CrossServerTextChannel.cs b/NadekoBot/Modules/Administration/Commands/CrossServerTextChannel.cs
index b11dce4d..0bce140c 100644
--- a/NadekoBot/Modules/Administration/Commands/CrossServerTextChannel.cs
+++ b/NadekoBot/Modules/Administration/Commands/CrossServerTextChannel.cs
@@ -1,7 +1,7 @@
using Discord;
using Discord.Commands;
-using NadekoBot.Classes.Permissions;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
diff --git a/NadekoBot/Modules/Administration/Commands/InfoCommands.cs b/NadekoBot/Modules/Administration/Commands/InfoCommands.cs
index 8ac14a05..babcfdd3 100644
--- a/NadekoBot/Modules/Administration/Commands/InfoCommands.cs
+++ b/NadekoBot/Modules/Administration/Commands/InfoCommands.cs
@@ -1,6 +1,6 @@
using Discord;
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using NadekoBot.Extensions;
using System;
using System.Linq;
diff --git a/NadekoBot/Modules/Administration/Commands/LogCommand.cs b/NadekoBot/Modules/Administration/Commands/LogCommand.cs
index 6bea42b7..c4b3d1fa 100644
--- a/NadekoBot/Modules/Administration/Commands/LogCommand.cs
+++ b/NadekoBot/Modules/Administration/Commands/LogCommand.cs
@@ -1,8 +1,8 @@
using Discord;
using Discord.Commands;
using NadekoBot.Classes;
-using NadekoBot.Classes.Permissions;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Collections.Concurrent;
using System.Linq;
diff --git a/NadekoBot/Modules/Administration/Commands/MessageRepeater.cs b/NadekoBot/Modules/Administration/Commands/MessageRepeater.cs
index a511479b..873bf5d3 100644
--- a/NadekoBot/Modules/Administration/Commands/MessageRepeater.cs
+++ b/NadekoBot/Modules/Administration/Commands/MessageRepeater.cs
@@ -1,7 +1,7 @@
using Discord;
using Discord.Commands;
-using NadekoBot.Classes.Permissions;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Collections.Concurrent;
using System.Timers;
diff --git a/NadekoBot/Modules/Administration/Commands/PlayingRotate.cs b/NadekoBot/Modules/Administration/Commands/PlayingRotate.cs
index 81a2d5d0..f7f37e9e 100644
--- a/NadekoBot/Modules/Administration/Commands/PlayingRotate.cs
+++ b/NadekoBot/Modules/Administration/Commands/PlayingRotate.cs
@@ -1,8 +1,8 @@
using Discord.Commands;
using NadekoBot.Classes.JSONModels;
-using NadekoBot.Commands;
-using NadekoBot.Modules.Games.Commands;
+using NadekoBot.Classes;
using NadekoBot.Modules.Music;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Administration.Commands
}
},
{"%queued%", () => MusicModule.MusicPlayers.Sum(kvp => kvp.Value.Playlist.Count).ToString()},
- {"%trivia%", () => Trivia.RunningTrivias.Count.ToString()}
+ {"%trivia%", () => Games.Commands.TriviaCommands.RunningTrivias.Count.ToString()}
};
private readonly object playingPlaceholderLock = new object();
@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Administration.Commands
cgb.CreateCommand(Module.Prefix + "rotateplaying")
.Alias(Module.Prefix + "ropl")
.Description("Toggles rotation of playing status of the dynamic strings you specified earlier.")
- .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
+ .AddCheck(SimpleCheckers.OwnerOnly())
.Do(DoFunc());
cgb.CreateCommand(Module.Prefix + "addplaying")
@@ -97,7 +97,7 @@ namespace NadekoBot.Modules.Administration.Commands
.Description("Adds a specified string to the list of playing strings to rotate. " +
"Supported placeholders: " + string.Join(", ", PlayingPlaceholders.Keys))
.Parameter("text", ParameterType.Unparsed)
- .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
+ .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e =>
{
var arg = e.GetArg("text");
@@ -114,7 +114,7 @@ namespace NadekoBot.Modules.Administration.Commands
cgb.CreateCommand(Module.Prefix + "listplaying")
.Alias(Module.Prefix + "lipl")
.Description("Lists all playing statuses with their corresponding number.")
- .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
+ .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e =>
{
if (NadekoBot.Config.RotatingStatuses.Count == 0)
@@ -132,7 +132,7 @@ namespace NadekoBot.Modules.Administration.Commands
.Alias(Module.Prefix + "repl", Module.Prefix + "rmpl")
.Description("Removes a playing string on a given number.")
.Parameter("number", ParameterType.Required)
- .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
+ .AddCheck(SimpleCheckers.OwnerOnly())
.Do(async e =>
{
var arg = e.GetArg("number");
diff --git a/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs b/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs
index 61736edb..73087bea 100644
--- a/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs
+++ b/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs
@@ -1,6 +1,6 @@
using Discord.Commands;
-using NadekoBot.Classes.Permissions;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Collections.Concurrent;
diff --git a/NadekoBot/Modules/Administration/Commands/Remind.cs b/NadekoBot/Modules/Administration/Commands/Remind.cs
index c59e1e22..54a82193 100644
--- a/NadekoBot/Modules/Administration/Commands/Remind.cs
+++ b/NadekoBot/Modules/Administration/Commands/Remind.cs
@@ -2,7 +2,7 @@
using Discord.Commands;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs b/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs
index 40a31f13..36d6aeea 100644
--- a/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs
+++ b/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs
@@ -1,7 +1,7 @@
using Discord.Commands;
using NadekoBot.Classes;
-using NadekoBot.Classes.Permissions;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
+using NadekoBot.Modules.Permissions.Classes;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -27,7 +27,8 @@ namespace NadekoBot.Modules.Administration.Commands
var role = e.Server.FindRoles(arg.Trim()).FirstOrDefault();
if (role == null)
msg.AppendLine($":anger:Role **{arg}** not found.");
- else {
+ else
+ {
if (config.ListOfSelfAssignableRoles.Contains(role.Id))
{
msg.AppendLine($":anger:Role **{role.Name}** is already in the list.");
@@ -81,7 +82,8 @@ namespace NadekoBot.Modules.Administration.Commands
msg.Append($"`{roleId} not found. Cleaned up.`, ");
toRemove.Add(roleId);
}
- else {
+ else
+ {
msg.Append($"**{role.Name}**, ");
}
}
diff --git a/NadekoBot/Modules/Administration/Commands/ServerGreetCommand.cs b/NadekoBot/Modules/Administration/Commands/ServerGreetCommand.cs
index 490e9e75..797f7a46 100644
--- a/NadekoBot/Modules/Administration/Commands/ServerGreetCommand.cs
+++ b/NadekoBot/Modules/Administration/Commands/ServerGreetCommand.cs
@@ -1,6 +1,6 @@
using Discord;
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using System.Collections.Concurrent;
using System.Linq;
using System.Threading.Tasks;
diff --git a/NadekoBot/Modules/Administration/Commands/VoiceNotificationCommand.cs b/NadekoBot/Modules/Administration/Commands/VoiceNotificationCommand.cs
index e6bd0529..989a3901 100644
--- a/NadekoBot/Modules/Administration/Commands/VoiceNotificationCommand.cs
+++ b/NadekoBot/Modules/Administration/Commands/VoiceNotificationCommand.cs
@@ -1,6 +1,6 @@
using Discord;
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using System;
using System.Collections.Concurrent;
using System.Linq;
diff --git a/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs b/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs
index 78f88844..7e90aa62 100644
--- a/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs
+++ b/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs
@@ -1,8 +1,8 @@
using Discord;
using Discord.Commands;
using NadekoBot.Classes;
-using NadekoBot.Classes.Permissions;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Linq;
using ChPermOverride = Discord.ChannelPermissionOverrides;
diff --git a/NadekoBot/Modules/Conversations/Commands/CopyCommand.cs b/NadekoBot/Modules/Conversations/Commands/CopyCommand.cs
index 6bba9c45..9afbd0b1 100644
--- a/NadekoBot/Modules/Conversations/Commands/CopyCommand.cs
+++ b/NadekoBot/Modules/Conversations/Commands/CopyCommand.cs
@@ -4,7 +4,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-namespace NadekoBot.Commands.Conversations.Commands
+namespace NadekoBot.Classes.Conversations.Commands
{
internal class CopyCommand : DiscordCommand
{
diff --git a/NadekoBot/Modules/Conversations/Commands/RequestsCommand.cs b/NadekoBot/Modules/Conversations/Commands/RequestsCommand.cs
index 57d7b2b8..98c2d8ff 100644
--- a/NadekoBot/Modules/Conversations/Commands/RequestsCommand.cs
+++ b/NadekoBot/Modules/Conversations/Commands/RequestsCommand.cs
@@ -4,7 +4,7 @@ using NadekoBot.Modules;
using System;
using System.Threading.Tasks;
-namespace NadekoBot.Commands.Conversations.Commands
+namespace NadekoBot.Classes.Conversations.Commands
{
internal class RequestsCommand : DiscordCommand
{
diff --git a/NadekoBot/Modules/Conversations/Conversations.cs b/NadekoBot/Modules/Conversations/Conversations.cs
index 62f28a00..10fb21ca 100644
--- a/NadekoBot/Modules/Conversations/Conversations.cs
+++ b/NadekoBot/Modules/Conversations/Conversations.cs
@@ -2,8 +2,9 @@ using Discord;
using Discord.Commands;
using Discord.Modules;
using NadekoBot.Classes;
-using NadekoBot.Commands.Conversations.Commands;
+using NadekoBot.Classes.Conversations.Commands;
using NadekoBot.Extensions;
+using NadekoBot.Modules.Permissions.Classes;
using NadekoBot.Properties;
using System;
using System.Diagnostics;
@@ -32,7 +33,7 @@ namespace NadekoBot.Modules.Conversations
manager.CreateCommands("", cgb =>
{
- cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
+ cgb.AddCheck(PermissionChecker.Instance);
cgb.CreateCommand("e")
.Description("You did it. Or someone else!")
@@ -123,7 +124,7 @@ namespace NadekoBot.Modules.Conversations
{
var client = manager.Client;
- cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
+ cgb.AddCheck(PermissionChecker.Instance);
commands.ForEach(cmd => cmd.Init(cgb));
diff --git a/NadekoBot/Modules/DiscordModule.cs b/NadekoBot/Modules/DiscordModule.cs
index 2aa21554..48427732 100644
--- a/NadekoBot/Modules/DiscordModule.cs
+++ b/NadekoBot/Modules/DiscordModule.cs
@@ -1,6 +1,6 @@
using Discord.Modules;
using System.Collections.Generic;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
namespace NadekoBot.Modules {
internal abstract class DiscordModule : IModule {
diff --git a/NadekoBot/Modules/Gambling/DiceRollCommand.cs b/NadekoBot/Modules/Gambling/DiceRollCommand.cs
index 7e8ae39a..1839a718 100644
--- a/NadekoBot/Modules/Gambling/DiceRollCommand.cs
+++ b/NadekoBot/Modules/Gambling/DiceRollCommand.cs
@@ -1,5 +1,5 @@
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using NadekoBot.Extensions;
using System;
using System.Collections.Generic;
diff --git a/NadekoBot/Modules/Gambling/DrawCommand.cs b/NadekoBot/Modules/Gambling/DrawCommand.cs
index 4ba3920e..f73cf45e 100644
--- a/NadekoBot/Modules/Gambling/DrawCommand.cs
+++ b/NadekoBot/Modules/Gambling/DrawCommand.cs
@@ -1,5 +1,5 @@
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using NadekoBot.Extensions;
using NadekoBot.Modules.Gambling.Helpers;
using System;
diff --git a/NadekoBot/Modules/Gambling/FlipCoinCommand.cs b/NadekoBot/Modules/Gambling/FlipCoinCommand.cs
index 1f6f31a3..752381ad 100644
--- a/NadekoBot/Modules/Gambling/FlipCoinCommand.cs
+++ b/NadekoBot/Modules/Gambling/FlipCoinCommand.cs
@@ -1,5 +1,5 @@
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using NadekoBot.Extensions;
using System;
using System.Drawing;
diff --git a/NadekoBot/Modules/Gambling/GamblingModule.cs b/NadekoBot/Modules/Gambling/GamblingModule.cs
index 8fe25f16..b92b2e4e 100644
--- a/NadekoBot/Modules/Gambling/GamblingModule.cs
+++ b/NadekoBot/Modules/Gambling/GamblingModule.cs
@@ -3,6 +3,7 @@ using Discord.Commands;
using Discord.Modules;
using NadekoBot.Classes;
using NadekoBot.Extensions;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Linq;
using System.Threading.Tasks;
@@ -25,7 +26,7 @@ namespace NadekoBot.Modules.Gambling
{
manager.CreateCommands("", cgb =>
{
- cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
+ cgb.AddCheck(PermissionChecker.Instance);
commands.ForEach(com => com.Init(cgb));
@@ -72,7 +73,7 @@ namespace NadekoBot.Modules.Gambling
cgb.CreateCommand(Prefix + "award")
.Description("Gives someone a certain amount of flowers. **Owner only!**")
- .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
+ .AddCheck(SimpleCheckers.OwnerOnly())
.Parameter("amount", ParameterType.Required)
.Parameter("receiver", ParameterType.Unparsed)
.Do(async e =>
@@ -94,7 +95,7 @@ namespace NadekoBot.Modules.Gambling
cgb.CreateCommand(Prefix + "take")
.Description("Takes a certain amount of flowers from someone. **Owner only!**")
- .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
+ .AddCheck(SimpleCheckers.OwnerOnly())
.Parameter("amount", ParameterType.Required)
.Parameter("rektperson", ParameterType.Unparsed)
.Do(async e =>
@@ -144,9 +145,9 @@ namespace NadekoBot.Modules.Gambling
await e.Channel.SendMessage("💢 Role not found.");
return;
}
- var members = role.Members.Where(u => u.Status == Discord.UserStatus.Online); // only online
+ var members = role.Members.Where(u => u.Status == UserStatus.Online); // only online
var membersArray = members as User[] ?? members.ToArray();
- var usr = membersArray[new System.Random().Next(0, membersArray.Length)];
+ var usr = membersArray[new Random().Next(0, membersArray.Length)];
await e.Channel.SendMessage($"**Raffled user:** {usr.Name} (id: {usr.Id})");
};
}
diff --git a/NadekoBot/Modules/Games/Commands/BetrayGame.cs b/NadekoBot/Modules/Games/Commands/BetrayGame.cs
index a6afa872..b4db5049 100644
--- a/NadekoBot/Modules/Games/Commands/BetrayGame.cs
+++ b/NadekoBot/Modules/Games/Commands/BetrayGame.cs
@@ -1,5 +1,5 @@
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
diff --git a/NadekoBot/Modules/Games/Commands/Bomberman.cs b/NadekoBot/Modules/Games/Commands/Bomberman.cs
index fe6c882d..3831b323 100644
--- a/NadekoBot/Modules/Games/Commands/Bomberman.cs
+++ b/NadekoBot/Modules/Games/Commands/Bomberman.cs
@@ -1,6 +1,6 @@
using Discord;
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using System.Text;
using System.Timers;
using static NadekoBot.Modules.Games.Commands.Bomberman;
diff --git a/NadekoBot/Modules/Games/Commands/PlantPick.cs b/NadekoBot/Modules/Games/Commands/PlantPick.cs
index 8b3f9646..d141b019 100644
--- a/NadekoBot/Modules/Games/Commands/PlantPick.cs
+++ b/NadekoBot/Modules/Games/Commands/PlantPick.cs
@@ -1,7 +1,7 @@
using Discord;
using Discord.Commands;
using NadekoBot.Classes;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using System;
using System.Collections.Concurrent;
using System.IO;
diff --git a/NadekoBot/Modules/Games/Commands/PollCommand.cs b/NadekoBot/Modules/Games/Commands/PollCommand.cs
index 5feccf1d..d803b29b 100644
--- a/NadekoBot/Modules/Games/Commands/PollCommand.cs
+++ b/NadekoBot/Modules/Games/Commands/PollCommand.cs
@@ -1,6 +1,6 @@
using Discord;
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
diff --git a/NadekoBot/Modules/Games/Commands/SpeedTyping.cs b/NadekoBot/Modules/Games/Commands/SpeedTyping.cs
index 28fb5f8a..1337f78a 100644
--- a/NadekoBot/Modules/Games/Commands/SpeedTyping.cs
+++ b/NadekoBot/Modules/Games/Commands/SpeedTyping.cs
@@ -2,7 +2,7 @@
using Discord.Commands;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using NadekoBot.Extensions;
using System;
using System.Collections.Concurrent;
diff --git a/NadekoBot/Classes/Trivia/TriviaGame.cs b/NadekoBot/Modules/Games/Commands/Trivia/TriviaGame.cs
similarity index 97%
rename from NadekoBot/Classes/Trivia/TriviaGame.cs
rename to NadekoBot/Modules/Games/Commands/Trivia/TriviaGame.cs
index 4729d95e..4c4a0935 100644
--- a/NadekoBot/Classes/Trivia/TriviaGame.cs
+++ b/NadekoBot/Modules/Games/Commands/Trivia/TriviaGame.cs
@@ -1,5 +1,6 @@
using Discord;
using Discord.Commands;
+using NadekoBot.Classes;
using NadekoBot.Extensions;
using System;
using System.Collections.Concurrent;
@@ -9,7 +10,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
-namespace NadekoBot.Classes.Trivia
+namespace NadekoBot.Modules.Games.Commands.Trivia
{
internal class TriviaGame
{
@@ -96,7 +97,7 @@ namespace NadekoBot.Classes.Trivia
ShouldStopGame = true;
await channel.SendMessage("**Trivia game ended**\n" + GetLeaderboard());
TriviaGame throwAwayValue;
- Modules.Games.Commands.Trivia.RunningTrivias.TryRemove(server.Id, out throwAwayValue);
+ TriviaCommands.RunningTrivias.TryRemove(server.Id, out throwAwayValue);
}
public async Task StopGame()
diff --git a/NadekoBot/Classes/Trivia/TriviaQuestion.cs b/NadekoBot/Modules/Games/Commands/Trivia/TriviaQuestion.cs
similarity index 81%
rename from NadekoBot/Classes/Trivia/TriviaQuestion.cs
rename to NadekoBot/Modules/Games/Commands/Trivia/TriviaQuestion.cs
index ab1dbf69..9bfa2da4 100644
--- a/NadekoBot/Classes/Trivia/TriviaQuestion.cs
+++ b/NadekoBot/Modules/Games/Commands/Trivia/TriviaQuestion.cs
@@ -4,8 +4,10 @@ using System.Collections.Generic;
using System.Text.RegularExpressions;
// THANKS @ShoMinamimoto for suggestions and coding help
-namespace NadekoBot.Classes.Trivia {
- public class TriviaQuestion {
+namespace NadekoBot.Modules.Games.Commands.Trivia
+{
+ public class TriviaQuestion
+ {
//represents the min size to judge levDistance with
private static readonly HashSet> strictness = new HashSet> {
new Tuple(9, 0),
@@ -19,7 +21,8 @@ namespace NadekoBot.Classes.Trivia {
public string Question;
public string Answer;
- public TriviaQuestion(string q, string a, string c) {
+ public TriviaQuestion(string q, string a, string c)
+ {
this.Question = q;
this.Answer = a;
this.Category = c;
@@ -27,14 +30,17 @@ namespace NadekoBot.Classes.Trivia {
public string GetHint() => Answer.Scramble();
- public bool IsAnswerCorrect(string guess) {
+ public bool IsAnswerCorrect(string guess)
+ {
guess = CleanGuess(guess);
- if (Answer.Equals(guess)) {
+ if (Answer.Equals(guess))
+ {
return true;
}
Answer = CleanGuess(Answer);
guess = CleanGuess(guess);
- if (Answer.Equals(guess)) {
+ if (Answer.Equals(guess))
+ {
return true;
}
@@ -42,9 +48,12 @@ namespace NadekoBot.Classes.Trivia {
return JudgeGuess(Answer.Length, guess.Length, levDistance);
}
- private bool JudgeGuess(int guessLength, int answerLength, int levDistance) {
- foreach (Tuple level in strictness) {
- if (guessLength <= level.Item1 || answerLength <= level.Item1) {
+ private bool JudgeGuess(int guessLength, int answerLength, int levDistance)
+ {
+ foreach (Tuple level in strictness)
+ {
+ if (guessLength <= level.Item1 || answerLength <= level.Item1)
+ {
if (levDistance <= level.Item2)
return true;
else
@@ -54,7 +63,8 @@ namespace NadekoBot.Classes.Trivia {
return false;
}
- private string CleanGuess(string str) {
+ private string CleanGuess(string str)
+ {
str = " " + str.ToLower() + " ";
str = Regex.Replace(str, "\\s+", " ");
str = Regex.Replace(str, "[^\\w\\d\\s]", "");
diff --git a/NadekoBot/Classes/Trivia/TriviaQuestionPool.cs b/NadekoBot/Modules/Games/Commands/Trivia/TriviaQuestionPool.cs
similarity index 79%
rename from NadekoBot/Classes/Trivia/TriviaQuestionPool.cs
rename to NadekoBot/Modules/Games/Commands/Trivia/TriviaQuestionPool.cs
index 5733ba2f..3aa09a56 100644
--- a/NadekoBot/Classes/Trivia/TriviaQuestionPool.cs
+++ b/NadekoBot/Modules/Games/Commands/Trivia/TriviaQuestionPool.cs
@@ -4,8 +4,10 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
-namespace NadekoBot.Classes.Trivia {
- public class TriviaQuestionPool {
+namespace NadekoBot.Modules.Games.Commands.Trivia
+{
+ public class TriviaQuestionPool
+ {
public static TriviaQuestionPool Instance { get; } = new TriviaQuestionPool();
public HashSet pool = new HashSet();
@@ -14,20 +16,24 @@ namespace NadekoBot.Classes.Trivia {
static TriviaQuestionPool() { }
- private TriviaQuestionPool() {
+ private TriviaQuestionPool()
+ {
Reload();
}
- public TriviaQuestion GetRandomQuestion(IEnumerable exclude) {
+ public TriviaQuestion GetRandomQuestion(IEnumerable exclude)
+ {
var list = pool.Except(exclude).ToList();
var rand = rng.Next(0, list.Count);
return list[rand];
}
- internal void Reload() {
+ internal void Reload()
+ {
var arr = JArray.Parse(File.ReadAllText("data/questions.json"));
- foreach (var item in arr) {
+ foreach (var item in arr)
+ {
var tq = new TriviaQuestion(item["Question"].ToString(), item["Answer"].ToString(), item["Category"]?.ToString());
pool.Add(tq);
}
diff --git a/NadekoBot/Modules/Games/Commands/TriviaCommand.cs b/NadekoBot/Modules/Games/Commands/TriviaCommand.cs
index eddb5e6c..2935c3be 100644
--- a/NadekoBot/Modules/Games/Commands/TriviaCommand.cs
+++ b/NadekoBot/Modules/Games/Commands/TriviaCommand.cs
@@ -1,15 +1,19 @@
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
+using NadekoBot.Modules.Games.Commands.Trivia;
using System.Collections.Concurrent;
using System.Linq;
-using TriviaGame = NadekoBot.Classes.Trivia.TriviaGame;
namespace NadekoBot.Modules.Games.Commands
{
- internal class Trivia : DiscordCommand
+ internal class TriviaCommands : DiscordCommand
{
public static ConcurrentDictionary RunningTrivias = new ConcurrentDictionary();
+ public TriviaCommands(DiscordModule module) : base(module)
+ {
+ }
+
internal override void Init(CommandGroupBuilder cgb)
{
cgb.CreateCommand(Module.Prefix + "t")
@@ -57,7 +61,5 @@ namespace NadekoBot.Modules.Games.Commands
await e.Channel.SendMessage("No trivia is running on this server.");
});
}
-
- public Trivia(DiscordModule module) : base(module) { }
}
}
diff --git a/NadekoBot/Modules/Games/GamesModule.cs b/NadekoBot/Modules/Games/GamesModule.cs
index 14c13917..e22b5ccf 100644
--- a/NadekoBot/Modules/Games/GamesModule.cs
+++ b/NadekoBot/Modules/Games/GamesModule.cs
@@ -1,8 +1,8 @@
using Discord.Commands;
using Discord.Modules;
-using NadekoBot.Commands;
using NadekoBot.Extensions;
using NadekoBot.Modules.Games.Commands;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Linq;
@@ -14,7 +14,7 @@ namespace NadekoBot.Modules.Games
public GamesModule()
{
- commands.Add(new Trivia(this));
+ commands.Add(new TriviaCommands(this));
commands.Add(new SpeedTyping(this));
commands.Add(new PollCommand(this));
commands.Add(new PlantPick(this));
@@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Games
manager.CreateCommands("", cgb =>
{
- cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
+ cgb.AddCheck(PermissionChecker.Instance);
commands.ForEach(cmd => cmd.Init(cgb));
diff --git a/NadekoBot/Modules/Help/Commands/HelpCommand.cs b/NadekoBot/Modules/Help/Commands/HelpCommand.cs
index 9c8aedac..359fe4c7 100644
--- a/NadekoBot/Modules/Help/Commands/HelpCommand.cs
+++ b/NadekoBot/Modules/Help/Commands/HelpCommand.cs
@@ -1,12 +1,13 @@
using Discord.Commands;
using NadekoBot.Extensions;
using NadekoBot.Modules;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
-namespace NadekoBot.Commands.Help.Commands
+namespace NadekoBot.Classes.Help.Commands
{
internal class HelpCommand : DiscordCommand
{
@@ -104,7 +105,7 @@ Version: `{NadekoStats.Instance.BotVersion}`";
.Do(DoFunc());
cgb.CreateCommand(Module.Prefix + "hgit")
.Description("Generates the commandlist.md file. **Owner Only!**")
- .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
+ .AddCheck(SimpleCheckers.OwnerOnly())
.Do(DoGitFunc());
cgb.CreateCommand(Module.Prefix + "readme")
.Alias(Module.Prefix + "guide")
diff --git a/NadekoBot/Modules/Help/HelpModule.cs b/NadekoBot/Modules/Help/HelpModule.cs
index 07b48524..8f5bca14 100644
--- a/NadekoBot/Modules/Help/HelpModule.cs
+++ b/NadekoBot/Modules/Help/HelpModule.cs
@@ -1,7 +1,8 @@
using Discord.Commands;
using Discord.Modules;
-using NadekoBot.Commands.Help.Commands;
+using NadekoBot.Classes.Help.Commands;
using NadekoBot.Extensions;
+using NadekoBot.Modules.Permissions.Classes;
using System.Linq;
namespace NadekoBot.Modules.Help
@@ -20,7 +21,7 @@ namespace NadekoBot.Modules.Help
{
manager.CreateCommands("", cgb =>
{
- cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
+ cgb.AddCheck(PermissionChecker.Instance);
commands.ForEach(com => com.Init(cgb));
cgb.CreateCommand(Prefix + "modules")
diff --git a/NadekoBot/Modules/Music/MusicModule.cs b/NadekoBot/Modules/Music/MusicModule.cs
index 4aabfb05..1d0d7107 100644
--- a/NadekoBot/Modules/Music/MusicModule.cs
+++ b/NadekoBot/Modules/Music/MusicModule.cs
@@ -4,8 +4,8 @@ using Discord.Modules;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels;
using NadekoBot.Classes.Music;
-using NadekoBot.Classes.Permissions;
using NadekoBot.Extensions;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
diff --git a/NadekoBot/Modules/NSFW/NSFWModule.cs b/NadekoBot/Modules/NSFW/NSFWModule.cs
index 5252be6f..833dff79 100644
--- a/NadekoBot/Modules/NSFW/NSFWModule.cs
+++ b/NadekoBot/Modules/NSFW/NSFWModule.cs
@@ -1,6 +1,7 @@
using Discord.Commands;
using Discord.Modules;
using NadekoBot.Classes;
+using NadekoBot.Modules.Permissions.Classes;
using Newtonsoft.Json.Linq;
using System;
@@ -18,7 +19,7 @@ namespace NadekoBot.Modules.NSFW
manager.CreateCommands("", cgb =>
{
- cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
+ cgb.AddCheck(PermissionChecker.Instance);
cgb.CreateCommand(Prefix + "hentai")
.Description("Shows a random NSFW hentai image from gelbooru and danbooru with a given tag. Tag is optional but preffered. (multiple tags are appended with +)\n**Usage**: ~hentai yuri+kissing")
diff --git a/NadekoBot/Classes/Permissions/PermissionChecker.cs b/NadekoBot/Modules/Permissions/Classes/PermissionChecker.cs
similarity index 99%
rename from NadekoBot/Classes/Permissions/PermissionChecker.cs
rename to NadekoBot/Modules/Permissions/Classes/PermissionChecker.cs
index 26819b6c..d99059bf 100644
--- a/NadekoBot/Classes/Permissions/PermissionChecker.cs
+++ b/NadekoBot/Modules/Permissions/Classes/PermissionChecker.cs
@@ -6,7 +6,7 @@ using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
-namespace NadekoBot.Classes.Permissions
+namespace NadekoBot.Modules.Permissions.Classes
{
internal class PermissionChecker : IPermissionChecker
diff --git a/NadekoBot/Classes/Permissions/PermissionHelper.cs b/NadekoBot/Modules/Permissions/Classes/PermissionHelper.cs
similarity index 84%
rename from NadekoBot/Classes/Permissions/PermissionHelper.cs
rename to NadekoBot/Modules/Permissions/Classes/PermissionHelper.cs
index ee567822..aef62ac8 100644
--- a/NadekoBot/Classes/Permissions/PermissionHelper.cs
+++ b/NadekoBot/Modules/Permissions/Classes/PermissionHelper.cs
@@ -1,16 +1,21 @@
-using System;
-using System.Linq;
-using Discord;
+using Discord;
using Discord.Commands;
using Discord.Modules;
+using System;
+using System.Linq;
-namespace NadekoBot.Classes.Permissions {
- internal static class PermissionHelper {
- public static bool ValidateBool(string passedArg) {
- if (string.IsNullOrWhiteSpace(passedArg)) {
+namespace NadekoBot.Modules.Permissions.Classes
+{
+ internal static class PermissionHelper
+ {
+ public static bool ValidateBool(string passedArg)
+ {
+ if (string.IsNullOrWhiteSpace(passedArg))
+ {
throw new ArgumentException("No value supplied! Missing argument");
}
- switch (passedArg.ToLower()) {
+ switch (passedArg.ToLower())
+ {
case "1":
case "t":
case "true":
@@ -32,29 +37,34 @@ namespace NadekoBot.Classes.Permissions {
}
}
- internal static string ValidateModule(string mod) {
+ internal static string ValidateModule(string mod)
+ {
if (string.IsNullOrWhiteSpace(mod))
throw new ArgumentNullException(nameof(mod));
- foreach (var m in NadekoBot.Client.GetService().Modules) {
+ foreach (var m in NadekoBot.Client.GetService().Modules)
+ {
if (m.Name.ToLower().Equals(mod.Trim().ToLower()))
return m.Name;
}
throw new ArgumentException("That module does not exist.");
}
- internal static string ValidateCommand(string commandText) {
+ internal static string ValidateCommand(string commandText)
+ {
if (string.IsNullOrWhiteSpace(commandText))
throw new ArgumentNullException(nameof(commandText));
- foreach (var com in NadekoBot.Client.GetService().AllCommands) {
+ foreach (var com in NadekoBot.Client.GetService().AllCommands)
+ {
if (com.Text.ToLower().Equals(commandText.Trim().ToLower()))
return com.Text;
}
throw new NullReferenceException("That command does not exist.");
}
- internal static Role ValidateRole(Server server, string roleName) {
+ internal static Role ValidateRole(Server server, string roleName)
+ {
if (string.IsNullOrWhiteSpace(roleName))
throw new ArgumentNullException(nameof(roleName));
@@ -66,7 +76,8 @@ namespace NadekoBot.Classes.Permissions {
return role;
}
- internal static Channel ValidateChannel(Server server, string channelName) {
+ internal static Channel ValidateChannel(Server server, string channelName)
+ {
if (string.IsNullOrWhiteSpace(channelName))
throw new ArgumentNullException(nameof(channelName));
var channel = server.FindChannels(channelName.Trim(), ChannelType.Text).FirstOrDefault();
@@ -75,7 +86,8 @@ namespace NadekoBot.Classes.Permissions {
return channel;
}
- internal static User ValidateUser(Server server, string userName) {
+ internal static User ValidateUser(Server server, string userName)
+ {
if (string.IsNullOrWhiteSpace(userName))
throw new ArgumentNullException(nameof(userName));
var user = server.FindUsers(userName.Trim()).FirstOrDefault();
diff --git a/NadekoBot/Classes/Permissions/PermissionsHandler.cs b/NadekoBot/Modules/Permissions/Classes/PermissionsHandler.cs
similarity index 91%
rename from NadekoBot/Classes/Permissions/PermissionsHandler.cs
rename to NadekoBot/Modules/Permissions/Classes/PermissionsHandler.cs
index 1e3cb1e6..a9bac105 100644
--- a/NadekoBot/Classes/Permissions/PermissionsHandler.cs
+++ b/NadekoBot/Modules/Permissions/Classes/PermissionsHandler.cs
@@ -1,40 +1,48 @@
using Discord;
+using Discord.Commands;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using Discord.Commands;
-namespace NadekoBot.Classes.Permissions {
- public static class PermissionsHandler {
+namespace NadekoBot.Modules.Permissions.Classes
+{
+ public static class PermissionsHandler
+ {
public static ConcurrentDictionary PermissionsDict =
new ConcurrentDictionary();
- public enum PermissionBanType {
+ public enum PermissionBanType
+ {
None, ServerBanCommand, ServerBanModule,
ChannelBanCommand, ChannelBanModule, RoleBanCommand,
RoleBanModule, UserBanCommand, UserBanModule
}
- public static void Initialize() {
+ public static void Initialize()
+ {
Console.WriteLine("Reading from the permission files.");
Directory.CreateDirectory("data/permissions");
- foreach (var file in Directory.EnumerateFiles("data/permissions/")) {
- try {
+ foreach (var file in Directory.EnumerateFiles("data/permissions/"))
+ {
+ try
+ {
var strippedFileName = Path.GetFileNameWithoutExtension(file);
if (string.IsNullOrWhiteSpace(strippedFileName)) continue;
var id = ulong.Parse(strippedFileName);
var data = Newtonsoft.Json.JsonConvert.DeserializeObject(File.ReadAllText(file));
PermissionsDict.TryAdd(id, data);
- } catch { }
+ }
+ catch { }
}
Console.WriteLine("Permission initialization complete.");
}
- internal static Permissions GetRolePermissionsById(Server server, ulong id) {
+ internal static Permissions GetRolePermissionsById(Server server, ulong id)
+ {
ServerPermissions serverPerms;
if (!PermissionsDict.TryGetValue(server.Id, out serverPerms))
return null;
@@ -44,7 +52,8 @@ namespace NadekoBot.Classes.Permissions {
return toReturn;
}
- internal static Permissions GetUserPermissionsById(Server server, ulong id) {
+ internal static Permissions GetUserPermissionsById(Server server, ulong id)
+ {
ServerPermissions serverPerms;
if (!PermissionsDict.TryGetValue(server.Id, out serverPerms))
return null;
@@ -54,7 +63,8 @@ namespace NadekoBot.Classes.Permissions {
return toReturn;
}
- internal static Permissions GetChannelPermissionsById(Server server, ulong id) {
+ internal static Permissions GetChannelPermissionsById(Server server, ulong id)
+ {
ServerPermissions serverPerms;
if (!PermissionsDict.TryGetValue(server.Id, out serverPerms))
return null;
@@ -64,12 +74,14 @@ namespace NadekoBot.Classes.Permissions {
return toReturn;
}
- internal static Permissions GetServerPermissions(Server server) {
+ internal static Permissions GetServerPermissions(Server server)
+ {
ServerPermissions serverPerms;
return !PermissionsDict.TryGetValue(server.Id, out serverPerms) ? null : serverPerms.Permissions;
}
- internal static PermissionBanType GetPermissionBanType(Command command, User user, Channel channel) {
+ internal static PermissionBanType GetPermissionBanType(Command command, User user, Channel channel)
+ {
var server = user.Server;
ServerPermissions serverPerms = PermissionsDict.GetOrAdd(server.Id, id => new ServerPermissions(id, server.Name));
bool val;
@@ -94,7 +106,8 @@ namespace NadekoBot.Classes.Permissions {
// IF AT LEAST ONE ROLE EXIST THAT IS NOT BANNED,
// USER CAN RUN THE COMMAND
var foundNotBannedRole = false;
- foreach (var role in user.Roles) {
+ foreach (var role in user.Roles)
+ {
//if every role is banned from using the module -> rolebanmodule
if (serverPerms.RolePermissions.TryGetValue(role.Id, out perm) &&
perm.Modules.TryGetValue(command.Category, out val) && val == false)
@@ -111,12 +124,14 @@ namespace NadekoBot.Classes.Permissions {
// IF AT LEAST ONE ROLE EXISTS THAT IS NOT BANNED,
// USER CAN RUN THE COMMAND
foundNotBannedRole = false;
- foreach (var role in user.Roles) {
+ foreach (var role in user.Roles)
+ {
//if every role is banned from using the module -> rolebanmodule
if (serverPerms.RolePermissions.TryGetValue(role.Id, out perm) &&
perm.Commands.TryGetValue(command.Text, out val) && val == false)
continue;
- else {
+ else
+ {
foundNotBannedRole = true;
break;
}
@@ -135,27 +150,32 @@ namespace NadekoBot.Classes.Permissions {
return PermissionBanType.None;
}
- private static void WriteServerToJson(ServerPermissions serverPerms) {
+ private static void WriteServerToJson(ServerPermissions serverPerms)
+ {
string pathToFile = $"data/permissions/{serverPerms.Id}.json";
File.WriteAllText(pathToFile,
Newtonsoft.Json.JsonConvert.SerializeObject(serverPerms, Newtonsoft.Json.Formatting.Indented));
}
- public static void WriteToJson() {
+ public static void WriteToJson()
+ {
Directory.CreateDirectory("data/permissions/");
- foreach (var kvp in PermissionsDict) {
+ foreach (var kvp in PermissionsDict)
+ {
WriteServerToJson(kvp.Value);
}
}
- public static string GetServerPermissionsRoleName(Server server) {
+ public static string GetServerPermissionsRoleName(Server server)
+ {
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
return serverPerms.PermissionsControllerRole;
}
- internal static void SetPermissionsRole(Server server, string roleName) {
+ internal static void SetPermissionsRole(Server server, string roleName)
+ {
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -163,7 +183,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- internal static void SetVerbosity(Server server, bool val) {
+ internal static void SetVerbosity(Server server, bool val)
+ {
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -171,7 +192,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetServerModulePermission(Server server, string moduleName, bool value) {
+ public static void SetServerModulePermission(Server server, string moduleName, bool value)
+ {
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -183,7 +205,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetServerCommandPermission(Server server, string commandName, bool value) {
+ public static void SetServerCommandPermission(Server server, string commandName, bool value)
+ {
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -195,7 +218,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetChannelModulePermission(Channel channel, string moduleName, bool value) {
+ public static void SetChannelModulePermission(Channel channel, string moduleName, bool value)
+ {
var server = channel.Server;
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
@@ -213,7 +237,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetChannelCommandPermission(Channel channel, string commandName, bool value) {
+ public static void SetChannelCommandPermission(Channel channel, string commandName, bool value)
+ {
var server = channel.Server;
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -230,7 +255,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetRoleModulePermission(Role role, string moduleName, bool value) {
+ public static void SetRoleModulePermission(Role role, string moduleName, bool value)
+ {
var server = role.Server;
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -247,7 +273,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetRoleCommandPermission(Role role, string commandName, bool value) {
+ public static void SetRoleCommandPermission(Role role, string commandName, bool value)
+ {
var server = role.Server;
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -264,7 +291,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetUserModulePermission(User user, string moduleName, bool value) {
+ public static void SetUserModulePermission(User user, string moduleName, bool value)
+ {
var server = user.Server;
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -281,7 +309,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetUserCommandPermission(User user, string commandName, bool value) {
+ public static void SetUserCommandPermission(User user, string commandName, bool value)
+ {
var server = user.Server;
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -297,7 +326,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetServerWordPermission(Server server, bool value) {
+ public static void SetServerWordPermission(Server server, bool value)
+ {
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -305,7 +335,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetChannelWordPermission(Channel channel, bool value) {
+ public static void SetChannelWordPermission(Channel channel, bool value)
+ {
var server = channel.Server;
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -317,7 +348,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetServerFilterInvitesPermission(Server server, bool value) {
+ public static void SetServerFilterInvitesPermission(Server server, bool value)
+ {
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -325,7 +357,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void SetChannelFilterInvitesPermission(Channel channel, bool value) {
+ public static void SetChannelFilterInvitesPermission(Channel channel, bool value)
+ {
var server = channel.Server;
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
@@ -337,7 +370,8 @@ namespace NadekoBot.Classes.Permissions {
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void AddFilteredWord(Server server, string word) {
+ public static void AddFilteredWord(Server server, string word)
+ {
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
if (serverPerms.Words.Contains(word))
@@ -345,7 +379,8 @@ namespace NadekoBot.Classes.Permissions {
serverPerms.Words.Add(word);
Task.Run(() => WriteServerToJson(serverPerms));
}
- public static void RemoveFilteredWord(Server server, string word) {
+ public static void RemoveFilteredWord(Server server, string word)
+ {
var serverPerms = PermissionsDict.GetOrAdd(server.Id,
new ServerPermissions(server.Id, server.Name));
if (!serverPerms.Words.Contains(word))
@@ -357,7 +392,8 @@ namespace NadekoBot.Classes.Permissions {
///
/// Holds a permission list
///
- public class Permissions {
+ public class Permissions
+ {
///
/// Name of the parent object whose permissions these are
///
@@ -379,7 +415,8 @@ namespace NadekoBot.Classes.Permissions {
///
public bool FilterWords { get; set; }
- public Permissions(string name) {
+ public Permissions(string name)
+ {
Name = name;
Modules = new ConcurrentDictionary();
Commands = new ConcurrentDictionary();
@@ -387,17 +424,20 @@ namespace NadekoBot.Classes.Permissions {
FilterWords = false;
}
- public override string ToString() {
+ public override string ToString()
+ {
var toReturn = "";
var bannedModules = Modules.Where(kvp => kvp.Value == false);
var bannedModulesArray = bannedModules as KeyValuePair[] ?? bannedModules.ToArray();
- if (bannedModulesArray.Any()) {
+ if (bannedModulesArray.Any())
+ {
toReturn += "`Banned Modules:`\n";
toReturn = bannedModulesArray.Aggregate(toReturn, (current, m) => current + $"\t`[x] {m.Key}`\n");
}
var bannedCommands = Commands.Where(kvp => kvp.Value == false);
var bannedCommandsArr = bannedCommands as KeyValuePair[] ?? bannedCommands.ToArray();
- if (bannedCommandsArr.Any()) {
+ if (bannedCommandsArr.Any())
+ {
toReturn += "`Banned Commands:`\n";
toReturn = bannedCommandsArr.Aggregate(toReturn, (current, c) => current + $"\t`[x] {c.Key}`\n");
}
@@ -405,7 +445,8 @@ namespace NadekoBot.Classes.Permissions {
}
}
- public class ServerPermissions {
+ public class ServerPermissions
+ {
///
/// The guy who can edit the permissions
///
@@ -431,7 +472,8 @@ namespace NadekoBot.Classes.Permissions {
public Dictionary ChannelPermissions { get; set; }
public Dictionary RolePermissions { get; set; }
- public ServerPermissions(ulong id, string name) {
+ public ServerPermissions(ulong id, string name)
+ {
Id = id;
PermissionsControllerRole = "Nadeko";
Verbose = true;
diff --git a/NadekoBot/Classes/Permissions/SimpleCheckers.cs b/NadekoBot/Modules/Permissions/Classes/SimpleCheckers.cs
similarity index 84%
rename from NadekoBot/Classes/Permissions/SimpleCheckers.cs
rename to NadekoBot/Modules/Permissions/Classes/SimpleCheckers.cs
index 43763605..3ab0650d 100644
--- a/NadekoBot/Classes/Permissions/SimpleCheckers.cs
+++ b/NadekoBot/Modules/Permissions/Classes/SimpleCheckers.cs
@@ -1,10 +1,12 @@
using Discord;
using Discord.Commands;
-using System;
using Discord.Commands.Permissions;
+using System;
-namespace NadekoBot.Classes.Permissions {
- public static class SimpleCheckers {
+namespace NadekoBot.Modules.Permissions.Classes
+{
+ public static class SimpleCheckers
+ {
public static ManageRoles CanManageRoles { get; } = new ManageRoles();
public static Func OwnerOnly() =>
@@ -19,8 +21,10 @@ namespace NadekoBot.Classes.Permissions {
public static Func ManageServer() =>
(com, user, ch) => user.ServerPermissions.ManageServer;
- public class ManageRoles : IPermissionChecker {
- public bool CanRun(Command command, User user, Channel channel, out string error) {
+ public class ManageRoles : IPermissionChecker
+ {
+ public bool CanRun(Command command, User user, Channel channel, out string error)
+ {
error = string.Empty;
if (user.ServerPermissions.ManageRoles)
return true;
diff --git a/NadekoBot/Modules/Permissions/Commands/FilterInvitesCommand.cs b/NadekoBot/Modules/Permissions/Commands/FilterInvitesCommand.cs
index a6981e06..a277d7a0 100644
--- a/NadekoBot/Modules/Permissions/Commands/FilterInvitesCommand.cs
+++ b/NadekoBot/Modules/Permissions/Commands/FilterInvitesCommand.cs
@@ -1,11 +1,10 @@
using Discord;
using Discord.Commands;
using NadekoBot.Classes;
-using NadekoBot.Classes.Permissions;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Text.RegularExpressions;
-using ServerPermissions = NadekoBot.Classes.Permissions.ServerPermissions;
namespace NadekoBot.Modules.Permissions.Commands
{
@@ -21,7 +20,7 @@ namespace NadekoBot.Modules.Permissions.Commands
if (args.Channel.IsPrivate || args.User.Id == NadekoBot.Client.CurrentUser.Id) return;
try
{
- ServerPermissions serverPerms;
+ Classes.ServerPermissions serverPerms;
if (!IsChannelOrServerFiltering(args.Channel, out serverPerms)) return;
if (filterRegex.IsMatch(args.Message.RawText))
@@ -39,14 +38,14 @@ namespace NadekoBot.Modules.Permissions.Commands
};
}
- private static bool IsChannelOrServerFiltering(Channel channel, out ServerPermissions serverPerms)
+ private static bool IsChannelOrServerFiltering(Channel channel, out Classes.ServerPermissions serverPerms)
{
if (!PermissionsHandler.PermissionsDict.TryGetValue(channel.Server.Id, out serverPerms)) return false;
if (serverPerms.Permissions.FilterInvites)
return true;
- Classes.Permissions.Permissions perms;
+ Classes.Permissions perms;
return serverPerms.ChannelPermissions.TryGetValue(channel.Id, out perms) && perms.FilterInvites;
}
diff --git a/NadekoBot/Modules/Permissions/Commands/FilterWordsCommand.cs b/NadekoBot/Modules/Permissions/Commands/FilterWordsCommand.cs
index 83e1b2af..2d3528a8 100644
--- a/NadekoBot/Modules/Permissions/Commands/FilterWordsCommand.cs
+++ b/NadekoBot/Modules/Permissions/Commands/FilterWordsCommand.cs
@@ -1,11 +1,10 @@
using Discord;
using Discord.Commands;
using NadekoBot.Classes;
-using NadekoBot.Classes.Permissions;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Linq;
-using ServerPermissions = NadekoBot.Classes.Permissions.ServerPermissions;
namespace NadekoBot.Modules.Permissions.Commands
{
@@ -18,7 +17,7 @@ namespace NadekoBot.Modules.Permissions.Commands
if (args.Channel.IsPrivate || args.User.Id == NadekoBot.Client.CurrentUser.Id) return;
try
{
- ServerPermissions serverPerms;
+ Classes.ServerPermissions serverPerms;
if (!IsChannelOrServerFiltering(args.Channel, out serverPerms)) return;
var wordsInMessage = args.Message.RawText.ToLowerInvariant().Split(' ');
@@ -37,14 +36,14 @@ namespace NadekoBot.Modules.Permissions.Commands
};
}
- private static bool IsChannelOrServerFiltering(Channel channel, out ServerPermissions serverPerms)
+ private static bool IsChannelOrServerFiltering(Channel channel, out Classes.ServerPermissions serverPerms)
{
if (!PermissionsHandler.PermissionsDict.TryGetValue(channel.Server.Id, out serverPerms)) return false;
if (serverPerms.Permissions.FilterWords)
return true;
- Classes.Permissions.Permissions perms;
+ Classes.Permissions perms;
return serverPerms.ChannelPermissions.TryGetValue(channel.Id, out perms) && perms.FilterWords;
}
@@ -139,7 +138,7 @@ namespace NadekoBot.Modules.Permissions.Commands
{
try
{
- ServerPermissions serverPerms;
+ Classes.ServerPermissions serverPerms;
if (!PermissionsHandler.PermissionsDict.TryGetValue(e.Server.Id, out serverPerms))
return;
await e.Channel.SendMessage($"There are `{serverPerms.Words.Count}` filtered words.\n" +
diff --git a/NadekoBot/Modules/Permissions/PermissionsModule.cs b/NadekoBot/Modules/Permissions/PermissionsModule.cs
index 998906b7..ed84247d 100644
--- a/NadekoBot/Modules/Permissions/PermissionsModule.cs
+++ b/NadekoBot/Modules/Permissions/PermissionsModule.cs
@@ -1,14 +1,13 @@
using Discord.Commands;
using Discord.Modules;
using NadekoBot.Classes.JSONModels;
-using NadekoBot.Classes.Permissions;
using NadekoBot.Extensions;
using NadekoBot.Modules.Games.Commands;
+using NadekoBot.Modules.Permissions.Classes;
using NadekoBot.Modules.Permissions.Commands;
using System;
using System.Linq;
using System.Threading.Tasks;
-using PermsHandler = NadekoBot.Classes.Permissions.PermissionsHandler;
namespace NadekoBot.Modules.Permissions
{
@@ -39,7 +38,7 @@ namespace NadekoBot.Modules.Permissions
{
if (string.IsNullOrWhiteSpace(e.GetArg("role")))
{
- await e.Channel.SendMessage($"Current permissions role is `{PermsHandler.GetServerPermissionsRoleName(e.Server)}`");
+ await e.Channel.SendMessage($"Current permissions role is `{PermissionsHandler.GetServerPermissionsRoleName(e.Server)}`");
return;
}
@@ -55,7 +54,7 @@ namespace NadekoBot.Modules.Permissions
await e.Channel.SendMessage($"Role `{arg}` probably doesn't exist. Create the role with that name first.");
return;
}
- PermsHandler.SetPermissionsRole(e.Server, role.Name);
+ PermissionsHandler.SetPermissionsRole(e.Server, role.Name);
await e.Channel.SendMessage($"Role `{role.Name}` is now required in order to change permissions.");
});
@@ -67,7 +66,7 @@ namespace NadekoBot.Modules.Permissions
{
var arg = e.GetArg("arg");
var val = PermissionHelper.ValidateBool(arg);
- PermsHandler.SetVerbosity(e.Server, val);
+ PermissionsHandler.SetVerbosity(e.Server, val);
await e.Channel.SendMessage($"Verbosity set to {val}.");
});
@@ -76,7 +75,7 @@ namespace NadekoBot.Modules.Permissions
.Description("Shows banned permissions for this server.")
.Do(async e =>
{
- var perms = PermsHandler.GetServerPermissions(e.Server);
+ var perms = PermissionsHandler.GetServerPermissions(e.Server);
if (string.IsNullOrWhiteSpace(perms?.ToString()))
await e.Channel.SendMessage("No permissions set for this server.");
await e.Channel.SendMessage(perms.ToString());
@@ -101,7 +100,7 @@ namespace NadekoBot.Modules.Permissions
return;
}
- var perms = PermsHandler.GetRolePermissionsById(e.Server, role.Id);
+ var perms = PermissionsHandler.GetRolePermissionsById(e.Server, role.Id);
if (string.IsNullOrWhiteSpace(perms?.ToString()))
await e.Channel.SendMessage($"No permissions set for **{role.Name}** role.");
@@ -127,7 +126,7 @@ namespace NadekoBot.Modules.Permissions
return;
}
- var perms = PermsHandler.GetChannelPermissionsById(e.Server, channel.Id);
+ var perms = PermissionsHandler.GetChannelPermissionsById(e.Server, channel.Id);
if (string.IsNullOrWhiteSpace(perms?.ToString()))
await e.Channel.SendMessage($"No permissions set for **{channel.Name}** channel.");
await e.Channel.SendMessage(perms.ToString());
@@ -151,7 +150,7 @@ namespace NadekoBot.Modules.Permissions
return;
}
- var perms = PermsHandler.GetUserPermissionsById(e.Server, user.Id);
+ var perms = PermissionsHandler.GetUserPermissionsById(e.Server, user.Id);
if (string.IsNullOrWhiteSpace(perms?.ToString()))
await e.Channel.SendMessage($"No permissions set for user **{user.Name}**.");
await e.Channel.SendMessage(perms.ToString());
@@ -168,7 +167,7 @@ namespace NadekoBot.Modules.Permissions
var module = PermissionHelper.ValidateModule(e.GetArg("module"));
var state = PermissionHelper.ValidateBool(e.GetArg("bool"));
- PermsHandler.SetServerModulePermission(e.Server, module, state);
+ PermissionsHandler.SetServerModulePermission(e.Server, module, state);
await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on this server.");
}
catch (ArgumentException exArg)
@@ -192,7 +191,7 @@ namespace NadekoBot.Modules.Permissions
var command = PermissionHelper.ValidateCommand(e.GetArg("command"));
var state = PermissionHelper.ValidateBool(e.GetArg("bool"));
- PermsHandler.SetServerCommandPermission(e.Server, command, state);
+ PermissionsHandler.SetServerCommandPermission(e.Server, command, state);
await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** on this server.");
}
catch (ArgumentException exArg)
@@ -221,7 +220,7 @@ namespace NadekoBot.Modules.Permissions
{
foreach (var role in e.Server.Roles)
{
- PermsHandler.SetRoleModulePermission(role, module, state);
+ PermissionsHandler.SetRoleModulePermission(role, module, state);
}
await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **ALL** roles.");
}
@@ -229,7 +228,7 @@ namespace NadekoBot.Modules.Permissions
{
var role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role"));
- PermsHandler.SetRoleModulePermission(role, module, state);
+ PermissionsHandler.SetRoleModulePermission(role, module, state);
await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
}
}
@@ -259,7 +258,7 @@ namespace NadekoBot.Modules.Permissions
{
foreach (var role in e.Server.Roles)
{
- PermsHandler.SetRoleCommandPermission(role, command, state);
+ PermissionsHandler.SetRoleCommandPermission(role, command, state);
}
await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **ALL** roles.");
}
@@ -267,7 +266,7 @@ namespace NadekoBot.Modules.Permissions
{
var role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role"));
- PermsHandler.SetRoleCommandPermission(role, command, state);
+ PermissionsHandler.SetRoleCommandPermission(role, command, state);
await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
}
}
@@ -297,7 +296,7 @@ namespace NadekoBot.Modules.Permissions
{
foreach (var channel in e.Server.TextChannels)
{
- PermsHandler.SetChannelModulePermission(channel, module, state);
+ PermissionsHandler.SetChannelModulePermission(channel, module, state);
}
await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.");
}
@@ -305,7 +304,7 @@ namespace NadekoBot.Modules.Permissions
{
var channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
- PermsHandler.SetChannelModulePermission(channel, module, state);
+ PermissionsHandler.SetChannelModulePermission(channel, module, state);
await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
}
}
@@ -335,7 +334,7 @@ namespace NadekoBot.Modules.Permissions
{
foreach (var channel in e.Server.TextChannels)
{
- PermsHandler.SetChannelCommandPermission(channel, command, state);
+ PermissionsHandler.SetChannelCommandPermission(channel, command, state);
}
await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.");
}
@@ -343,7 +342,7 @@ namespace NadekoBot.Modules.Permissions
{
var channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
- PermsHandler.SetChannelCommandPermission(channel, command, state);
+ PermissionsHandler.SetChannelCommandPermission(channel, command, state);
await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
}
}
@@ -370,7 +369,7 @@ namespace NadekoBot.Modules.Permissions
var state = PermissionHelper.ValidateBool(e.GetArg("bool"));
var user = PermissionHelper.ValidateUser(e.Server, e.GetArg("user"));
- PermsHandler.SetUserModulePermission(user, module, state);
+ PermissionsHandler.SetUserModulePermission(user, module, state);
await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for user **{user.Name}**.");
}
catch (ArgumentException exArg)
@@ -396,7 +395,7 @@ namespace NadekoBot.Modules.Permissions
var state = PermissionHelper.ValidateBool(e.GetArg("bool"));
var user = PermissionHelper.ValidateUser(e.Server, e.GetArg("user"));
- PermsHandler.SetUserCommandPermission(user, command, state);
+ PermissionsHandler.SetUserCommandPermission(user, command, state);
await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for user **{user.Name}**.");
}
catch (ArgumentException exArg)
@@ -420,7 +419,7 @@ namespace NadekoBot.Modules.Permissions
foreach (var module in NadekoBot.Client.GetService().Modules)
{
- PermsHandler.SetServerModulePermission(e.Server, module.Name, state);
+ PermissionsHandler.SetServerModulePermission(e.Server, module.Name, state);
}
await e.Channel.SendMessage($"All modules have been **{(state ? "enabled" : "disabled")}** on this server.");
}
@@ -447,7 +446,7 @@ namespace NadekoBot.Modules.Permissions
foreach (var command in NadekoBot.Client.GetService().AllCommands.Where(c => c.Category == module))
{
- PermsHandler.SetServerCommandPermission(e.Server, command.Text, state);
+ PermissionsHandler.SetServerCommandPermission(e.Server, command.Text, state);
}
await e.Channel.SendMessage($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** on this server.");
}
@@ -473,7 +472,7 @@ namespace NadekoBot.Modules.Permissions
var channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
foreach (var module in NadekoBot.Client.GetService().Modules)
{
- PermsHandler.SetChannelModulePermission(channel, module.Name, state);
+ PermissionsHandler.SetChannelModulePermission(channel, module.Name, state);
}
await e.Channel.SendMessage($"All modules have been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
@@ -502,7 +501,7 @@ namespace NadekoBot.Modules.Permissions
var channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
foreach (var command in NadekoBot.Client.GetService().AllCommands.Where(c => c.Category == module))
{
- PermsHandler.SetChannelCommandPermission(channel, command.Text, state);
+ PermissionsHandler.SetChannelCommandPermission(channel, command.Text, state);
}
await e.Channel.SendMessage($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
}
@@ -528,7 +527,7 @@ namespace NadekoBot.Modules.Permissions
var role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role"));
foreach (var module in NadekoBot.Client.GetService().Modules)
{
- PermsHandler.SetRoleModulePermission(role, module.Name, state);
+ PermissionsHandler.SetRoleModulePermission(role, module.Name, state);
}
await e.Channel.SendMessage($"All modules have been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
@@ -557,7 +556,7 @@ namespace NadekoBot.Modules.Permissions
var role = PermissionHelper.ValidateRole(e.Server, e.GetArg("channel"));
foreach (var command in NadekoBot.Client.GetService().AllCommands.Where(c => c.Category == module))
{
- PermsHandler.SetRoleCommandPermission(role, command.Text, state);
+ PermissionsHandler.SetRoleCommandPermission(role, command.Text, state);
}
await e.Channel.SendMessage($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
}
@@ -662,8 +661,8 @@ namespace NadekoBot.Modules.Permissions
NadekoBot.Config.ServerBlacklist.Add(serverId);
ConfigHandler.SaveConfig();
//cleanup trivias and typeracing
- Classes.Trivia.TriviaGame trivia;
- Trivia.RunningTrivias.TryRemove(serverId, out trivia);
+ Modules.Games.Commands.Trivia.TriviaGame trivia;
+ TriviaCommands.RunningTrivias.TryRemove(serverId, out trivia);
TypingGame typeracer;
SpeedTyping.RunningContests.TryRemove(serverId, out typeracer);
diff --git a/NadekoBot/Modules/Pokemon/PokemonModule.cs b/NadekoBot/Modules/Pokemon/PokemonModule.cs
index 7addcc91..bee391a2 100644
--- a/NadekoBot/Modules/Pokemon/PokemonModule.cs
+++ b/NadekoBot/Modules/Pokemon/PokemonModule.cs
@@ -3,8 +3,8 @@ using Discord.Modules;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels;
using NadekoBot.Classes.JSONModels;
-using NadekoBot.Classes.Permissions;
using NadekoBot.Extensions;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
diff --git a/NadekoBot/Modules/Searches/Commands/ConverterCommand.cs b/NadekoBot/Modules/Searches/Commands/ConverterCommand.cs
index baf53e5e..a1f2348a 100644
--- a/NadekoBot/Modules/Searches/Commands/ConverterCommand.cs
+++ b/NadekoBot/Modules/Searches/Commands/ConverterCommand.cs
@@ -1,5 +1,5 @@
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using ScaredFingers.UnitsConversion;
using System;
using System.Collections.Generic;
diff --git a/NadekoBot/Modules/Searches/Commands/LoLCommands.cs b/NadekoBot/Modules/Searches/Commands/LoLCommands.cs
index f1b3d10a..01848c21 100644
--- a/NadekoBot/Modules/Searches/Commands/LoLCommands.cs
+++ b/NadekoBot/Modules/Searches/Commands/LoLCommands.cs
@@ -1,6 +1,6 @@
using Discord.Commands;
using NadekoBot.Classes;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using NadekoBot.Extensions;
using Newtonsoft.Json.Linq;
using System;
diff --git a/NadekoBot/Modules/Searches/Commands/RedditCommand.cs b/NadekoBot/Modules/Searches/Commands/RedditCommand.cs
index c40da49e..91b0744a 100644
--- a/NadekoBot/Modules/Searches/Commands/RedditCommand.cs
+++ b/NadekoBot/Modules/Searches/Commands/RedditCommand.cs
@@ -1,5 +1,5 @@
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using System;
namespace NadekoBot.Modules.Searches.Commands
diff --git a/NadekoBot/Modules/Searches/Commands/StreamNotifications.cs b/NadekoBot/Modules/Searches/Commands/StreamNotifications.cs
index 79c7ef98..ce3b05a6 100644
--- a/NadekoBot/Modules/Searches/Commands/StreamNotifications.cs
+++ b/NadekoBot/Modules/Searches/Commands/StreamNotifications.cs
@@ -1,8 +1,8 @@
using Discord.Commands;
using NadekoBot.Classes;
using NadekoBot.Classes.JSONModels;
-using NadekoBot.Classes.Permissions;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
+using NadekoBot.Modules.Permissions.Classes;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Concurrent;
diff --git a/NadekoBot/Modules/Searches/SearchesModule.cs b/NadekoBot/Modules/Searches/SearchesModule.cs
index 4295260c..cfb4f6f3 100644
--- a/NadekoBot/Modules/Searches/SearchesModule.cs
+++ b/NadekoBot/Modules/Searches/SearchesModule.cs
@@ -4,6 +4,7 @@ using NadekoBot.Classes;
using NadekoBot.Classes.IMDB;
using NadekoBot.Classes.JSONModels;
using NadekoBot.Extensions;
+using NadekoBot.Modules.Permissions.Classes;
using NadekoBot.Modules.Searches.Commands;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -35,7 +36,7 @@ namespace NadekoBot.Modules.Searches
manager.CreateCommands("", cgb =>
{
- cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
+ cgb.AddCheck(PermissionChecker.Instance);
commands.ForEach(cmd => cmd.Init(cgb));
diff --git a/NadekoBot/Modules/Translator/TranslateCommand.cs b/NadekoBot/Modules/Translator/TranslateCommand.cs
index 6b0a1d5a..b204a7b1 100644
--- a/NadekoBot/Modules/Translator/TranslateCommand.cs
+++ b/NadekoBot/Modules/Translator/TranslateCommand.cs
@@ -1,5 +1,5 @@
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using NadekoBot.Modules.Translator.Helpers;
using System;
using System.Threading.Tasks;
diff --git a/NadekoBot/Modules/Translator/TranslatorModule.cs b/NadekoBot/Modules/Translator/TranslatorModule.cs
index d3427daa..1b333a6b 100644
--- a/NadekoBot/Modules/Translator/TranslatorModule.cs
+++ b/NadekoBot/Modules/Translator/TranslatorModule.cs
@@ -1,5 +1,6 @@
using Discord.Modules;
using NadekoBot.Extensions;
+using NadekoBot.Modules.Permissions.Classes;
namespace NadekoBot.Modules.Translator
{
@@ -17,7 +18,7 @@ namespace NadekoBot.Modules.Translator
{
manager.CreateCommands("", cgb =>
{
- cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
+ cgb.AddCheck(PermissionChecker.Instance);
commands.ForEach(cmd => cmd.Init(cgb));
});
}
diff --git a/NadekoBot/Modules/Translator/ValidLanguagesCommand.cs b/NadekoBot/Modules/Translator/ValidLanguagesCommand.cs
index e479639a..aa6b4f4b 100644
--- a/NadekoBot/Modules/Translator/ValidLanguagesCommand.cs
+++ b/NadekoBot/Modules/Translator/ValidLanguagesCommand.cs
@@ -1,5 +1,5 @@
using Discord.Commands;
-using NadekoBot.Commands;
+using NadekoBot.Classes;
using NadekoBot.Modules.Translator.Helpers;
using System;
using System.Threading.Tasks;
diff --git a/NadekoBot/Modules/Trello/TrelloModule.cs b/NadekoBot/Modules/Trello/TrelloModule.cs
index 73433a42..2d28283e 100644
--- a/NadekoBot/Modules/Trello/TrelloModule.cs
+++ b/NadekoBot/Modules/Trello/TrelloModule.cs
@@ -2,6 +2,7 @@
using Manatee.Trello;
using Manatee.Trello.ManateeJson;
using NadekoBot.Extensions;
+using NadekoBot.Modules.Permissions.Classes;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -65,7 +66,7 @@ namespace NadekoBot.Modules.Trello
manager.CreateCommands("trello ", cgb =>
{
- cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
+ cgb.AddCheck(PermissionChecker.Instance);
cgb.CreateCommand("join")
.Alias("j")
diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs
index 7ca85d8f..bcdae26e 100644
--- a/NadekoBot/NadekoBot.cs
+++ b/NadekoBot/NadekoBot.cs
@@ -3,7 +3,7 @@ using Discord.Audio;
using Discord.Commands;
using Discord.Modules;
using NadekoBot.Classes.JSONModels;
-using NadekoBot.Commands.Help.Commands;
+using NadekoBot.Classes.Help.Commands;
using NadekoBot.Modules.Administration;
using NadekoBot.Modules.ClashOfClans;
using NadekoBot.Modules.Conversations;
@@ -14,6 +14,7 @@ using NadekoBot.Modules.Help;
using NadekoBot.Modules.Music;
using NadekoBot.Modules.NSFW;
using NadekoBot.Modules.Permissions;
+using NadekoBot.Modules.Permissions.Classes;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Modules.Searches;
using NadekoBot.Modules.Translator;
@@ -233,7 +234,7 @@ namespace NadekoBot
if (string.IsNullOrWhiteSpace(request.Content))
e.Cancel = true;
};
- Classes.Permissions.PermissionsHandler.Initialize();
+ PermissionsHandler.Initialize();
NadekoBot.Ready = true;
});
Console.WriteLine("Exiting...");