feat: add message push function call

This commit is contained in:
engigu
2026-03-04 21:45:43 +08:00
parent d4663cb492
commit 81b8d2a93d
53 changed files with 4161 additions and 33 deletions
+29
View File
@@ -0,0 +1,29 @@
package channels
import "github.com/engigu/baihu-panel/internal/sdk/message"
type PushMeChannel struct{ *BaseChannel }
func NewPushMeChannel() Channel {
return &PushMeChannel{NewBaseChannel(ChannelPushMe, []string{FormatTypeText})}
}
func (c *PushMeChannel) Send(config ChannelConfig, msg *Message) (*Result, error) {
pushKey := config.GetString("push_key")
if pushKey == "" {
return SendError("pushme config missing: push_key is required"), nil
}
cli := message.PushMe{
PushKey: pushKey,
URL: config.GetString("url"),
Date: config.GetString("date"),
Type: config.GetString("type"),
}
res, err := cli.Request(msg.Title, msg.Text)
if err != nil {
return ErrorResult(res, err), nil
}
return SuccessResult(res), nil
}