当前位置:网站首页>QQ robot configuration record based on nonebot2
QQ robot configuration record based on nonebot2
2022-07-28 14:16:00 【My name is Chenchen】
be based on NoneBot2 Of qq Robot configuration record
Project reference address :https://github.com/nonebot/nonebot2
nonebot2 documentation :https://v2.nonebot.dev/docs/start/installation
1.venv Creating a virtual environment
Create an environment :
python3 -m venv nonebot2_env
Enter the environment :
source ~/nonebot2_env/bin/activate
You can see , After entering the virtual environment, parentheses appear in front of the prompt on the command line , Inside is the name of the virtual environment .
2. install nonebot2, Drive and protocol adapter
install nb-cli:
pip install nb-cli
Install the drive :
View all drives :
nb driver list
nb driver install
Install the protocol adapter :
nb adapter list
nb adapter install
3. Create project
nb create
Choose in turn :
In a “nonebot2” folder
echo
OneBot V11
4. install go-cqhttp
Project address :https://github.com/Mrs4s/go-cqhttp
download :( Note that you can change to the latest download link )
wget https://github.com/Mrs4s/go-cqhttp/releases/download/v1.0.0-rc3/go-cqhttp_linux_386.tar.gz
decompression :
tar -xzvf go-cqhttp_linux_386.tar.gz
Input ./go-cqhttp, Enter function , You will be prompted 
Choose reverse websocket signal communication
open config.yml file :
1) take uin It is amended as follows bot account number
2) stay config.yml file
universal: ws://your_websocket_universal.server
It is amended as follows
universal: ws://127.0.0.1:8080/onebot/v11/ws/
Then you need to download it locally windows Version of go-cqhttp When configuring, enter the account and password, and then log in successfully , Then put the local device.json Copy and replace the cloud , In this way, you can log in to the server qq success .
5. To configure nonebot2
stay .env.prod Middle configuration :
HOST=127.0.0.1 # To configure NoneBot Monitoring IP/ Host name
PORT=8080 # To configure NoneBot Listening port
SUPERUSERS=["123456"] # qq Number
NICKNAME=["chenchen_bot"] # Configure the nickname of the robot
COMMAND_START=["/", ""] # Configure the start character of the command
Then start at the same time nonebot2 And go-cqhttp
At this time in qq Chinese robot input dialogue
/echo test
qq Robot return test The test is successful !
6. Installing a plug-in
stay nonebot2 Under the folder, enter the command to install :
nb plugin install nonebot_plugin_petpet
And in bot.py Load plug-ins in :
nonebot.load_builtin_plugins("echo") # This is a nonebot2 Self contained echo function
nonebot.load_builtin_plugins("nonebot-plugin-petpet") # Plug in loaded
边栏推荐
猜你喜欢

83.(cesium之家)cesium示例如何运行

MVC模型:日历系统

用友BIP CRM新品发布,赋能大中型企业营销增长

LeetCode 0143. 重排链表

DXF reading and writing: align the calculation of the position of the dimension text in the middle and above

Clickhouse architecture and design

软件测试工程师的职业规划

UFIDA BiP CRM new product launch enables large and medium-sized enterprises to grow their marketing
![[server data recovery] HP StorageWorks series server RAID5 offline data recovery of two disks](/img/23/4d07adcb5fb2c3b4c5090dacd02c89.jpg)
[server data recovery] HP StorageWorks series server RAID5 offline data recovery of two disks

Multithreading and high concurrency (III) -- source code analysis AQS principle
随机推荐
论文研读--Masked Generative Distillation
文献阅读(245)Roller
MVC model: calendar system
什么是自旋锁 自旋锁是指当一个线程尝试获取某个锁时,如果该锁已被其他线程占用,就一直循环检测锁是否被释放,而不是进入线程挂起或睡眠状态。 /** * 为什么用自旋锁:多个线程对同一个变量
Verification code brute force cracking test [easy to understand]
正则表达式
LeetCode 0142.环形链表 II
Do you really know esmodule
Istio IV fault injection and link tracking
协同办公工具:在线白板初起步,在线设计已红海
[translation] how to choose a network gateway for your private cloud
[lvgl events] Application of events on different components (I)
[utils] fastdfs tool class
Long closed period private placement products reappearance industry insiders have different views
MySQL开发技巧——视图
成为绿色数据中心新样板,东莞华为云数据中心是怎样炼成的?
As a programmer, how to manage time efficiently?
【LVGL事件(Events)】事件代码
Introduction to database system (5th Edition) supplementary exercises - Chapter 1 Introduction
【Utils】ServletUtil