From 1d685757bfbc8e31e0f8bf7aff8571824cbcfa9c Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sat, 20 Aug 2016 19:38:55 +0200 Subject: [PATCH] Compiles and runs now \ o / --- .../Modules/Administration/AdministrationModule.cs | 7 ++++--- .../Modules/Searches/Commands/LoLCommands.cs | 1 + .../Searches/Commands/PokemonSearchCommands.cs | 13 +++++++++---- src/NadekoBot/Modules/Searches/Searches.cs | 2 +- src/NadekoBot/Modules/Utility/Utility.cs | 4 ++-- src/NadekoBot/NuGet.Config | 6 ------ 6 files changed, 17 insertions(+), 16 deletions(-) delete mode 100644 src/NadekoBot/NuGet.Config diff --git a/src/NadekoBot/Modules/Administration/AdministrationModule.cs b/src/NadekoBot/Modules/Administration/AdministrationModule.cs index 4a8ed546..917f8c97 100644 --- a/src/NadekoBot/Modules/Administration/AdministrationModule.cs +++ b/src/NadekoBot/Modules/Administration/AdministrationModule.cs @@ -76,6 +76,7 @@ namespace NadekoBot.Modules.Administration [RequirePermission(GuildPermission.ManageRoles)] public async Task Removerole(IMessage imsg, IGuildUser usr, [Remainder] IRole role) { + var channel = imsg.Channel as ITextChannel; try { await usr.RemoveRolesAsync(role).ConfigureAwait(false); @@ -362,10 +363,10 @@ namespace NadekoBot.Modules.Administration [LocalizedCommand, LocalizedDescription, LocalizedSummary] [RequireContext(ContextType.Guild)] [RequirePermission(GuildPermission.ManageChannels)] - public async Task DelVoiChanl(IMessage imsg, [Remainder] IVoiceChannel channel) + public async Task DelVoiChanl(IMessage imsg, [Remainder] IVoiceChannel voiceChannel) { - await channel.DeleteAsync().ConfigureAwait(false); - await channel.SendMessageAsync($"Removed channel **{channel.Name}**.").ConfigureAwait(false); + await voiceChannel.DeleteAsync().ConfigureAwait(false); + await imsg.Channel.SendMessageAsync($"Removed channel **{voiceChannel.Name}**.").ConfigureAwait(false); } [LocalizedCommand, LocalizedDescription, LocalizedSummary] diff --git a/src/NadekoBot/Modules/Searches/Commands/LoLCommands.cs b/src/NadekoBot/Modules/Searches/Commands/LoLCommands.cs index 81d660f8..edc90d4e 100644 --- a/src/NadekoBot/Modules/Searches/Commands/LoLCommands.cs +++ b/src/NadekoBot/Modules/Searches/Commands/LoLCommands.cs @@ -58,6 +58,7 @@ namespace NadekoBot.Modules.Searches.Commands if (i % 2 == 0 && i != 0) sb.AppendLine(); sb.Append($"`{i + 1}.` **{dataList[i]["name"]}** "); + //sb.AppendLine($" ({dataList[i]["general"]["banRate"]}%)"); } await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false); diff --git a/src/NadekoBot/Modules/Searches/Commands/PokemonSearchCommands.cs b/src/NadekoBot/Modules/Searches/Commands/PokemonSearchCommands.cs index c305fca2..88a1fa65 100644 --- a/src/NadekoBot/Modules/Searches/Commands/PokemonSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/Commands/PokemonSearchCommands.cs @@ -15,13 +15,18 @@ namespace NadekoBot.Modules.Searches.Commands public class PokemonSearchCommands { //todo DB - private static Dictionary pokemons; - private static Dictionary pokemonAbilities; + private static Dictionary pokemons = new Dictionary(); + private static Dictionary pokemonAbilities = new Dictionary(); + + public const string PokemonAbilitiesFile = "data/pokemon/pokemon_abilities.json"; + + public const string PokemonListFile = "data/pokemon/pokemon_list.json"; public PokemonSearchCommands() { - pokemons = JsonConvert.DeserializeObject>(File.ReadAllText("data/pokemon/pokemon_list.json")); - pokemonAbilities = JsonConvert.DeserializeObject>(File.ReadAllText("data/pokemon/pokemon_abilities.json")); + if(File.Exists(PokemonListFile)) + pokemons = JsonConvert.DeserializeObject>(File.ReadAllText(PokemonListFile)); + pokemonAbilities = JsonConvert.DeserializeObject>(File.ReadAllText(PokemonAbilitiesFile)); } [LocalizedCommand, LocalizedDescription, LocalizedSummary] diff --git a/src/NadekoBot/Modules/Searches/Searches.cs b/src/NadekoBot/Modules/Searches/Searches.cs index b8d9b0c7..8854093b 100644 --- a/src/NadekoBot/Modules/Searches/Searches.cs +++ b/src/NadekoBot/Modules/Searches/Searches.cs @@ -17,7 +17,7 @@ using NadekoBot.Modules.Searches.Commands.Models; namespace NadekoBot.Modules.Searches { [Module("~", AppendSpace = false)] - public class Searches : DiscordModule + public partial class Searches : DiscordModule { private IYoutubeService _yt { get; } diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index 63cb2d13..19c3628c 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -26,11 +26,11 @@ namespace NadekoBot.Modules.Utility [RequireContext(ContextType.Guild)] public async Task WhoPlays(IMessage imsg, [Remainder] string game = null) { - var chnl = (IGuildChannel)imsg.Channel; + var channel = imsg.Channel as ITextChannel; game = game.Trim().ToUpperInvariant(); if (string.IsNullOrWhiteSpace(game)) return; - var arr = (await chnl.Guild.GetUsersAsync()) + var arr = (await (imsg.Channel as IGuildChannel).Guild.GetUsersAsync()) .Where(u => u.Game?.Name?.ToUpperInvariant() == game) .Select(u => u.Username) .ToList(); diff --git a/src/NadekoBot/NuGet.Config b/src/NadekoBot/NuGet.Config deleted file mode 100644 index 5d8e9c81..00000000 --- a/src/NadekoBot/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file