Skip to content

Commit

Permalink
Beta117 (#115)
Browse files Browse the repository at this point in the history
* beta1

* beta2

* beta3

* beta4

* beta5

* beta6

* beta7

* beta8

* beta9

* beta10

* beta11

* beta12

* beta13

* beta14

* beta15

* beta16

* beta16

* beta19

* beta20

* beta21

* beta22

* beta23

* beta24

* beta25

* beta27

* beta28

* beta29

* beta30

* beta31

* beta33

* beta34

* beta35

* beta36

* beta37

* beta38

* beta39

* beta40

* beta41

* beta42

* beta43

* beta44

* beta45

* beta45

* beta46

* beat48

* beta49

* beta50

* beta51

* beta52

* beta53

* beta54

* beta55

* beta57

* beta58

* beta59

* beta61

* beta62

* beta63

* beta63

* beta64

* beta65

* beta66

* beta67

* beta70

* beta71

* beta72

* beta72

* beta74

* beta75

* beta76

* beta77

* beta78

* beta79

* beta80

* beta81

* beta82

* beta83

* beta85

* beta86

* beta87

* beta88

* beta89

* beta90

* beta91

* beta92

* beta93

* beta94

* beta94

* beta96

* beta97

* beta98

* beta99

* beta100

* beta101

* beta102

* beta104

* beta105

* beta106

* beta107

* beta108

* beta109

* beta110

* beta111

* beta112

* beta113

* beta115

* beta116

* beta117
  • Loading branch information
Hoshinonyaruko authored May 14, 2024
1 parent d23d523 commit 4b1aa8d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion applogic/gensokyo.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
}

if utils.BlacklistIntercept(message, selfid) {
fmtf.Printf("userid:[%v]这位用户在黑名单中,被拦截", message.UserID)
fmtf.Printf("userid:[%v]groupid:[%v]这位用户或群在黑名单中,被拦截", message.UserID, message.GroupID)
return
}

Expand Down
21 changes: 21 additions & 0 deletions utils/blacklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,26 @@ func WatchBlacklist(filePath string) {

// BlacklistIntercept 检查用户ID是否在黑名单中,如果在,则发送预设消息
func BlacklistIntercept(message structs.OnebotGroupMessage, selfid string) bool {
// 检查群ID是否在黑名单中
if IsInBlacklist(strconv.FormatInt(message.GroupID, 10)) {
// 获取黑名单响应消息
responseMessage := config.GetBlacklistResponseMessages()

// 根据消息类型发送响应
if message.RealMessageType == "group_private" || message.MessageType == "private" {
if !config.GetUsePrivateSSE() {
SendPrivateMessage(message.UserID, responseMessage, selfid)
} else {
SendSSEPrivateMessage(message.UserID, responseMessage)
}
} else {
SendGroupMessage(message.GroupID, message.UserID, responseMessage, selfid)
}

fmt.Printf("groupid:[%v]这个群在黑名单中,被拦截\n", message.GroupID)
return true // 拦截
}

// 检查用户ID是否在黑名单中
if IsInBlacklist(strconv.FormatInt(message.UserID, 10)) {
// 获取黑名单响应消息
Expand All @@ -113,5 +133,6 @@ func BlacklistIntercept(message structs.OnebotGroupMessage, selfid string) bool
fmt.Printf("userid:[%v]这位用户在黑名单中,被拦截\n", message.UserID)
return true // 拦截
}

return false // 用户ID不在黑名单中,不拦截
}

0 comments on commit 4b1aa8d

Please sign in to comment.