You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
597 B
25 lines
597 B
3 years ago
|
package app
|
||
|
|
||
|
import (
|
||
|
"gitea.russia9.dev/Russia9/chatwars-offers/messages"
|
||
|
"github.com/rs/zerolog/log"
|
||
|
"gopkg.in/tucnak/telebot.v2"
|
||
|
"strconv"
|
||
|
)
|
||
|
|
||
|
func (a *App) Sender(channel chan messages.OfferMessage) {
|
||
|
for {
|
||
|
var message messages.OfferMessage
|
||
|
message = <-channel
|
||
|
|
||
|
msgString :=
|
||
|
" " + message.SellerCastle + message.SellerName + ": \n" +
|
||
|
" " + strconv.Itoa(message.Quantity) + " " + message.Item + " *💰" + strconv.Itoa(message.Price)
|
||
|
|
||
|
_, err := a.Bot.Send(a.Chat, msgString, telebot.ModeHTML)
|
||
|
if err != nil {
|
||
|
log.Error().Err(err).Str("module", "sender").Send()
|
||
|
}
|
||
|
}
|
||
|
}
|