Compiles and runs now \ o /

This commit is contained in:
Kwoth 2016-08-20 19:38:55 +02:00
parent c446b889c7
commit 1d685757bf
6 changed files with 17 additions and 16 deletions

View File

@ -76,6 +76,7 @@ namespace NadekoBot.Modules.Administration
[RequirePermission(GuildPermission.ManageRoles)] [RequirePermission(GuildPermission.ManageRoles)]
public async Task Removerole(IMessage imsg, IGuildUser usr, [Remainder] IRole role) public async Task Removerole(IMessage imsg, IGuildUser usr, [Remainder] IRole role)
{ {
var channel = imsg.Channel as ITextChannel;
try try
{ {
await usr.RemoveRolesAsync(role).ConfigureAwait(false); await usr.RemoveRolesAsync(role).ConfigureAwait(false);
@ -362,10 +363,10 @@ namespace NadekoBot.Modules.Administration
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[RequirePermission(GuildPermission.ManageChannels)] [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 voiceChannel.DeleteAsync().ConfigureAwait(false);
await channel.SendMessageAsync($"Removed channel **{channel.Name}**.").ConfigureAwait(false); await imsg.Channel.SendMessageAsync($"Removed channel **{voiceChannel.Name}**.").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]

View File

@ -58,6 +58,7 @@ namespace NadekoBot.Modules.Searches.Commands
if (i % 2 == 0 && i != 0) if (i % 2 == 0 && i != 0)
sb.AppendLine(); sb.AppendLine();
sb.Append($"`{i + 1}.` **{dataList[i]["name"]}** "); sb.Append($"`{i + 1}.` **{dataList[i]["name"]}** ");
//sb.AppendLine($" ({dataList[i]["general"]["banRate"]}%)");
} }
await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false); await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false);

View File

@ -15,13 +15,18 @@ namespace NadekoBot.Modules.Searches.Commands
public class PokemonSearchCommands public class PokemonSearchCommands
{ {
//todo DB //todo DB
private static Dictionary<string, SearchPokemon> pokemons; private static Dictionary<string, SearchPokemon> pokemons = new Dictionary<string, SearchPokemon>();
private static Dictionary<string, SearchPokemonAbility> pokemonAbilities; private static Dictionary<string, SearchPokemonAbility> pokemonAbilities = new Dictionary<string, SearchPokemonAbility>();
public const string PokemonAbilitiesFile = "data/pokemon/pokemon_abilities.json";
public const string PokemonListFile = "data/pokemon/pokemon_list.json";
public PokemonSearchCommands() public PokemonSearchCommands()
{ {
pokemons = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemon>>(File.ReadAllText("data/pokemon/pokemon_list.json")); if(File.Exists(PokemonListFile))
pokemonAbilities = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemonAbility>>(File.ReadAllText("data/pokemon/pokemon_abilities.json")); pokemons = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemon>>(File.ReadAllText(PokemonListFile));
pokemonAbilities = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemonAbility>>(File.ReadAllText(PokemonAbilitiesFile));
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]

View File

@ -17,7 +17,7 @@ using NadekoBot.Modules.Searches.Commands.Models;
namespace NadekoBot.Modules.Searches namespace NadekoBot.Modules.Searches
{ {
[Module("~", AppendSpace = false)] [Module("~", AppendSpace = false)]
public class Searches : DiscordModule public partial class Searches : DiscordModule
{ {
private IYoutubeService _yt { get; } private IYoutubeService _yt { get; }

View File

@ -26,11 +26,11 @@ namespace NadekoBot.Modules.Utility
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task WhoPlays(IMessage imsg, [Remainder] string game = null) 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(); game = game.Trim().ToUpperInvariant();
if (string.IsNullOrWhiteSpace(game)) if (string.IsNullOrWhiteSpace(game))
return; return;
var arr = (await chnl.Guild.GetUsersAsync()) var arr = (await (imsg.Channel as IGuildChannel).Guild.GetUsersAsync())
.Where(u => u.Game?.Name?.ToUpperInvariant() == game) .Where(u => u.Game?.Name?.ToUpperInvariant() == game)
.Select(u => u.Username) .Select(u => u.Username)
.ToList(); .ToList();

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key=".Net Core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
</packageSources>
</configuration>