{"id":21972802,"url":"https://github.com/agustinsrg/ps-battle-bot-lib","last_synced_at":"2025-03-22T23:14:48.047Z","repository":{"id":193559409,"uuid":"684165014","full_name":"AgustinSRG/ps-battle-bot-lib","owner":"AgustinSRG","description":"Library for Pokemon Showdown bots to be able to participate in battles.","archived":false,"fork":false,"pushed_at":"2025-02-15T11:00:55.000Z","size":1214,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T12:18:07.057Z","etag":null,"topics":["battle","bot","library","nodejs","pokemon","showdown"],"latest_commit_sha":null,"homepage":"https://agustinsrg.github.io/ps-battle-bot-lib/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AgustinSRG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-28T15:31:36.000Z","updated_at":"2025-02-15T11:00:59.000Z","dependencies_parsed_at":"2025-02-15T12:18:09.855Z","dependency_job_id":"efa27073-a23c-4db6-957e-5f04b36fad4c","html_url":"https://github.com/AgustinSRG/ps-battle-bot-lib","commit_stats":null,"previous_names":["agustinsrg/ps-battle-bot-lib"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgustinSRG%2Fps-battle-bot-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgustinSRG%2Fps-battle-bot-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgustinSRG%2Fps-battle-bot-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgustinSRG%2Fps-battle-bot-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AgustinSRG","download_url":"https://codeload.github.com/AgustinSRG/ps-battle-bot-lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245031516,"owners_count":20549926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["battle","bot","library","nodejs","pokemon","showdown"],"created_at":"2024-11-29T15:21:20.396Z","updated_at":"2025-03-22T23:14:48.016Z","avatar_url":"https://github.com/AgustinSRG.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pokemon Showdown battle bot library\n\n[![npm version](https://badge.fury.io/js/%40asanrom%2Fps-battle-bot-lib.svg)](https://badge.fury.io/js/%40asanrom%2Fps-battle-bot-lib)\n[![Node.js CI](https://github.com/AgustinSRG/ps-battle-bot-lib/actions/workflows/node.js.yml/badge.svg)](https://github.com/AgustinSRG/ps-battle-bot-lib/actions/workflows/node.js.yml)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/AgustinSRG/ps-battle-bot-lib/blob/master/LICENSE)\n\nLibrary for Pokemon Showdown Bots to be able to participate in battles. \n\n## Installing the library\n\nTo install the library in your Pokemon Showdown bot project, use:\n\n```sh\nnpm install --save @asanrom/ps-battle-bot-lib\n```\n\n## Using the library\n\nIn 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.\n\n[View example](./src/examples/example.ts)\n\n## Documentation\n\nCheck the [documentation](./DOCUMENTATION.md) for detailed specifications for configuration and available algorithms.\n\nYou can also check the [auto generated documentation](https://agustinsrg.github.io/ps-battle-bot-lib/).\n\n## Building\n\nIn order to build this library, you need:\n\n - [NodeJS](https://nodejs.org/en), latest stable version.\n\nRun the following command to install dependencies:\n\n```sh\nnpm install\n```\n\nRun the following command to build the typescript into javascript:\n\n```sh\nnpm run build\n```\n\n## Running the example\n\nIf you want to run the example, type:\n\n```\nnpm start\n```\n\nYou can configure the bot using environment variables.\n\nYou can specify those variables in the `.env` file, in the current working directory.\n\n\n### Server connection details\n\n| Variable Name | Description                                                                          |\n| ------------- | ------------------------------------------------------------------------------------ |\n| SERVER_HOST   | Pokemon showdown server host. Default: `sim3.psim.us`                                |\n| SERVER_PORT   | Pokemon showdown server port. Default `443`                                          |\n| SERVER_SSL    | Set it to `YES` to use HTTPS. Set it to `NO` to use regular HTTP. Defaults to `YES`. |\n| SERVER_ID     | Pokemon showdown server ID. Default: `showdown`                                      |\n\n### Credentials\n\n| Variable Name    | Description                        |\n| ---------------- | ---------------------------------- |\n| ACCOUNT_NAME     | Pokemon showdown account name.     |\n| ACCOUNT_PASSWORD | Pokemon showdown account password. |\n\n### Battle bot configuration\n\n| Variable Name       | Description                                                                                                                                                |\n| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| AUTO_SET_TIMER      | Set it to `YES` for the bot to automatically set up the timer.                                                                                             |\n| ACCEPT_CHALLENGES   | Set it to `YES` for the bot to automatically accept or reject challenges.                                                                                  |\n| CHALLENGE_WHITELIST | Specify the list of usernames the bot will accept challenges from. If not specified, the bot will accept challenges from any user.                         |\n| AUTO_LADDER         | Specify a format name for the bot to search ladder battles automatically.                                                                                  |\n| AUTO_LADDER_DELAY   | Milliseconds to wait in order to search for the next ladder battle. By default `10000` (10 seconds)                                                        |\n| MAX_BATTLES         | Max number of battles the bot will consider when accepting a challenge, or searching a ladder battle.                                                      |\n| 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 |\n\n### Logging\n\n| Variable Name | Description                                                                    |\n| ------------- | ------------------------------------------------------------------------------ |\n| LOG_INFO      | Set to `YES` or `NO` to enable or disable info messages. Enabled by default.   |\n| LOG_DEBUG     | Set to `YES` or `NO` to enable or disable debug messages. Disabled by default. |\n| LOG_TRACE     | Set to `YES` or `NO` to enable or disable trace messages. Disabled by default. |\n\n### Other configuration\n\n| Variable Name | Description                                                                              |\n| ------------- | ---------------------------------------------------------------------------------------- |\n| LOG_BATTLES   | Set it to `YES` to log every single battle. Logs will be stored in the `logs` subfolder. |\n| LOGS_PATH     | Path to store the battle logs. By default: `logs`                                        |\n| ROOMS_JOIN    | List of room to join on connection, spit by commas.                                      |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagustinsrg%2Fps-battle-bot-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagustinsrg%2Fps-battle-bot-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagustinsrg%2Fps-battle-bot-lib/lists"}