2016-08-16 14:11:45 +02:00
|
|
|
|
using Discord;
|
|
|
|
|
using Discord.Commands;
|
2016-12-09 04:22:23 +01:00
|
|
|
|
using NadekoBot.Extensions;
|
2017-07-17 21:42:36 +02:00
|
|
|
|
using NadekoBot.Modules.Searches.Services;
|
2016-06-26 21:33:25 +02:00
|
|
|
|
using System.Collections.Generic;
|
2016-12-09 04:22:23 +01:00
|
|
|
|
using System.Linq;
|
2016-08-16 14:11:45 +02:00
|
|
|
|
using System.Threading.Tasks;
|
2017-07-17 21:42:36 +02:00
|
|
|
|
using NadekoBot.Common.Attributes;
|
|
|
|
|
using NadekoBot.Modules.Searches.Common;
|
2016-06-26 21:33:25 +02:00
|
|
|
|
|
2016-08-20 22:35:27 +02:00
|
|
|
|
namespace NadekoBot.Modules.Searches
|
2016-06-26 21:33:25 +02:00
|
|
|
|
{
|
2016-08-20 22:35:27 +02:00
|
|
|
|
public partial class Searches
|
2016-06-26 21:33:25 +02:00
|
|
|
|
{
|
2016-08-16 14:11:45 +02:00
|
|
|
|
[Group]
|
2017-07-15 18:34:34 +02:00
|
|
|
|
public class PokemonSearchCommands : NadekoSubmodule<SearchesService>
|
2016-06-26 21:33:25 +02:00
|
|
|
|
{
|
2017-07-15 18:34:34 +02:00
|
|
|
|
public Dictionary<string, SearchPokemon> Pokemons => _service.Pokemons;
|
|
|
|
|
public Dictionary<string, SearchPokemonAbility> PokemonAbilities => _service.PokemonAbilities;
|
2016-06-26 21:33:25 +02:00
|
|
|
|
|
2016-10-05 05:09:44 +02:00
|
|
|
|
[NadekoCommand, Usage, Description, Aliases]
|
2016-12-16 19:43:57 +01:00
|
|
|
|
public async Task Pokemon([Remainder] string pokemon = null)
|
2016-08-16 14:11:45 +02:00
|
|
|
|
{
|
|
|
|
|
pokemon = pokemon?.Trim().ToUpperInvariant();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(pokemon))
|
|
|
|
|
return;
|
2016-06-26 21:33:25 +02:00
|
|
|
|
|
2017-05-27 10:19:27 +02:00
|
|
|
|
foreach (var kvp in Pokemons)
|
2016-06-26 21:33:25 +02:00
|
|
|
|
{
|
2016-08-16 14:11:45 +02:00
|
|
|
|
if (kvp.Key.ToUpperInvariant() == pokemon.ToUpperInvariant())
|
2016-06-26 21:33:25 +02:00
|
|
|
|
{
|
2016-12-09 04:22:23 +01:00
|
|
|
|
var p = kvp.Value;
|
2016-12-31 11:55:12 +01:00
|
|
|
|
await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
2016-12-09 04:22:23 +01:00
|
|
|
|
.WithTitle(kvp.Key.ToTitleCase())
|
|
|
|
|
.WithDescription(p.BaseStats.ToString())
|
2017-02-24 17:10:44 +01:00
|
|
|
|
.AddField(efb => efb.WithName(GetText("types")).WithValue(string.Join(",\n", p.Types)).WithIsInline(true))
|
|
|
|
|
.AddField(efb => efb.WithName(GetText("height_weight")).WithValue(GetText("height_weight_val", p.HeightM, p.WeightKg)).WithIsInline(true))
|
|
|
|
|
.AddField(efb => efb.WithName(GetText("abilities")).WithValue(string.Join(",\n", p.Abilities.Select(a => a.Value))).WithIsInline(true)));
|
2016-08-16 14:11:45 +02:00
|
|
|
|
return;
|
2016-06-26 21:33:25 +02:00
|
|
|
|
}
|
2016-08-16 14:11:45 +02:00
|
|
|
|
}
|
2017-02-24 17:10:44 +01:00
|
|
|
|
await ReplyErrorLocalized("pokemon_none").ConfigureAwait(false);
|
2016-08-16 14:11:45 +02:00
|
|
|
|
}
|
2016-06-26 21:33:25 +02:00
|
|
|
|
|
2016-10-05 05:09:44 +02:00
|
|
|
|
[NadekoCommand, Usage, Description, Aliases]
|
2016-12-16 19:43:57 +01:00
|
|
|
|
public async Task PokemonAbility([Remainder] string ability = null)
|
2016-08-16 14:11:45 +02:00
|
|
|
|
{
|
|
|
|
|
ability = ability?.Trim().ToUpperInvariant().Replace(" ", "");
|
|
|
|
|
if (string.IsNullOrWhiteSpace(ability))
|
|
|
|
|
return;
|
2017-05-27 10:19:27 +02:00
|
|
|
|
foreach (var kvp in PokemonAbilities)
|
2016-08-16 14:11:45 +02:00
|
|
|
|
{
|
|
|
|
|
if (kvp.Key.ToUpperInvariant() == ability)
|
|
|
|
|
{
|
2016-12-31 11:55:12 +01:00
|
|
|
|
await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
2016-12-09 04:22:23 +01:00
|
|
|
|
.WithTitle(kvp.Value.Name)
|
2017-02-25 03:43:30 +01:00
|
|
|
|
.WithDescription(string.IsNullOrWhiteSpace(kvp.Value.Desc)
|
|
|
|
|
? kvp.Value.ShortDesc
|
|
|
|
|
: kvp.Value.Desc)
|
|
|
|
|
.AddField(efb => efb.WithName(GetText("rating"))
|
|
|
|
|
.WithValue(kvp.Value.Rating.ToString(_cultureInfo)).WithIsInline(true))
|
2016-12-16 19:43:57 +01:00
|
|
|
|
).ConfigureAwait(false);
|
2016-08-16 14:11:45 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-24 17:10:44 +01:00
|
|
|
|
await ReplyErrorLocalized("pokemon_ability_none").ConfigureAwait(false);
|
2016-08-16 14:11:45 +02:00
|
|
|
|
}
|
2016-06-26 21:33:25 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-20 22:35:27 +02:00
|
|
|
|
}
|