This is OPQ based QQbot for watching group member's Dota2 game record.
This project is developed under Python3.9.
This bot also integrates a plugin manage system, you can develop any plugin you want.
Notice: All the command are insensitive to half-width
!
and full-width!
.
已支持插件 | 插件说明 |
---|---|
Dota2Watcher | Dota2战绩监视 |
Dota2Fortune | Dota2每日运势 |
Dota2MDI | Dota2战绩图 |
!插件列表
: List all the plugins and their status(On or Off).
!启用插件 [index]
: Enable a plugin by its index
in the list.
!禁用插件 [index]
: Disable a plugin by its index
in the list.
!帮助
: Display help content.
!插件帮助 [plugin_name]
: Display help content for a given plugin.
!查看监视
: List all the players that is been watched.
!添加监视 [nickname] [steam_id] [QQ account id]
: Add a player to be watched, by nickname
, steam_id
and QQ account id
.
!移除监视 [index]
: Remove a player from the watching list by its index
.
!今日运势
: Today's fortune of Dota2.
!幸运英雄
: Today's lucky hero.
!战绩图 [match_id]
: return match detail image
Install and run OPQ
Install Docker or Python, see the details below.
You can run python command directly for debug, but I strongly suggest you to use docker, because it's better to run this bot in background.
Using docker, you can pull docker image from DockerHub or build your own image from this repo.
Pull docker image from DockerHub
docker pull zegwe/dota2bot:latest
Create botInfo.db
file.
mkdir Dota2Bot
cd Dota2Bot
touch botInfo.db
Create and edit config.json
file
vim config.json
Here's an example for config.json
, you can also see this as config.example.json
in repo
{
"api_key": "xxxxx",
"bot_qq": 1234567890,
"groups": [1234567890],
"opq_url": "http://127.0.0.1:8080",
"debug": false,
"mdi_url": "http://dota2mdi.zegwe.me"
}
Run with Docker
.
docker run -itd -v $(pwd)/config.json:/opt/bot/config.json -v $(pwd)/botInfo.db:/opt/bot/botInfo.db --name dota2bot zegwe/dota2bot:latest
Clone this repo
git clone https://github.com/ZegWe/Dota2Bot.git
Edit config.json
cd Dota2Bot
cp config.example.json config.json
vim config.json
Create botInfo.db
file.
touch botInfo.db
Run with docker-compose
docker-compose up -d
Install Python3.9
Clone this repo
git clone https://github.com/ZegWe/Dota2Bot.git
Edit config.json
cd Dota2Bot
cp config.example.json config.json
vim config.json
Run with Python directly
pip install -r requirements.txt
python app.py
To develop your own plugin, you should follow these rules:
- Your plugin should be a subclass of
Plugin
in the model folder. - Add your command in the
__init__
method. You can reference other plugins in plugins folder. - Put your plugin file/folder into the plugins folder, and import it in the __init__.py file.
- Add your plugin in app.py by
add_plugin
method.