Skip to content

Python bot for the browser game Grepolis

Notifications You must be signed in to change notification settings

s2Leuhan/GrepoBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grepoBot

!Warning!

Use at your own risk.
I'm not responsible if you get banned for using this bot. I personally never got banned using this bot and have been using it for 2+ years so you should be fine.

About The Project

Bot for grepolis written in Python.
This bot only uses requests to communicate with the game so it's entirely possible to run this bot on another server unlike some other bots I have seen for this game made with Selenium. I personally stopped playing grepolis a couple months ago and therefore stopped working on this project and will probably not be updating this.
Most of the code is pretty self explanatory.
I used the bot for over 2 years and never got banned, even when I was sending 10 support/attack requests in a second to time attacks/destroy enemy colony ships.
There's a limit to the amount of attack requests you can send in a minute which I think is 10.
There's no limit to the amount of support requests you can send which makes the bot really powerful to save your cities when you know the arrival time of a colony ship.

Features include:

  • Sending and timing attacks
  • farming villages
  • building buildings
  • recruiting units
  • GoldBot to automatically exchange resources for gold

(back to top)

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • Version of Python greater than 3.6
  • You need the Administrator in Grepolis ! (You can easily get the gold to buy him using the goldbot)

Installation

Youtube tutorial: GrepoBot setup

  1. Clone the repo
    git clone https://github.com/B1GJ/GrepoBot.git
  2. Install necessary packages
     pip install -r requirements.txt
  3. Create a .env file in the source directory
     touch .env
  4. Copy/paste below and fill in with ur own values.
     WORLD=""
     CSRF_TOKEN=""
     H_TOKEN=""
     DISCORD_HOOK=""

How to get the values for the .env file

  1. Open grepolis and login to your favorite world.
  2. In the top left, the first characters will contain the world name. For example, nl105.
    Image of world name
  3. Open the network tab in your browser and filter on XHR.
  4. Click on any request
  5. In the request headers, you will find the CSRF_TOKEN (sid) and H_TOKEN (h_token).
  6. Paste these in your .env file.

Warning: These tokens change everytime you log out and log back in so you'll have to change these quite often.

Usage

main.py

This is the main file that will run the bot.
This will instantiate an instance of the GrepoBot class and call the main() method.
GrepoBot takes a list of City objects as an input.
City takes the bb_code of the town as an input.
Be sure to change all the bb_codes to the bb_codes of your cities.

Once you've done that you can just run main.py

python main.py

Example output running main.py main

GrepoBot.py

By default this will:

  • Farm all villages of all cities and wait between 600 and 650 seconds before starting the next cycle.
  • Check for possible buildings to upgrade and upgrade them if possible
  • Constantly checks the market to see if it's possible to exchange resources for gold. After 3 times you'll have to manually fill in a captcha. The bot will automatically send a message to a discord Webhook to alert the user when a captcha is required.
  • Constantly checks the commands to see if we're getting attacked. If we're getting attacked, it will send a message to a discord Webhook to alert the user. Also possible to automatically dodge an attack (but disabled by default) CommandChecker Alert Example

TimeBot.py

To time attack or support requests. Click the link below to watch a demo on how to time your attack/support.

TimeBot demo

GoldBot.py

Constantly checks the market to see if it's possible to exchange resources for gold. After 3 times you'll have to manually fill in a captcha. The bot will automatically send a message to a discord Webhook to alert the user when a captcha is required.

I was able to farm around 500-1000 gold a day using this bot on a single world. You'll make a lot of gold combining the farmbot and this goldbot on a newly started world since a lot of players will be asking for resources in the beginning. GoldBot Alert

(back to top)

About

Python bot for the browser game Grepolis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages