Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

XRSec/Go-Wechaty-Bot-Plugin

Repository files navigation

Go-Wechaty-Bot-Plugin

Add Features

.
├── Admin
│    └── Admin.go
package Admin

import (
	"fmt"
	. "github.com/XRSec/Go-Wechaty-Bot/General"
	. "github.com/XRSec/Go-Wechaty-Bot/Plug"
	"github.com/wechaty/go-wechaty/wechaty"
	"github.com/wechaty/go-wechaty/wechaty-puppet/schemas"
	"github.com/wechaty/go-wechaty/wechaty/user"
)

var (
	err error
)

const name = "Admin"

func New() *wechaty.Plugin {
	plug := wechaty.NewPlugin()
	plug.OnMessage(onMessage)
	return plug
}

func onMessage(context *wechaty.Context, message *user.Message) {
	m, ok := (context.GetData("msgInfo")).(MessageInfo)
	if !ok {
		fmt.Println()
		return
	}

	fmt.Println(message.Text())

	if m.Status {
		fmt.Println("Room")
		m.PassResult = fmt.Sprintf("Is Room: [%v]", m.RoomName)
		m.Pass = true
		goto end
	} else {
		fmt.Println("Friend")
	}

end:
	context.SetData("msgInfo", m)
}

PreProcessing

  • Server/General/Pretreatment.go
  • Server/main -> main_Bot.Use (from top to bottom)
flowchart LR
    Bot-->onMessage-->Pretreatment
    Pretreatment-->any_More-->ExportMessages-->DingMessage
Loading

LogicalProcessing

  • Server/General/Pretreatment.go
flowchart LR
Bot-->onMessage-->Pretreatment
Pretreatment-->ObjectType
Pretreatment-->MessageType
Pretreatment-->ChatStatus
Pretreatment-->Pass
Pretreatment-->Reply

ObjectType-->NightMode
MessageType-->NightMode
ChatStatus-->NightMode
Pass-->NightMode
Reply-->NightMode

NightMode-->chatTimeLimit

chatTimeLimit-->Last_onMessage
Loading

About

Go-Wechaty-Bot 公开插件库

Resources

License

Stars

Watchers

Forks

Languages