- Add "tgChatId" and "tgBotToken" fields to configuration files - Modify "config.go" to include new configuration fields - Implement Telegram push hook functionality in "telegram_push.go" - Add test file "telegram_push_test.go" to test Telegram push hook functionality
22 lines
373 B
Go
22 lines
373 B
Go
package telegram_push
|
|
|
|
import (
|
|
"pmail/config"
|
|
"pmail/dto/parsemail"
|
|
"testing"
|
|
)
|
|
|
|
func testInit() {
|
|
|
|
config.Init()
|
|
|
|
}
|
|
func TestWeChatPushHook_ReceiveParseAfter(t *testing.T) {
|
|
testInit()
|
|
|
|
w := NewTelegramPushHook()
|
|
w.ReceiveParseAfter(&parsemail.Email{Subject: "标题", Text: []byte("文本内容"), From: &parsemail.User{
|
|
EmailAddress: "hello@gmail.com",
|
|
}})
|
|
}
|