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.
There is two API:
LobbyApi
that is used to login the user and get user servers infoGameApi
that is used to interact with the game itself, create and list ressources/ship/research...Documentation can be found here
LobbyApi
GameApi
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('mail@gmail.com', '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('mail@gmail.com', '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();
}
Generated using TypeDoc