npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@asanrom/ps-battle-bot-lib

v0.4.0

Published

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

Downloads

9

Readme

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 Name | Description | | ------------- | ------------------------------------------------------------------------------------ | | SERVER_HOST | Pokemon showdown server host. Default: sim3.psim.us | | SERVER_PORT | Pokemon showdown server port. Default 443 | | SERVER_SSL | Set it to YES to use HTTPS. Set it to NO to use regular HTTP. Defaults to YES. | | SERVER_ID | Pokemon showdown server ID. Default: showdown |

Credentials

| Variable Name | Description | | ---------------- | ---------------------------------- | | ACCOUNT_NAME | Pokemon showdown account name. | | ACCOUNT_PASSWORD | Pokemon showdown account password. |

Battle bot configuration

| Variable Name | Description | | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | AUTO_SET_TIMER | Set it to YES for the bot to automatically set up the timer. | | ACCEPT_CHALLENGES | Set it to YES for the bot to automatically accept or reject challenges. | | CHALLENGE_WHITELIST | Specify the list of usernames the bot will accept challenges from. If not specified, the bot will accept challenges from any user. | | AUTO_LADDER | Specify a format name for the bot to search ladder battles automatically. | | AUTO_LADDER_DELAY | Milliseconds to wait in order to search for the next ladder battle. By default 10000 (10 seconds) | | MAX_BATTLES | Max number of battles the bot will consider when accepting a challenge, or searching a ladder battle. | | TEAMS_PATH | Path 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 Name | Description | | ------------- | ------------------------------------------------------------------------------ | | LOG_INFO | Set to YES or NO to enable or disable info messages. Enabled by default. | | LOG_DEBUG | Set to YES or NO to enable or disable debug messages. Disabled by default. | | LOG_TRACE | Set to YES or NO to enable or disable trace messages. Disabled by default. |

Other configuration

| Variable Name | Description | | ------------- | ---------------------------------------------------------------------------------------- | | LOG_BATTLES | Set it to YES to log every single battle. Logs will be stored in the logs subfolder. | | LOGS_PATH | Path to store the battle logs. By default: logs | | ROOMS_JOIN | List of room to join on connection, spit by commas. |