-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_logic.go
29 lines (24 loc) · 986 Bytes
/
custom_logic.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package logic
import (
"github.com/LagrangeDev/LagrangeGo/client"
"github.com/LagrangeDev/LagrangeGo/client/event"
"github.com/LagrangeDev/LagrangeGo/message"
"github.com/sirupsen/logrus"
)
// RegisterCustomLogic 注册所有自定义逻辑
func RegisterCustomLogic() {
// 注册私聊消息处理逻辑
Manager.RegisterPrivateMessageHandler(func(client *client.QQClient, event *message.PrivateMessage) {
client.SendPrivateMessage(event.Sender.Uin, []message.IMessageElement{message.NewText("Hello World!")})
})
// 注册群消息处理逻辑
Manager.RegisterGroupMessageHandler(func(client *client.QQClient, event *message.GroupMessage) {
client.SendGroupMessage(event.GroupUin, []message.IMessageElement{message.NewText("Hello World!")})
})
Manager.RegisterNewFriendRequestHandler(func(client *client.QQClient, event *event.NewFriendRequest) {
//event.SourceUid
logrus.Println("UID" + event.SourceUid)
client.SetFriendRequest(true, event.SourceUid)
})
}
//