Skip to content

Commit

Permalink
bugfix:resp too slow
Browse files Browse the repository at this point in the history
  • Loading branch information
ivhu committed Nov 21, 2024
1 parent 9681888 commit 8bcb6fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 7 additions & 4 deletions handler/gemini_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ func (g *geminiHandler) Name() string {
}

func (g *geminiHandler) CheckUpdate(b *gotgbot.Bot, ctx *ext.Context) bool {
// youtube music handler
if ctx.EffectiveChat.Type == "private" {
if !strings.Contains(ctx.EffectiveMessage.Text, "music.youtube") {
return true
if strings.Contains(ctx.EffectiveMessage.Text, "music.youtube") {
return false
}
if len(ctx.EffectiveMessage.Text) == 11 {
// 使用正则表达式 ^[a-zA-Z0-9]+$ 来匹配只包含字母和数字的字符串
regex := regexp.MustCompile(`^[a-zA-Z0-9]+$`)
return !regex.MatchString(ctx.EffectiveMessage.Text)
if regex.MatchString(ctx.EffectiveMessage.Text) {
return false
}
}
}
msg := ctx.EffectiveMessage.Text
Expand Down Expand Up @@ -136,7 +139,7 @@ func handlePrivateChat(b *gotgbot.Bot, ctx *ext.Context, ai ai.AiInterface) erro
return
default:
b.SendChatAction(ctx.EffectiveChat.Id, "typing", nil)
time.Sleep(7 * time.Second)
time.Sleep(6 * time.Second)
}
}
}()
Expand Down
3 changes: 1 addition & 2 deletions ymb/youtubeMusicBot.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func Start() {
log.Init(config.GlobalConfig.Log)
dao.Init(config.GlobalConfig.Storage.Quotations)
tgWebHook := connect.NewWebHookConnect(&config.GlobalConfig.WebHookConfig)
// tgAutoCall := connect.NewAutoCaller(&config.GlobalConfig.WebHookConfig)
tencent.NewTencentClient(config.GlobalConfig.TencentConfig)

var ymbHandler ext.Handler
Expand All @@ -33,8 +32,8 @@ func Start() {
}

// audioHandler := handler.NewAudioHandler()
timer := timekeeping.NewTimekeeper()
// tgWebHook.RegisterHandler(audioHandler)
timer := timekeeping.NewTimekeeper()

tgWebHook.RegisterHandler(gaiHandler)
tgWebHook.RegisterHandler(ymbHandler)
Expand Down

0 comments on commit 8bcb6fd

Please sign in to comment.