few more thingies, ready for prerelease

This commit is contained in:
Master Kwoth
2016-03-03 18:24:58 +01:00
parent 827b5bae0c
commit a6ebff0a17
31 changed files with 190 additions and 185 deletions

View File

@ -4,10 +4,7 @@ using NadekoBot.Commands;
namespace NadekoBot.Modules {
internal abstract class DiscordModule : IModule {
protected List<DiscordCommand> commands = new List<DiscordCommand>();
protected DiscordModule() {
}
protected readonly HashSet<IDiscordCommand> commands = new HashSet<IDiscordCommand>();
public abstract void Install(ModuleManager manager);
}

View File

@ -4,6 +4,8 @@ using Discord.Modules;
using NadekoBot.Commands;
using Newtonsoft.Json.Linq;
using System.IO;
using NadekoBot.Extensions;
//🃏
//🏁
namespace NadekoBot.Modules {

View File

@ -2,6 +2,7 @@
using Discord.Modules;
using Discord.Commands;
using NadekoBot.Commands;
using NadekoBot.Extensions;
namespace NadekoBot.Modules {
internal class Help : DiscordModule {

View File

@ -4,6 +4,7 @@ using Discord.Commands;
using NadekoBot.Classes;
using PermsHandler = NadekoBot.Classes.Permissions.PermissionsHandler;
using System.Linq;
using NadekoBot.Extensions;
namespace NadekoBot.Modules {
internal class PermissionModule : DiscordModule {
@ -14,7 +15,6 @@ namespace NadekoBot.Modules {
}
//todo word filtering/invite bans (?:discord(?:\.gg|app\.com\/invite)\/(?<id>([\w]{16}|(?:[\w]+-?){3})))
public override void Install(ModuleManager manager) {
var client = NadekoBot.Client;
manager.CreateCommands("", cgb => {
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
@ -75,7 +75,7 @@ namespace NadekoBot.Modules {
var role = e.Server.EveryoneRole;
if (!string.IsNullOrWhiteSpace(arg))
try {
role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role"));
role = PermissionHelper.ValidateRole(e.Server, arg);
}
catch (Exception ex) {
await e.Channel.SendMessage("💢 Error: " + ex.Message);
@ -98,7 +98,7 @@ namespace NadekoBot.Modules {
var channel = e.Channel;
if (!string.IsNullOrWhiteSpace(arg))
try {
channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
channel = PermissionHelper.ValidateChannel(e.Server, arg);
}
catch (Exception ex) {
await e.Channel.SendMessage("💢 Error: " + ex.Message);
@ -116,7 +116,6 @@ namespace NadekoBot.Modules {
.Description("Shows banned permissions for a certain user. No argument means for yourself.\n**Usage**: ;up Kwoth")
.Parameter("user", ParameterType.Unparsed)
.Do(async e => {
var arg = e.GetArg("user");
var user = e.User;
if (!string.IsNullOrWhiteSpace(e.GetArg("user")))
try {

View File

@ -127,8 +127,8 @@ namespace NadekoBot.Modules {
var headers = new Dictionary<string, string> { { "X-Mashape-Key", NadekoBot.Creds.MashapeKey } };
var res = await SearchHelper.GetResponseStringAsync($"https://omgvamp-hearthstone-v1.p.mashape.com/cards/search/{Uri.EscapeUriString(arg)}", headers);
try {
var items = JArray.Parse(res) as JArray;
var images = new List<System.Drawing.Image>();
var items = JArray.Parse(res);
var images = new List<Image>();
if (items == null)
throw new KeyNotFoundException("Cannot find a card by that name");
var cnt = 0;