Api to create a bot for ogame
This Api allow direct intercation on user account.
It is writen in typescript
It uses puppeteer to simulate user interactions and get game informations.
Install from npm to your dependencies ogame-bot-api
npm install --save ogame-bot-api
There is two API:
- the
LobbyApi
that is used to login the user and get user servers info - the
GameApi
that is used to interact with the game itself, create and list ressources/ship/research...
Documentation can be found here
LobbyApi
- Login
- List servers
- List user servers
- Connect to game api
GameApi
- list and upgrade
- resources
- mines
- storage
- researsh
- lists and create
- ships
- defenses
- list and upgrade
Multiples examples can be found in examples
folder
Here is a simple one to list user resources.
const { LobbyApi } = require('ogame-bot-api');
async function main() {
const api = new LobbyApi();
await api.login('[email protected]', 'password');
const account = await api.selectLastPlayedAccount();
const game = await api.loadGame(account);
const resources = await game.resourcesList();
console.log(resources);
await game.stop();
}
main();
A simple one to create a ship
const { LobbyApi } = require('ogame-bot-api');
function main() {
const api = new LobbyApi();
await api.login('[email protected]', 'password');
const account = await api.selectLastPlayedAccount();
const game = await api.loadGame(account);
const ships = await game.shipList();
if (await game.canCreate(ships.fighterLight)) {
await game.createShip(ships.fighterLight);
console.log('Ship created !');
} else {
console.log(`Can't create ship`);
}
await game.stop();
}
A bot is currently in development
Install it globally from npm ogame-bot-api
npm install -g ogame-bot-api
Then start it:
ogame-bot --mail [mail] --password [password]
If you have any issues or want some new feature don't esitate to create an issue
Fell free to contrubite, particullary on the bot, fork the repo and create a pull request