Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SpeedCommand ¶
Types ¶
type PokemonDetails ¶
type SpeedStatFunc ¶
SpeedStatFunc is a function type for getting a Pokémon's base speed stat
var DefaultSpeedStat SpeedStatFunc = func(name string) (string, error) { pokemonStruct, _, err := connections.PokemonApiCall("pokemon", name, connections.APIURL) if err != nil { return "", fmt.Errorf("API call failed: %w", err) } for _, stat := range pokemonStruct.Stats { if stat.Stat.Name == "speed" { return strconv.Itoa(stat.BaseStat), nil } } return "", errors.New("speed stat not found") }
DefaultSpeedStat is the default implementation of SpeedStatFunc
Click to show internal directories.
Click to hide internal directories.