0.4.0 • Published 6 days ago

@asanrom/ps-battle-bot-lib v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

Pokemon Showdown battle bot library

npm version Node.js CI License

Library for Pokemon Showdown Bots to be able to participate in battles.

Installing the library

To install the library in your Pokemon Showdown bot project, use:

npm install --save @asanrom/ps-battle-bot-lib

Using the library

In order to add battle functionality to your bot, instantiate PokemonShowdownBattleBot, call receive for each line received from Pokemon Showdown, and listen for the send event in order to send decision commands.

View example

Documentation

Check the documentation for detailed specifications for configuration and available algorithms.

You can also check the auto generated documentation.

Building

In order to build this library, you need:

  • NodeJS, latest stable version.

Run the following command to install dependencies:

npm install

Run the following command to build the typescript into javascript:

npm run build

Running the example

If you want to run the example, type:

npm start

You can configure the bot using environment variables.

You can specify those variables in the .env file, in the current working directory.

Server connection details

Variable NameDescription
SERVER_HOSTPokemon showdown server host. Default: sim3.psim.us
SERVER_PORTPokemon showdown server port. Default 443
SERVER_SSLSet it to YES to use HTTPS. Set it to NO to use regular HTTP. Defaults to YES.
SERVER_IDPokemon showdown server ID. Default: showdown

Credentials

Variable NameDescription
ACCOUNT_NAMEPokemon showdown account name.
ACCOUNT_PASSWORDPokemon showdown account password.

Battle bot configuration

Variable NameDescription
AUTO_SET_TIMERSet it to YES for the bot to automatically set up the timer.
ACCEPT_CHALLENGESSet it to YES for the bot to automatically accept or reject challenges.
CHALLENGE_WHITELISTSpecify the list of usernames the bot will accept challenges from. If not specified, the bot will accept challenges from any user.
AUTO_LADDERSpecify a format name for the bot to search ladder battles automatically.
AUTO_LADDER_DELAYMilliseconds to wait in order to search for the next ladder battle. By default 10000 (10 seconds)
MAX_BATTLESMax number of battles the bot will consider when accepting a challenge, or searching a ladder battle.
TEAMS_PATHPath to the teams folder. This folder must contain sub-folder with the names of the formats, containing each one a list of teams contained in .txt files

Logging

Variable NameDescription
LOG_INFOSet to YES or NO to enable or disable info messages. Enabled by default.
LOG_DEBUGSet to YES or NO to enable or disable debug messages. Disabled by default.
LOG_TRACESet to YES or NO to enable or disable trace messages. Disabled by default.

Other configuration

Variable NameDescription
LOG_BATTLESSet it to YES to log every single battle. Logs will be stored in the logs subfolder.
LOGS_PATHPath to store the battle logs. By default: logs
ROOMS_JOINList of room to join on connection, spit by commas.
0.4.0

6 days ago

0.3.1

7 months ago

0.3.0

7 months ago

0.2.0

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago