-
Notifications
You must be signed in to change notification settings - Fork 41
/
telegram.go
44 lines (39 loc) · 1.1 KB
/
telegram.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
log "github.com/sirupsen/logrus"
tb "gopkg.in/tucnak/telebot.v2"
)
func (bot TipBot) tryForwardMessage(to tb.Recipient, what tb.Editable, options ...interface{}) (msg *tb.Message) {
msg, err := bot.telegram.Forward(to, what, options...)
if err != nil {
log.Errorln(err.Error())
}
return
}
func (bot TipBot) trySendMessage(to tb.Recipient, what interface{}, options ...interface{}) (msg *tb.Message) {
msg, err := bot.telegram.Send(to, what, options...)
if err != nil {
log.Errorln(err.Error())
}
return
}
func (bot TipBot) tryReplyMessage(to *tb.Message, what interface{}, options ...interface{}) (msg *tb.Message) {
msg, err := bot.telegram.Reply(to, what, options...)
if err != nil {
log.Errorln(err.Error())
}
return
}
func (bot TipBot) tryEditMessage(to tb.Editable, what interface{}, options ...interface{}) (msg *tb.Message) {
msg, err := bot.telegram.Edit(to, what, options...)
if err != nil {
log.Errorln(err.Error())
}
return
}
func (bot TipBot) tryDeleteMessage(msg tb.Editable) {
err := bot.telegram.Delete(msg)
if err != nil {
log.Errorln(err.Error())
}
}