2016-08-16 12:11:45 +00:00
|
|
|
|
using Discord;
|
|
|
|
|
using Discord.Commands;
|
2016-12-09 03:22:23 +00:00
|
|
|
|
using NadekoBot.Extensions;
|
2017-07-17 19:42:36 +00:00
|
|
|
|
using NadekoBot.Modules.Searches.Services;
|
2016-06-26 19:33:25 +00:00
|
|
|
|
using System.Collections.Generic;
|
2016-12-09 03:22:23 +00:00
|
|
|
|
using System.Linq;
|
2016-08-16 12:11:45 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2017-07-17 19:42:36 +00:00
|
|
|
|
using NadekoBot.Common.Attributes;
|
|
|
|
|
using NadekoBot.Modules.Searches.Common;
|
2016-06-26 19:33:25 +00:00
|
|
|
|
|
2016-08-20 20:35:27 +00:00
|
|
|
|
namespace NadekoBot.Modules.Searches
|
2016-06-26 19:33:25 +00:00
|
|
|
|
{
|
2016-08-20 20:35:27 +00:00
|
|
|
|
public partial class Searches
|
2016-06-26 19:33:25 +00:00
|
|
|
|
{
|
2016-08-16 12:11:45 +00:00
|
|
|
|
[Group]
|
2017-07-15 16:34:34 +00:00
|
|
|
|
public class PokemonSearchCommands : NadekoSubmodule<SearchesService>
|
2016-06-26 19:33:25 +00:00
|
|
|
|
{
|
2017-07-15 16:34:34 +00:00
|
|
|
|
public Dictionary<string, SearchPokemon> Pokemons => _service.Pokemons;
|
|
|
|
|
public Dictionary<string, SearchPokemonAbility> PokemonAbilities => _service.PokemonAbilities;
|
2016-06-26 19:33:25 +00:00
|
|
|
|
|
2016-10-05 03:09:44 +00:00
|
|
|
|
[NadekoCommand, Usage, Description, Aliases]
|
2016-12-16 18:43:57 +00:00
|
|
|
|
public async Task Pokemon([Remainder] string pokemon = null)
|
2016-08-16 12:11:45 +00:00
|
|
|
|
{
|
|
|
|
|
pokemon = pokemon?.Trim().ToUpperInvariant();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(pokemon))
|
|
|
|
|
return;
|
2016-06-26 19:33:25 +00:00
|
|
|
|
|
2017-05-27 08:19:27 +00:00
|
|
|
|
foreach (var kvp in Pokemons)
|
2016-06-26 19:33:25 +00:00
|
|
|
|
{
|
2016-08-16 12:11:45 +00:00
|
|
|
|
if (kvp.Key.ToUpperInvariant() == pokemon.ToUpperInvariant())
|
2016-06-26 19:33:25 +00:00
|
|
|
|
{
|
2016-12-09 03:22:23 +00:00
|
|
|
|
var p = kvp.Value;
|
2016-12-31 10:55:12 +00:00
|
|
|
|
await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
2016-12-09 03:22:23 +00:00
|
|
|
|
.WithTitle(kvp.Key.ToTitleCase())
|
|
|
|
|
.WithDescription(p.BaseStats.ToString())
|
2017-02-24 16:10:44 +00: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 12:11:45 +00:00
|
|
|
|
return;
|
2016-06-26 19:33:25 +00:00
|
|
|
|
}
|
2016-08-16 12:11:45 +00:00
|
|
|
|
}
|
2017-02-24 16:10:44 +00:00
|
|
|
|
await ReplyErrorLocalized("pokemon_none").ConfigureAwait(false);
|
2016-08-16 12:11:45 +00:00
|
|
|
|
}
|
2016-06-26 19:33:25 +00:00
|
|
|
|
|
2016-10-05 03:09:44 +00:00
|
|
|
|
[NadekoCommand, Usage, Description, Aliases]
|
2016-12-16 18:43:57 +00:00
|
|
|
|
public async Task PokemonAbility([Remainder] string ability = null)
|
2016-08-16 12:11:45 +00:00
|
|
|
|
{
|
|
|
|
|
ability = ability?.Trim().ToUpperInvariant().Replace(" ", "");
|
|
|
|
|
if (string.IsNullOrWhiteSpace(ability))
|
|
|
|
|
return;
|
2017-05-27 08:19:27 +00:00
|
|
|
|
foreach (var kvp in PokemonAbilities)
|
2016-08-16 12:11:45 +00:00
|
|
|
|
{
|
|
|
|
|
if (kvp.Key.ToUpperInvariant() == ability)
|
|
|
|
|
{
|
2016-12-31 10:55:12 +00:00
|
|
|
|
await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
2016-12-09 03:22:23 +00:00
|
|
|
|
.WithTitle(kvp.Value.Name)
|
2017-02-25 02:43:30 +00: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 18:43:57 +00:00
|
|
|
|
).ConfigureAwait(false);
|
2016-08-16 12:11:45 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-24 16:10:44 +00:00
|
|
|
|
await ReplyErrorLocalized("pokemon_ability_none").ConfigureAwait(false);
|
2016-08-16 12:11:45 +00:00
|
|
|
|
}
|
2016-06-26 19:33:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-20 20:35:27 +00:00
|
|
|
|
}
|