Code Monkey home page Code Monkey logo

qqbot's Introduction

Installation guide of zhenxun bot

0 Introduction

I installed the bot on the Tencent Cloud.

# Too expensive! Not recommended!
System: Ubuntu Server 18.04.1 LTS 64bit
location: shanghai
CPU: 2 core
mem: 2GB
bandwidth: 4Mbps
Price: 50 yuan per month

1 Create new QQ

Such as my new bot: 3059509092

2 Create new vps and connect by ssh

Add one new port for ssh because my college's firewall bans the 22 port.

vim /etc/ssh/sshd_config
# Add new port
Port 40230

If use Ubuntu, we need to adjust the config of ssh becuase the default user is not root. First change the password.

sudo passwd root

Then revise the config of sshd.

sudo vi /etc/ssh/sshd_config 

To

PermitRootLogin yes
PasswordAuthentication yes

At last

sudo service ssh restart

3 create new virtual env

wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod 777 Miniconda3-latest-Linux-x86_64.sh #给执行权限
bash Miniconda3-latest-Linux-x86_64.sh #运行
cd /home/miniconda3/bin/
chmod 777 activate 
. ./activate
# mirrors of tsinghua
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
# create new virtual env
conda create -n name python==<version>

4 install go-cqhttp

wget https://github.com/Mrs4s/go-cqhttp/releases/download/v1.0.0-rc1/go-cqhttp_linux_amd64.tar.gz
tar -zxvf go-cqhttp_linux_amd64.tar.gz
cd go-cqhttp_linux_amd64.tar.gz
# run go-cqhttp first time.
./go-cqhttp
# choose the third item which is reverse websocket

Then modify the comfig.yml as shown blow.

uin:your bot qq
# port 8080 needs to be opened in the firewall.
universal: ws://127.0.0.1:8080/onebot/v11/ws/
# restart go-cqhttp
./go-cqhttp

need another package for audio item

sudo apt install -y ffmpeg

5 install Postgresql database

# first update the apt tool
sudo apt update
# install postgresql and postgresql-contrib
sudo apt install postgresql postgresql-contrib

Create new database

# switch usr
sudo su - postgres
psql
       #  用户名↓                # 密码↓
 CREATE USER uname WITH PASSWORD 'zhenxun';      # 创建用户
         # 数据库名称↓       所有者↓
 CREATE DATABASE testdb OWNER uname;             # 创建数据库

6 install zhenxun bot

git clone -b main https://github.com/Ironieser/zhenxun_bot.git
cd zhenxun_bot
pip3 install poetry     
poetry install          

# if use conda virtual env , dont need to do.
poetry shell            

## playwright install chromiuw which is the headless browser.
playwright install chromium
playwright install-deps chromium

configure the super root

vim .env.dev 
# add qq of super user
SUPERUSERS=["your qq"]
vim configs/config.py
bind: str = ""  
sql_name: str = "postgresql"
user: str = "uname"
password: str = "zhenxun"
address: str = "127.0.0.1"
port: str = "5432"
database: str = "testdb"

7 run bot

python3 bot.py

8 screen

qqbot's People

Contributors

ironieser avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.