Skip to content

Commit

Permalink
Test4 (#52)
Browse files Browse the repository at this point in the history
* Compiled main.go and pushed changes

* test

* 适配了频道私聊,用bolt数据库取代ini

* 适配了nonebot2

* add license

* add a lot

* trss support

* add action

* add action

* add action

* fixbug

* add wss

* bugfix

* fix action

* fix action again

* fa

* fix

* add a lot

* add ws server token

* bugifx

* fixat

* bugfix

* bugfix

* test

* test2

* add url service

* add url service

* bugfix

* fix

* fix

* fix

* bug fix

* fix

* test

* add webui

* add image_compress

* bug fix

* fix cq code

* fixbug

* bugfix

* bugfix

* bugfix

* bugfix

* bugfix

* bugfix

* bugfix

* add new feature

* bugfix

* bugfix

* bugfix

* bugfix

* bugfix

* merge

* bugfix

* bugfix

* bugfix

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* bugfix

* bugfix

* Remove dist directory from tracking

* test

* test

* bugfix2

* bugfix3

* bugfix5

* bugfix5
  • Loading branch information
Hoshinonyaruko authored Nov 8, 2023
1 parent 1ac5c63 commit d623c0d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 15 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ type Settings struct {
DevlopAcDir string `yaml:"develop_access_token_dir"`
RemoveAt bool `yaml:"remove_at"`
DevBotid string `yaml:"develop_bot_id"`
SandBoxMode bool `yaml:"sandbox_mode"`
Title string `yaml:"title"`
}

// LoadConfig 从文件中加载配置并初始化单例配置
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/AccountConfigEditorView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async function updateConfig() {
$q.notify({ message: '配置文件修改成功', color: 'positive' });
} catch (err) {
$q.notify({ message: '配置文件修改失败', color: 'negative' });
$q.notify({ message: '配置文件修改成功', color: 'positive' });
} finally {
loading.value = false;
}
Expand Down
40 changes: 30 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func main() {
if err != nil {
log.Fatalf("error: %v", err)
}
sys.SetTitle()
sys.SetTitle(conf.Settings.Title)
webuiURL := config.ComposeWebUIURL(conf.Settings.Lotus) // 调用函数获取URL
webuiURLv2 := config.ComposeWebUIURLv2(conf.Settings.Lotus) // 调用函数获取URL

Expand Down Expand Up @@ -109,17 +109,37 @@ func main() {
panic(errors.New("TextIntent is empty, at least one intent should be specified"))
}

// 创建 v1 版本的 OpenAPI 实例
if err := botgo.SelectOpenAPIVersion(openapi.APIv1); err != nil {
log.Fatalln(err)
}
api = botgo.NewOpenAPI(token).WithTimeout(3 * time.Second)
//创建api
if !conf.Settings.SandBoxMode {
// 创建 v1 版本的 OpenAPI 实例
if err := botgo.SelectOpenAPIVersion(openapi.APIv1); err != nil {
log.Fatalln(err)
}
api = botgo.NewOpenAPI(token).WithTimeout(3 * time.Second)
log.Println("创建 apiv1 成功")

// 创建 v2 版本的 OpenAPI 实例
if err := botgo.SelectOpenAPIVersion(openapi.APIv2); err != nil {
log.Fatalln(err)
// 创建 v2 版本的 OpenAPI 实例
if err := botgo.SelectOpenAPIVersion(openapi.APIv2); err != nil {
log.Fatalln(err)
}
apiV2 = botgo.NewOpenAPI(token).WithTimeout(3 * time.Second)
log.Println("创建 apiv2 成功")
} else {
// 创建 v1 版本的 OpenAPI 实例
if err := botgo.SelectOpenAPIVersion(openapi.APIv1); err != nil {
log.Fatalln(err)
}
api = botgo.NewSandboxOpenAPI(token).WithTimeout(3 * time.Second)
log.Println("创建 沙箱 apiv1 成功")

// 创建 v2 版本的 OpenAPI 实例
if err := botgo.SelectOpenAPIVersion(openapi.APIv2); err != nil {
log.Fatalln(err)
}
apiV2 = botgo.NewSandboxOpenAPI(token).WithTimeout(3 * time.Second)
log.Println("创建 沙箱 apiv2 成功")
}
apiV2 = botgo.NewOpenAPI(token).WithTimeout(3 * time.Second)

configURL := config.GetDevelop_Acdir()
var me *dto.User
if configURL == "" { // 执行API请求 显示机器人信息
Expand Down
3 changes: 1 addition & 2 deletions sys/re.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ func setConsoleTitle(title string) error {
}

// SetTitle sets the window title to "Gensokyo © 2023 - [Year] Hoshinonyaruko".
func SetTitle() {
title := fmt.Sprintf("Gensokyo © 2023 - %d Hoshinonyaruko", time.Now().Year())
func SetTitle(title string) {
err := setConsoleTitle(title)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to set title: %v\n", err)
Expand Down
4 changes: 3 additions & 1 deletion template/config_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ settings:
remove_at : false #是否忽略公域机器人指令前第一个[CQ:aq,qq=机器人] 场景(公域机器人,但插件未适配at开头)
backup_port : "5200" #当totus为ture时,port值不再是本地webui的端口,使用lotus_Port来访问webui
develop_access_token_dir : "" #开发者测试环境access_token自定义获取地址 默认留空 请留空忽略
develop_bot_id : "1234" #开发者环境需自行获取botid 填入 用户请不要设置这两行...开发者调试用
develop_bot_id : "1234" #开发者环境需自行获取botid 填入 用户请不要设置这两行...开发者调试用
sandbox_mode : false #默认false 如果你只希望沙箱频道使用,请改为true
title : "Gensokyo © 2023 - Hoshinonyaruko" #程序的标题 如果多个机器人 可根据标题区分
`
const Logo = `
'
Expand Down
4 changes: 3 additions & 1 deletion template/config_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ settings:
remove_at : false #是否忽略公域机器人指令前第一个[CQ:aq,qq=机器人] 场景(公域机器人,但插件未适配at开头)
backup_port : "5200" #当totus为ture时,port值不再是本地webui的端口,使用lotus_Port来访问webui
develop_access_token_dir : "" #开发者测试环境access_token自定义获取地址 默认留空 请留空忽略
develop_bot_id : "1234" #开发者环境需自行获取botid 填入 用户请不要设置这两行...开发者调试用
develop_bot_id : "1234" #开发者环境需自行获取botid 填入 用户请不要设置这两行...开发者调试用
sandbox_mode : false #默认false 如果你只希望沙箱频道使用,请改为true
title : "Gensokyo © 2023 - Hoshinonyaruko" #程序的标题 如果多个机器人 可根据标题区分

0 comments on commit d623c0d

Please sign in to comment.