Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Alice/src/main/java/cn/penidea/alice/AliceApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public class AliceApplication {
private boolean isPublic;
@Value("${clientBaseConfig.isConcurrency}")
private boolean isConcurrency;
@Value("${clientBaseConfig.isAddself}")
private boolean isAddself;
@Value("${clientBaseConfig.isLoading}")
private boolean isLoading;

@Value("${executor.corePoolSize}")
private Integer corePoolSize;
Expand Down Expand Up @@ -84,10 +88,12 @@ public BaseConfigBean baseConfig() {
loadingWord = props.getStr("loadingWord");
isPublic = props.getBool("isPublic");
isConcurrency = props.getBool("isConcurrency");
isAddself = props.getBool("isAddself");
isLoading = props.getBool("isLoading");
}
userList.put(adminQQ, "");
userList.put("admin", adminQQ);
return new BaseConfigBean(userList, "[CQ:at,qq=" + robotQQ + "]", wakeUpWord, robotName, standbyWord, promptUpWord, standbyPrompt, loadingWord, isPublic, isConcurrency);
return new BaseConfigBean(userList, "[CQ:at,qq=" + robotQQ + "]", wakeUpWord, robotName, standbyWord, promptUpWord, standbyPrompt, loadingWord, isPublic, isConcurrency, isAddself, isLoading);
}

@SneakyThrows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public String askQuestion(String question) {
return message.get("message").toString();
} catch (Exception e) {
e.printStackTrace();
return "Token失效或服务器延迟,如多次尝试询问无果请尝试重新获取cookie";
return "你这要求有点问题啊,我答不上来";
}
}

Expand Down
2 changes: 2 additions & 0 deletions Alice/src/main/java/cn/penidea/alice/util/BaseConfigBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ public class BaseConfigBean {
private String loadingWord;
private boolean isPublic;
private boolean isConcurrency;
private boolean isAddself;
private boolean isLoading;
}
176 changes: 123 additions & 53 deletions Alice/src/main/java/cn/penidea/alice/ws/Client.java

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Alice/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ clientBaseConfig:
loadingWord: 正在检索...
isPublic: false
isConcurrency: false
isAddself: false
isLoading: true

#线程池配置
executor:
Expand Down
6 changes: 5 additions & 1 deletion Alice/src/main/resources/static/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ loadingWord=正在检索...
isPublic=false
#是否开启多人同时提问
isConcurrency=false
#是否允许私有状态下用户列表外的用户把自己添加到用户列表
isAddself=false
#是否打开加载提示词
isLoading=false
#线程初始数量
corePoolSize=5
#最大线程数量
maxPoolSize=20
#最大队列长度
workQueue=25
workQueue=25
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AliceBot
===========================

###### 环境依赖
* ubuntu 18.04
* ubuntu 18.04/22.04
* jdk8
* go-cqhttp_linux_arm64

Expand All @@ -15,28 +15,30 @@ AliceBot
下载到服务器后使用tar -zxvf进行解压<br>
运行其中的的在解压目录下运行screen -S gocq<br>
再运行./go-cqhttp,第一次运行会先让你选连接方式,我们选择2:正向Websocket,gocq在解压目录下生成config.yml,这时我们先Ctrl+C<br>
运行nano config.yml,拉到最下面找到address: 0.0.0.0:8080,把8080替换成9099,然后Ctrl+X,然后按Y,再回车一下保存<br>
运行nano config.yml,拉到最下面找到address: 0.0.0.0:8080,把0.0.0.0:8080替换成192.168.0.102:9099,然后Ctrl+X,然后按Y,再回车一下保存<br>
然后再次运行./go-cqhttp,完成登录后按Ctrl+A+D放到后台运行<br>
2. 执行jar包
先输入screen -S Alice 创建个会话<br>
然后使用java -jar -Xmx512m --clientBaseConfig.admin=管理员QQ --clientBaseConfig.robot=机器人QQ --clientBaseConfig.wakeUpWord=唤醒词 --clientBaseConfig.standbyWord=待机词 --clientBaseConfig.promptUpWord=提示词 --clientBaseConfig.robotName=机器人名称 --chatGPT.email=gpt邮箱 --chatGPT.password=gpt密码 --chatGPT.sessionToken=token --server.port=8080<br>
运行后再使用Ctrl+A+D放到后台运行即可
然后使用java -jar <此处包含两边括号替换为jar包名称,包含.jar> -Xmx512m<br>
运行后等待生成config.properties文件,编辑该文件后再使用上面的指令,之后再使用Ctrl+A+D放到后台运行即可

###### 机器人的所有操作指令(以下指令皆需唤醒机器人后再进行发送才能生效)<br>
#private 将机器人设为私有的,需要权限(默认就是私有)<br>
#public 将机器人设为所有人可用<br>
add @某人 添加一个拥有权限的使用者<br>
del @某人 将某人从使用者列表移除<br>
#reset 在多线程模式下清除所有会话,单线程模式下清除会话<br>
#reset me 用于多线程时清除管理员自己的会话<br>
#more 开启多线程模式<br>
#less 关闭多线程模式<br>
#alone 开启一问到底(既无需唤醒机器人)<br>
#add this 将当前的群聊加入权限列表<br>
#del this 将当前的群聊从权限列表中移除<br>
#help 查看指令列表<br>
#设为私有 将机器人设为私有的,需要权限(默认就是私有)<br>
#设为公有 将机器人设为所有人可用<br>
也和这位聊吧@某人 添加一个拥有权限的使用者<br>
别理@某人 将某人从使用者列表移除<br>
#重置所有会话 在多线程模式下清除所有会话,单线程模式下清除会话<br>
#重置我的会话 用于多线程时清除管理员自己的会话<br>
#开启多线程 开启多线程模式<br>
#开启单线程 关闭多线程模式<br>
#开启一问到底 开启一问到底(既无需唤醒机器人)<br>
#在本群开机 将当前的群聊加入权限列表<br>
#在本群关机 将当前的群聊从权限列表中移除<br>
#帮助 查看指令列表<br>
#开关自添加 机器人为私有时,让机器人接受或不接受别人把他自己添加到机器人的聊天对象列表中<br>
#开关等待词 开关等待词<br>

###### V3.0.0 版本内容更新
###### V0.0.3 版本内容更新
1. 新功能 多线程<br>
2. 新功能 一问到底<br>
3. 新功能 群聊权限<br>