speed

package
v1.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SpeedCommand

func SpeedCommand() (string, error)

Types

type PokemonDetails

type PokemonDetails struct {
	Name       string
	SpeedStage string
	Nature     string
	Level      string
	Modifier   []string
	Ability    string
	SpeedEV    string
	SpeedIV    string
}

type SpeedStatFunc

type SpeedStatFunc func(name string) (string, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL