JsKingBoo / SableyeBot3

Competitive Pokemon Discord Bot
9 stars 7 forks source link

Use PokemonShowdown as a package dependency instead of a repository dependency #27

Closed JsKingBoo closed 2 years ago

JsKingBoo commented 2 years ago

PokemonShowdown is undeniably the only source of competitive Pokemon data. However, back in 2016 or whenever I first started coding up SableyeBot their database was nonstandard and not built for 3rd party consumption. As a workaround, I duplicated and rebuilt the entire PokemonShowdown repository in order to consume their API. Additionally, they had no obligation to consider or notify any consumers when making breaking changes.

We no longer need to do that. According to this README, this changed last year and Pokemon Showdown is now available as a node API:

https://github.com/smogon/pokemon-showdown/blob/master/sim/README.md

We can also simulate battles and validate and generate teams using this API, although why would you do that on a Discord bot when Pokemon Showdown (the website) exists

JsKingBoo commented 2 years ago

https://github.com/Stalruth/SableyeBot4

well im idiot

Stalruth commented 2 years ago

To be more precise about the solution chosen for SableyeBot4, it uses the @pkmn packages that are automatically generated from Pokemon Showdown.

The @pkmn/sim package contains all of the data, which gets wrapped by @pkmn/data into a form that does filtering out Custom and CAP Pokemon for us.

@pkmn/img Is used for sprites and @pkmn/mods allows for easy support for Mods such as BD/Sp, which is not trivial on version 3 AFAICT (and also hasn't been done).