telegramnotifier: add SetOwner method

This commit is contained in:
c9s 2022-01-14 11:38:38 +08:00
parent dd93ee4fd3
commit 97ca304bec

View File

@ -115,6 +115,11 @@ func (n *Notifier) AddSubscriber(m *telebot.Message) {
n.Chats[m.Chat.ID] = m.Time()
}
func (n *Notifier) SetOwner(owner *telebot.User, chat *telebot.Chat) {
n.Owner = owner
n.OwnerChat = chat
}
func (n *Notifier) SendToOwner(message string) {
if _, err := n.Bot.Send(n.OwnerChat, message); err != nil {
log.WithError(err).Error("telegram send error")