Sign inSign up

zegwe/dota2bot

By zegwe

•Updated over 4 years ago

dota2 qq group plugin for opqbot

Image
0

4.7K

zegwe/dota2bot repository overview

⁠DOTA2BOT for QQ

⁠Introduction⁠

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.

⁠Usage⁠

Notice: All the command are insensitive to half-width ! and full-width !.

已支持插件插件说明
Dota2Watcher⁠Dota2战绩监视
Dota2Fortune⁠Dota2每日运势
⁠Plugin Manage⁠

!插件列表: 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.

⁠Dota2Watcher⁠

!查看监视: 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.

⁠Dota2Fortune⁠

!今日运势: Today's fortune of Dota2.

!幸运英雄: Today's lucky hero.

⁠Quick start⁠

⁠Prepare⁠

Install and run OPQ⁠

Install Docker⁠ or Python, see the details below.

⁠Run⁠

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⁠.

⁠Use dockerhub⁠

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/v1/LuaApiCaller",
	"ws_url": "http://127.0.0.1:8080",
	"debug": false
}

Run with Docker.

docker run -itd -v $(pwd)/config.json:/opt/dota2bot/config.json -v $(pwd)/botInfo.db:/opt/dota2bot/botInfo.db --name dota2bot zegwe/dota2bot:latest
⁠Use git⁠

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.db file.

touch botInfo.db

Run with docker-compose

docker-compose up -d
⁠Run python directly⁠

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

⁠Develop your plugin⁠

To develop your own plugin, you should follow these rules:

  1. Your plugin should be a subclass of Plugin⁠ in the model folder.
  2. Add your command in the __init__ method. You can reference other plugins in plugins⁠ folder.
  3. Put your plugin file/folder into the plugins⁠ folder, and import it in the __init__.py⁠ file.
  4. Add your plugin in app.py⁠ by add_plugin method.

Tag summary

Content type

Image

Digest

Size

22 MB

Last updated

almost 5 years ago

docker pull zegwe/dota2bot