Skip to content

Commit

Permalink
提交,
Browse files Browse the repository at this point in the history
  • Loading branch information
xiwangly2 committed Jan 18, 2025
1 parent 1dd7585 commit b26732a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

您可以使用 [Docker](#使用docker) 安装,安装前请配置 go-cqhttp 和 MySQL 的连接信息(MySQL 可能需要自己部署)

目前在 dev 更多数据库的支持,……咕咕咕

或者是自己手动部署

下面的内容请根据使用的实际情况修改,不建议直接照抄
Expand All @@ -31,6 +33,8 @@
docker run -itd -v $PWD/xwbot/config:/app/config --name=xwbot --net=host --restart=always ghcr.io/xiwangly2/xwbot:main
```

其实你可用不用 host 网络,但是我懒得改了,自己映射要用的端口

### (三)从 DockerHub 拉取镜像

```sh
Expand All @@ -42,9 +46,6 @@ docker run -itd -v $PWD/xwbot/config:/app/config --name=xwbot --net=host --resta
移除容器和镜像
`docker stop xwbot || docker rm xwbot || docker rmi ghcr.io/xiwangly2/xwbot:main`

移除配置文件
`rm -r /www/wwwroot/go-cqhttp`

要更新的话就再执行一遍安装步骤

##手动部署
Expand All @@ -53,7 +54,9 @@ docker run -itd -v $PWD/xwbot/config:/app/config --name=xwbot --net=host --resta


首次使用请将`config/config_example.yml`复制到`config/config.yml`
并编辑其中的设置,并且正确的配置 [Go-cqhttp](https://github.com/Mrs4s/go-cqhttp) 的正向 websocket 通信
并编辑其中的设置,并且正确的配置 正向 websocket 通信

现在已适配 OneBot 11,目前我测试了 go-cqhttp 和 NapCat 都没问题

另外,还需要MySQL的存储支持,自己看着办吧

Expand Down
9 changes: 4 additions & 5 deletions internal/chat_thesaurus.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ async def chat_thesaurus(messages, ws=None):
if bot_switch is None or len(bot_switch) == 0:
if arg[0] == '/on' and is_admin:
Database().db_handler.bot_switch(messages['group_id'], 1)
# text = "Bot started successfully."
else:
bot_switch = bot_switch[0][1]
text = "Bot started successfully."
return text
except NameError:
bot_switch = '0'
if config['debug']:
Expand All @@ -62,7 +61,7 @@ async def chat_thesaurus(messages, ws=None):
pass
if bot_switch == '0':
if arg[0] == '/on' and is_admin:
Database().db_handler.db_handler(messages['group_id'], 1)
Database().db_handler.bot_switch(messages['group_id'], 1)
text = "Bot started successfully."
else:
text = None
Expand All @@ -71,7 +70,7 @@ async def chat_thesaurus(messages, ws=None):
if arg[0] == '/on' and is_admin:
text = "Bot is running."
elif arg[0] == '/off' and is_admin:
Database().db_handler.db_handler(messages['group_id'], 0)
Database().db_handler.bot_switch(messages['group_id'], 0)
text = "Bot is off."
elif arg[0] == '/help':
text = "这是一个帮助列表<Response [200]>"
Expand Down
10 changes: 10 additions & 0 deletions internal/database/postgresql/xwbot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ CREATE TABLE switch (
time TIMESTAMP NOT NULL
);

-- Drop and create the `pic` table
DROP TABLE IF EXISTS pic;
CREATE TABLE pic (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
bin BYTEA NOT NULL,
sha256 VARCHAR(255) NOT NULL,
md5 VARCHAR(255) NOT NULL
);

-- Insert data into the `switch` table
INSERT INTO switch (group_id, switch, time)
VALUES (0, '1', '2023-09-05 11:05:40');

0 comments on commit b26732a

Please sign in to comment.