This is a simple example of how you could implement a pokerwars.io bot with javascript and node.js. This bot will fold every hand, you should change this and try to implement your own strategy!
A few requirements to play:
- have node.js installed
- make sure that the computer where your bot runs is visible from the internet, so we can communicate with him/her. This is an useful service to double check this. Bot default port is
3000
, but you can change this on theserver.js
file. If you need help to open a port on your router check this guide or contact us. We are always willing to help you. - Register with us and retrieve your API token and username.
- check out this repo with git or download it from this link.
- in the code you just downloaded, rename
.env_example
as.env
and update with your username, API token and bot ip address:
USERNAME=insert here your bot username, find it at https://www.pokerwars.io/profile
API_TOKEN=insert here your api token, find it at https://www.pokerwars.io/token
BOT_ENDPOINT=insert here your bot ip address. i.e.: http://1.2.3.4:3000
Now you can implement your own poker strategy and play!
Now you are ready to run the bot!
[pokerwars.io-starterbot-javascript]$ npm install
[pokerwars.io-starterbot-javascript]$ npm run start
The bot will try to subscribe to pokerwars.io when it starts up. If no errors happens, it will start playing straightaway, otherwise you should see an error. The most common is that we cannot see your bot, please double check your bot is visible from the internet and you have configured your router correctly. If you do not have access to your router or your bot is behind a firewall, try ngrok.
It's easy:
- Import this repo into a new Glitch project
- Check the Live App URL for your project under
Share
(it will look like https://<MY_POKERWARS_BOT>.glitch.me), you will use it as your BOT_ENDPOINT - Update your
.env
file as described above - Start remixing!
Have fun!
If something is not clear in this code, refer to also to our documentation for the structure and content of the data we send to your bot. How you choose to manipulate that information to inform your bot's strategy is up to you!