Skip to content

Commit

Permalink
Beta488 (#493)
Browse files Browse the repository at this point in the history
* beta447

* beta448

* beta449

* beta450

* beta451

* beta452

* beta453

* beta454

* beta455

* btea455

* beta456

* beta457

* beta458

* beta460

* beta460

* beta461

* beta462

* beta463

* beta464

* beta465

* beta467

* beta468

* beta469

* beta470

* beta471

* beta472

* beta473

* beta473

* beta475

* beta476

* beta478

* beta479

* beta479

* beta480

* beta481

* beta482

* beta483

* beta484

* beta485

* beta486

* beta486

* beta487

* beta487
  • Loading branch information
Hoshinonyaruko authored Aug 20, 2024
1 parent 51a6111 commit e0ce498
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 12 deletions.
32 changes: 27 additions & 5 deletions Processor/ProcessC2CMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"
"strconv"
"strings"
"time"

"github.com/hoshinonyaruko/gensokyo/config"
Expand Down Expand Up @@ -349,11 +350,32 @@ func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error {
selfid64 = int64(p.Settings.AppID)
}

//转换at
messageText := handlers.RevertTransformedText(data, "group_private", p.Api, p.Apiv2, 0, 0, config.GetWhiteEnable(5))
if messageText == "" {
mylog.Printf("信息被自定义黑白名单拦截")
return nil
var messageText string
//当屏蔽错误通道时候=性能模式 不解析at 不解析图片
if !config.GetDisableErrorChan() {
//转换at
messageText = handlers.RevertTransformedText(data, "group_private", p.Api, p.Apiv2, 0, 0, config.GetWhiteEnable(5))
if messageText == "" {
mylog.Printf("信息被自定义黑白名单拦截")
return nil
}
} else {
messageText = data.Content
if messageText == "/ " {
messageText = " "
}
if messageText == " / " {
messageText = " "
}
messageText = strings.TrimSpace(messageText)

// 检查是否需要移除前缀
if config.GetRemovePrefixValue() {
// 移除消息内容中第一次出现的 "/"
if idx := strings.Index(messageText, "/"); idx != -1 {
messageText = messageText[:idx] + messageText[idx+1:]
}
}
}

groupMsg := OnebotGroupMessageS{
Expand Down
42 changes: 35 additions & 7 deletions Processor/ProcessGroupMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"
"strconv"
"strings"
"time"

"github.com/hoshinonyaruko/gensokyo/config"
Expand Down Expand Up @@ -75,18 +76,45 @@ func (p *Processors) ProcessGroupMessage(data *dto.WSGroupATMessageData) error {
}
}

// 转换at
messageText := handlers.RevertTransformedText(data, "group", p.Api, p.Apiv2, GroupID64, userid64, config.GetWhiteEnable(4))
if messageText == "" {
mylog.Printf("信息被自定义黑白名单拦截")
return nil
var messageText string
//当屏蔽错误通道时候=性能模式 不解析at 不解析图片
if !config.GetDisableErrorChan() {
// 转换at
messageText = handlers.RevertTransformedText(data, "group", p.Api, p.Apiv2, GroupID64, userid64, config.GetWhiteEnable(4))
if messageText == "" {
mylog.Printf("信息被自定义黑白名单拦截")
return nil
}

//框架内指令
p.HandleFrameworkCommand(messageText, data, "group")
} else {
// 减少无用的性能开支
messageText = data.Content

if messageText == "/ " {
messageText = " "
}

if messageText == " / " {
messageText = " "
}
messageText = strings.TrimSpace(messageText)

// 检查是否需要移除前缀
if config.GetRemovePrefixValue() {
// 移除消息内容中第一次出现的 "/"
if idx := strings.Index(messageText, "/"); idx != -1 {
messageText = messageText[:idx] + messageText[idx+1:]
}
}

}

//群没有at,但用户可以选择加一个
if config.GetAddAtGroup() {
messageText = "[CQ:at,qq=" + config.GetAppIDStr() + "] " + messageText
}
//框架内指令
p.HandleFrameworkCommand(messageText, data, "group")

var messageID int
//映射str的messageID到int
Expand Down

0 comments on commit e0ce498

Please sign in to comment.