Add fixes and linter improvements to talkers package
This commit is contained in:
@@ -12,6 +12,10 @@ var (
|
||||
c *appcontext.Context
|
||||
)
|
||||
|
||||
const (
|
||||
parseMode = "Markdown"
|
||||
)
|
||||
|
||||
// Sender is a function-handling struct for sender
|
||||
type Sender struct{}
|
||||
|
||||
|
@@ -7,10 +7,10 @@ import (
|
||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||
)
|
||||
|
||||
// SendMarkdownAnswer sends markdown-powered message as reply
|
||||
// SendMarkdownAnswer sends markdown-powered message as answer
|
||||
func (s *Sender) SendMarkdownAnswer(update *tgbotapi.Update, message string) {
|
||||
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
|
||||
msg.ParseMode = "Markdown"
|
||||
msg.ParseMode = parseMode
|
||||
|
||||
_, err := c.Bot.Send(msg)
|
||||
if err != nil {
|
||||
@@ -21,7 +21,19 @@ func (s *Sender) SendMarkdownAnswer(update *tgbotapi.Update, message string) {
|
||||
// SendMarkdownMessageToChatID sends markdown-powered message to specified chat
|
||||
func (s *Sender) SendMarkdownMessageToChatID(chatID int64, message string) {
|
||||
msg := tgbotapi.NewMessage(chatID, message)
|
||||
msg.ParseMode = "Markdown"
|
||||
msg.ParseMode = parseMode
|
||||
|
||||
_, err := c.Bot.Send(msg)
|
||||
if err != nil {
|
||||
c.Log.Error(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// SendMarkdownReply sends markdown-powered message as reply
|
||||
func (s *Sender) SendMarkdownReply(update *tgbotapi.Update, message string, messageID int) {
|
||||
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
|
||||
msg.ParseMode = parseMode
|
||||
msg.ReplyToMessageID = messageID
|
||||
|
||||
_, err := c.Bot.Send(msg)
|
||||
if err != nil {
|
||||
|
@@ -13,4 +13,5 @@ type SenderInterface interface {
|
||||
|
||||
SendMarkdownAnswer(update *tgbotapi.Update, message string)
|
||||
SendMarkdownMessageToChatID(chatID int64, message string)
|
||||
SendMarkdownReply(update *tgbotapi.Update, message string, messageID int)
|
||||
}
|
||||
|
Reference in New Issue
Block a user