This is an automated email from the ASF dual-hosted git repository. linkinstar pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git
commit cded6aa9b251822502eb11578f90c940ae109323 Author: lihui <[email protected]> AuthorDate: Fri Jan 3 12:09:59 2025 +0800 feat: update notication-wecom package name and version --- notification-wecom/README.md | 2 +- notification-wecom/README_CN.md | 2 +- notification-wecom/config.go | 2 +- notification-wecom/go.mod | 2 +- notification-wecom/info.yaml | 4 +-- notification-wecom/notification_wecom.go | 42 +++++++++++++++----------------- notification-wecom/user_config.go | 2 +- 7 files changed, 26 insertions(+), 30 deletions(-) diff --git a/notification-wecom/README.md b/notification-wecom/README.md index 5006009..e7a3dca 100644 --- a/notification-wecom/README.md +++ b/notification-wecom/README.md @@ -5,7 +5,7 @@ To use the notification-wecom plugin with your application, install it using the following command: ```bash -./answer build --with github.com/lhui/incubator-answer-plugins/notification-wecom +./answer build --with github.com/apache/incubator-answer-plugins/notification-wecom ``` diff --git a/notification-wecom/README_CN.md b/notification-wecom/README_CN.md index 607f225..ca3e362 100644 --- a/notification-wecom/README_CN.md +++ b/notification-wecom/README_CN.md @@ -5,7 +5,7 @@ 要使用通知企业微信通知插件,请使用以下命令进行安装: ```bash -./answer build --with github.com/lhui/incubator-answer-plugins/notification-wecom +./answer build --with github.com/apache/incubator-answer-plugins/notification-wecom ``` diff --git a/notification-wecom/config.go b/notification-wecom/config.go index 19a7fe1..0bdcc81 100644 --- a/notification-wecom/config.go +++ b/notification-wecom/config.go @@ -22,7 +22,7 @@ package wecom import ( "encoding/json" - "github.com/lhui/incubator-answer-plugins/notification-wecom/i18n" + "github.com/apache/incubator-answer-plugins/notification-wecom/i18n" "github.com/apache/incubator-answer/plugin" ) diff --git a/notification-wecom/go.mod b/notification-wecom/go.mod index 6e1292c..2465589 100644 --- a/notification-wecom/go.mod +++ b/notification-wecom/go.mod @@ -1,4 +1,4 @@ -module github.com/lhui/incubator-answer-plugins/notification-wecom +module github.com/apache/incubator-answer-plugins/notification-wecom go 1.23.4 diff --git a/notification-wecom/info.yaml b/notification-wecom/info.yaml index bb07c5c..7158022 100644 --- a/notification-wecom/info.yaml +++ b/notification-wecom/info.yaml @@ -1,5 +1,5 @@ slug_name: notification_wecom type: notification -version: 0.0.1 +version: 1.0.0 author: lihui -link: https://github.com/lhui/incubator-answer-plugins/tree/dev/notification-wecom +link: https://github.com/apache/incubator-answer-plugins/tree/main/notification-wecom diff --git a/notification-wecom/notification_wecom.go b/notification-wecom/notification_wecom.go index 3f6e438..f76be4a 100644 --- a/notification-wecom/notification_wecom.go +++ b/notification-wecom/notification_wecom.go @@ -1,15 +1,14 @@ package wecom import ( - "embed" - "github.com/apache/incubator-answer/plugin" - "github.com/go-resty/resty/v2" - "strings" - - "github.com/apache/incubator-answer-plugins/util" - wecomI18n "github.com/lhui/incubator-answer-plugins/notification-wecom/i18n" - "github.com/segmentfault/pacman/i18n" - "github.com/segmentfault/pacman/log" + "embed" + "github.com/apache/incubator-answer/plugin" + "strings" + + wecomI18n "github.com/apache/incubator-answer-plugins/notification-wecom/i18n" + "github.com/apache/incubator-answer-plugins/util" + "github.com/segmentfault/pacman/i18n" + "github.com/segmentfault/pacman/log" ) //go:embed info.yaml @@ -28,21 +27,19 @@ func init() { plugin.Register(uc) } func (*Notification) Info() plugin.Info { - info := &util.Info{} + info := &util.Info{} info.GetInfo(Info) - return plugin.Info{ - Name: plugin.MakeTranslator(wecomI18n.InfoName), - SlugName: info.SlugName, - Description: plugin.MakeTranslator(wecomI18n.InfoDescription), - Author: info.Author, - Version: info.Version, - Link: info.Link, - } + return plugin.Info{ + Name: plugin.MakeTranslator(wecomI18n.InfoName), + SlugName: info.SlugName, + Description: plugin.MakeTranslator(wecomI18n.InfoDescription), + Author: info.Author, + Version: info.Version, + Link: info.Link, + } } - - // GetNewQuestionSubscribers returns the subscribers of the new question notification func (n *Notification) GetNewQuestionSubscribers() (userIDs []string) { for userID, conf := range n.UserConfigCache.userConfigMapping { @@ -98,7 +95,7 @@ func (n *Notification) Notify(msg plugin.NotificationMessage) { return } - notificationMsg:= renderNotification(msg) + notificationMsg := renderNotification(msg) // no need to send empty message if len(notificationMsg) == 0 { log.Debugf("this type of notification will be drop, the type is %s", msg.Type) @@ -119,7 +116,7 @@ func (n *Notification) Notify(msg plugin.NotificationMessage) { } } -func renderNotification(msg plugin.NotificationMessage) (string) { +func renderNotification(msg plugin.NotificationMessage) string { lang := i18n.Language(msg.ReceiverLang) switch msg.Type { case plugin.NotificationUpdateQuestion: @@ -146,4 +143,3 @@ func renderNotification(msg plugin.NotificationMessage) (string) { } return "" } - diff --git a/notification-wecom/user_config.go b/notification-wecom/user_config.go index 30562d2..bb294a8 100644 --- a/notification-wecom/user_config.go +++ b/notification-wecom/user_config.go @@ -24,7 +24,7 @@ import ( "fmt" "sync" - "github.com/lhui/incubator-answer-plugins/notification-wecom/i18n" + "github.com/apache/incubator-answer-plugins/notification-wecom/i18n" "github.com/apache/incubator-answer/plugin" "github.com/segmentfault/pacman/log" )
