1
// Copyright 2020 Wayback Archiver. All rights reserved.
2
// Use of this source code is governed by the GNU GPL v3
3
// license that can be found in the LICENSE file.
5
package publish // import "github.com/wabarc/wayback/publish"
8
"github.com/go-telegram-bot-api/telegram-bot-api"
9
"github.com/wabarc/wayback/config"
10
"github.com/wabarc/wayback/logger"
13
func ToChannel(opts *config.Options, bot *tgbotapi.BotAPI, text string) bool {
16
bot, err = tgbotapi.NewBotAPI(opts.TelegramToken())
18
logger.Error("Publish to Telegram Channel failed, %v", err)
23
msg := tgbotapi.NewMessageToChannel("@"+opts.TelegramChannel(), text)
24
msg.ParseMode = "html"
25
if _, err := bot.Send(msg); err != nil {
26
logger.Error("Publish message to channel failed, %v", err)