-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
41 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
http: | ||
schema: "http" | ||
host: 192.168.31.6 | ||
host: 192.168.31.169 | ||
port: 5700 | ||
websocket: | ||
host: 192.168.31.6 | ||
host: 192.168.31.169 | ||
port: 6700 | ||
SUPERUSERS: | ||
- 1179551960 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
# examples | ||
|
||
示例文件 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
#export CGO_ENABLED=1 | ||
|
||
export GOARCH=amd64 | ||
export GOOS=windows | ||
go build -o ./plugin/impl/plugin-windows-amd64.exe ../plugin/impl | ||
|
||
export GOARM=7 | ||
export GOARCH=arm64 | ||
export GOOS=linux | ||
|
||
go build -o ./plugin/impl/plugin-linux-arm64v7 ../plugin/impl | ||
|
||
export GOARCH=amd64 | ||
export GOOS=darwin | ||
go build -o ./plugin/impl/plugin-linux-amd64 ../plugin/impl | ||
|
||
|
||
export GOARCH=amd64 | ||
export GOOS=linux | ||
go build -o ./plugin/impl/plugin-linux-amd64 ../plugin/impl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,38 @@ | ||
package main | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/dezhishen/onebot-plus/pkg/cli" | ||
"github.com/dezhishen/onebot-plus/pkg/plugin" | ||
"github.com/sirupsen/logrus" | ||
"github.com/dezhishen/onebot-sdk/pkg/model" | ||
) | ||
|
||
func main() { | ||
plugin.NewOnebotEventPluginBuilder(). | ||
//设置插件内容 | ||
Id("test").Name("测试插件").Description("这是测试插件"). | ||
Help("测试查询,无操作指令"). | ||
//设置生命周期函数 | ||
// Init(func(cli cli.OnebotCli) error { | ||
// d, e := cli.GetVersionInfo() | ||
// logrus.Info("============ version info ==========") | ||
// logrus.Info(d, e) | ||
// // go loop(cli) | ||
// return nil | ||
// }). | ||
// BeforeExit(func(cli cli.OnebotCli) error { | ||
// d, e := cli.GetVersionInfo() | ||
// logrus.Info("========exit=======") | ||
// logrus.Info(d, e) | ||
// return nil | ||
// }). | ||
// //Onebot回调事件 | ||
// MessageGroup(func(req *model.EventMessageGroup, cli cli.OnebotCli) error { | ||
// logrus.Infof("收到群组消息,UserId:[%v]", req.Sender.UserId) | ||
// return nil | ||
// }). | ||
// MessagePrivate(func(req *model.EventMessagePrivate, cli cli.OnebotCli) error { | ||
// logrus.Infof("收到私聊消息,UserId:[%v]", req.Sender.UserId) | ||
// return nil | ||
// }). | ||
// MetaHeartbeat(func(req *model.EventMetaHeartbeat, cli cli.OnebotCli) error { | ||
// logrus.Infof("收到EventMetaHeartbeat,SelfId:[%v]", req.SelfId) | ||
// logrus.Info(cli.GetStatus()) | ||
// return nil | ||
|
||
// }). | ||
// MetaLifecycle(func(req *model.EventMetaLifecycle, cli cli.OnebotCli) error { | ||
// logrus.Info("============status==========") | ||
// logrus.Info(cli.GetStatus()) | ||
// return nil | ||
// }). | ||
Init(func(cli cli.OnebotCli) error { | ||
sendGroupForwardMessage(cli) | ||
return nil | ||
}). | ||
//构建插件 | ||
Build(). | ||
//启动 | ||
Start() | ||
} | ||
|
||
func loop(cli cli.OnebotCli) { | ||
for { | ||
time.Sleep(5 * time.Second) | ||
logrus.Info("===============alive==============") | ||
r, e := cli.GetStatus() | ||
if e != nil { | ||
logrus.Error("get status err :%v", e) | ||
continue | ||
} | ||
logrus.Infof("Status:%v", r.Data) | ||
func sendGroupForwardMessage(cli cli.OnebotCli) { | ||
r, e := cli.GetLoginInfo() | ||
if e != nil { | ||
println(e) | ||
return | ||
} | ||
cli.SendGroupForwardMessageByRawMsg(398415189, r.Data.UserId, r.Data.Nickname, []*model.MessageSegment{ | ||
{ | ||
Type: "text", | ||
Data: &model.MessageElementText{ | ||
Text: "hello,我是合并消息", | ||
}, | ||
}, | ||
}) | ||
} |