宗族冲突的电报频道监视。
clashogram的Python项目详细描述
内容
Clashogram![Build Status](https://warehouse-camo.cmh1.psfhosted.org/7a1430c4358227736363d4b04151641fc2656c5b/68747470733a2f2f7472617669732d63692e6f72672f6d65686469736164656768692f636c6173686f6772616d2e7376673f6272616e63683d6d6173746572)
![Build status](https://warehouse-camo.cmh1.psfhosted.org/4860d5ed656210266a7809388ab300ee32818a3b/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6f76697872686d7370336f67346e74342f6272616e63682f6d61737465723f7376673d74727565)
![Pypi status](https://warehouse-camo.cmh1.psfhosted.org/78c175571eff858225e853339f8d83f004fc87ae/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f636c6173686f6772616d2e737667)
宗族冲突的电报频道监视。
NOTE: Clash of Clans API data is always 10 minutes behind the game events. This is not a bug in this program.
clashogram监视你氏族的术士并发布以下消息 发送到电报频道的消息:
- 准备工作开始(有部族和玩家信息)
- 战争开始了
- 新攻击(含详细信息)
- 争夺
Requirements
要运行程序,您需要使用Python3.3或更高版本你也会 需要pip来安装python依赖项此外,使用 virtualenv制造 安装要容易得多,否则你必须安装所有的东西 全系统。在Linux上,您需要在 具有管理员帐户的windows
Installation
来自PYPI:
pip install clashogram
来自github:
git clone https://github.com/mehdisadeghi/clashogram.git cd clashogram install -r requirements.txt flit flit install --symlink
Usage
要使用该程序,请执行以下操作:
- 在上打开宗族冲突开发者帐户 https://developer.clashofclans.com/。
- 使用以下网站查找外部IP地址 this。
- 转到你的coc开发者页面,为ip创建一个api令牌 你刚找到的号码
- 使用botfather创建一个电报机器人并复制其令牌。
- 创建一个新的电报组并添加刚才创建为 该组的管理员
现在您可以运行以下命令:
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
如果不想在频道中更新攻击,请将静音攻击添加到上述命令中。
为了使消息在不同的区域设置中,请执行以下操作 然后运行程序:
export LANGUAGE=<LANGUAGE_CODE> e.g. export LANGUAGE=fa
或者一步完成:
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
在运行程序之前,请确保在windows上运行set LANGUAGE=<your_lang_code_here>
Run as a service
使用Clashogram最简单的方法是让它在后台运行 使用byobu或GNU Screen。另一个解决办法是 安装系统D单元:
[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
在Internet上搜索有关在您的 操作系统。
Contribution (PRs welcome!)
电报通知与程序的其余部分隔离。你 可以用任何其他邮件来替换它 在别的地方。
分叉并克隆存储库并发送PR。确保测试通过 事先:
python -m unittest discover
或者使用py.test:
pip install pytest py.test tests.py
I18N
要添加或更新新的语言目录,请执行以下操作:
pip install babel # Install the babel i18n tool first.
pybable init -i clashogram/locales/messages.pot -d clashogram/locales -l <LANGUAGE_CODE> pybable update -i clashogram/locales/messages.pot -d clashogram/locales -l <LANGUAGE_CODE>
例如:
pybable init -i clashogram/locales/messages.pot -d clashogram/locales -l fa pybable update -i clashogram/locales/messages.pot -d clashogram/locales -l fa
如果添加了新消息,请提取它们并重新编译:
pybabel extract clashogram/ -o clashogram/locales/messages.pot --project Clashogram --version 0.6.0 pybabel update -i clashogram/locales/messages.pot -d clashogram/locales pybabel compile -d clashogram/locales
有关国际化的更多信息,请参见 Babel。
Credits
感谢Ali Ayatollahi和来自伊朗部落(Tag_yvl0c8uy)的其他成员的初步想法和测试。
License
麻省理工学院
Russian Translations
多亏了光照派的帖木儿,你可以用俄语阅读这份文件。谢谢蒂穆尔! this document in Russian
راهنمای فارسی
__________ این آدرس___。