Skip to content

Commit

Permalink
bugfix:effect message text is null
Browse files Browse the repository at this point in the history
  • Loading branch information
ivhu committed Dec 8, 2024
1 parent 7eb0bd7 commit f9c2364
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions handler/quotation_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ func (y *quotationsHandler) CheckUpdate(b *gotgbot.Bot, ctx *ext.Context) bool {
if crossR {
return getRandomProbability(0.75)
}
for key, _ := range quotationsKey {
for key := range quotationsKey {
if strings.HasPrefix(msg, key) {
return getRandomProbability(0.5)
}
}
if ctx.Message.ReplyToMessage == nil {
ctx.EffectiveMessage.ReplyToMessage = new(gotgbot.Message)
if ctx.Message.Sticker != nil {
return getRandomProbability(0.3)
return getRandomProbability(0.05)
} else {
return getRandomProbability(0.1)
return getRandomProbability(0.01)
}
}
return false
Expand Down Expand Up @@ -207,15 +207,14 @@ func changeText(ctx *ext.Context) {
ctx.EffectiveMessage.Text = "t"
}
} else {
if getRandomProbability(0.1) {
if getRandomProbability(0.5) {
ctx.EffectiveMessage.ReplyToMessage.From = ctx.EffectiveUser
ctx.EffectiveMessage.Text = "神经"
} else {
ctx.EffectiveMessage.ReplyToMessage.From = ctx.EffectiveUser
ctx.EffectiveMessage.Text = "t"
}
}
return
}
// 如果是关键词 直接触发
msg := ctx.EffectiveMessage.Text
Expand Down Expand Up @@ -257,4 +256,8 @@ func changeText(ctx *ext.Context) {
ctx.EffectiveMessage.Text = value
}
}
if ctx.EffectiveMessage.Text == "" {
ctx.EffectiveMessage.Text = "神经"
}

}

0 comments on commit f9c2364

Please sign in to comment.