Clash of Clans war moniting for telegram channels.
Project description
clashogram
![Pypi status](https://pypi-camo.freetls.fastly.net/78c175571eff858225e853339f8d83f004fc87ae/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f636c6173686f6772616d2e737667)
Clash of Clans war moniting for telegram channels.
NOTE: Clash of Clans API data is always 10 minutes behind the game events. This is not a bug in this program.
clashogram monitors your clan’s warlog and posts the following messages to a Telegram channel:
Preparation started (with clans and players information)
War started
New attacks (with details)
War over
Requirements
To run the program you need to have python 3.3 or higher. You will also need pip to install python dependencies. Moreover, using a virtualenv makes installation much easier, otherwise you have to install everything system-wide. On Linux you would need to run commands with sudo, on windows with administrator account.
Installation
From pypi:
pip install clashogram
From Github:
git clone https://github.com/mehdisadeghi/clashogram.git cd clashogram install -r requirements.txt python setup.py install
Usage
In order to use the program do the following:
Open a Clash of Clans developer account at https://developer.clashofclans.com/.
Find your external IP address using a website like this.
Go to your CoC developer page and create an API token for the IP number you just found.
Create a Telegram bot using BotFather and copy its token.
Create a new Telegram group and add the bot you just created as an administrator to that group.
Now you can run the following command:
pip install clashogram clashogram.py --coc-token <COC_API_TOKEN> --clan-tag <CLAN_TAG> --bot-token <TELEGRAM_BOT_TOKEN> --channel-name <TELEGRAM_CHANNEL_NAME> --forever
In order to have messages in a different locale do the following and then run the program:
export LANGUAGE=<LANGUAGE_CODE> e.g. export LANGUAGE=fa
Or do it in one step:
LANGUAGE=fa clashogram.py --coc-token <COC_API_TOKEN> --clan-tag <CLAN_TAG> --bot-token <TELEGRAM_BOT_TOKEN> --channel-name <TELEGRAM_CHANNEL_NAME>
Setting Language on Windows
Make sure to run set LANGUAGE=<your_lang_code_here> on windows before running the program.
Run as a service
The simplest way to use Clashogram is leave it running in background using either byobu or GNU Screen. Another solution is to install a systemd unit:
[Unit] Description=Clashogram Daemon After=network.target [Service] WorkingDirectory=/path/to/clashogram/ EnvironmentFile=/path/to/env/file ExecStart=/path/to/python /path/to/clashogram.py Restart=on-failure User=someuser [Install] WantedBy=multi-user.target
Search internet for more information on installing systemd units on your OS.
Contribution (PRs welcome!)
The Telegram notification is isolated from the rest of the program. You can replace it with anything else to have your messages sent to somewhere else.
Fork and clone the repository and send a PR. Make sure tests pass beforehand:
python -m unittest discover
Or with py.test:
pip install pytest py.test tests.py
I18N
In order toadd or update a new language catalog do the following:
pip install babel # Install the babel i18n tool first.
python setup.py init_catalog -l <LANGUAGE_CODE> python setup.py update_catalog -l <LANGUAGE_CODE>
For example:
python setup.py init_catalog -l fa python setup.py update_catalog -l fa
In case of adding new messages extract them and compile again:
python setup.py extract_messages python setup.py compile_catalog
For more information on internationalization see Babel.
Credits
Thanks Ali Ayatollahi and other members from IRAN clan (tag #YVL0C8UY) for the initial idea and testing.
License
MIT
Russian Translations
You can read this document in Russian thanks to Timur from Illuminati clan. Thanks Timur! this document in Russian
راهنمای فارسی
برای مطالعه راهنمای فارسی به این آدرس سر بزنید.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for Clashogram-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1331698ab5c17c731390dcc3ccc5568bed60a5ecd43e4f1da14305b80ea06941 |
|
MD5 | bea7e3b1cea69089d6b95f7a9b3e1377 |
|
BLAKE2b-256 | 55f1197fbb7c81c20e80ec1705c32fe452aa806f7880cf5e051cec4950bbf435 |