Scripts to automate tasks in Clash of Clans using the official API. These scripts allow you to retrieve up-to-date information about your clan, members, and other related data. The following steps explain how to set up and run the scripts.
- Requirements
- Installing Python
- Getting Your Clash of Clans API Token
- Getting Your Clan Tag
- Configuring Text Files
- Running the Scripts
- Contributing
- Operating System: Windows, MacOS, or Linux
- Python: Version 3.6 or higher (see installation instructions below)
- Clash of Clans Account: Needed to obtain the API token and clan tag
If you don’t already have Python installed, follow these steps:
-
Download Python from the official Python website.
-
Install Python: During installation, select the “Add Python to PATH” checkbox to simplify usage of Python from the command line.
-
Verify the installation: Open a terminal or command prompt and run:
python --version
You should see the installed Python version. If a version number appears, the installation was successful.
To use the Clash of Clans API, you’ll need a token to authenticate your application. Follow these steps to get it:
- Go to the Clash of Clans API site at developer.clashofclans.com.
- Log in with your Supercell account.
- On the main page, create a new API Key:
- Add a brief description.
- Enter the IP from which you’ll run the script (you can find your current IP by searching “my IP” on Google).
- Copy the generated API token and save it, as you’ll need it to set up the script.
- Open the Clash of Clans app on your device.
- Go to your clan’s page and copy the clan tag, which appears directly below the clan name and begins with the
#
symbol. - Write down this tag, as you’ll need it to set up the script.
The repository includes two text files in the info_to_add
folder:
- api_key.txt: Paste your Clash of Clans API token here.
- clan_tag.txt: Paste your clan tag here.
To set up these files:
- Open
info_to_add/api_key.txt
in a text editor and paste your API token into this file. - Open
info_to_add/clan_tag.txt
and paste your clan tag into this file. - Save both files.
Note: These files are included in .gitignore
, so your credentials won’t be uploaded to GitHub if you make changes to them.
To run the scripts, simply double-click on the .py
file you want to execute. Ensure that the api_key.txt
and clan_tag.txt
files are correctly configured, as the scripts will use them for authentication and to retrieve clan data.
If you encounter issues with double-clicking, you can also run the scripts from the command line:
-
Open a terminal in the project folder.
-
Run the following command, replacing
script.py
with the name of the script file:python script.py
If you would like to contribute to this project:
- Fork this repository.
- Create a new branch (
git checkout -b feature/new-feature
). - Make your changes and commit them (
git commit -m "Add new feature"
). - Push your changes (
git push origin feature/new-feature
). - Open a Pull Request on GitHub.
Thank you for contributing to the CoC Scripts project!