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.
47 lines
1.2 KiB
47 lines
1.2 KiB
package app |
|
|
|
import ( |
|
"gitea.russia9.dev/Russia9/chatwars-duels/messages" |
|
"github.com/rs/zerolog/log" |
|
"gopkg.in/tucnak/telebot.v2" |
|
"strconv" |
|
) |
|
|
|
func (a *App) Sender(channel chan messages.DuelMessage) { |
|
for { |
|
var message messages.DuelMessage |
|
message = <-channel |
|
if message.Winner.Tag != "" { |
|
message.Winner.Tag = "[" + message.Winner.Tag + "]" |
|
} |
|
if message.Loser.Tag != "" { |
|
message.Loser.Tag = "[" + message.Loser.Tag + "]" |
|
} |
|
|
|
msgString := "Победитель: " + |
|
message.Winner.Castle + |
|
message.Winner.Tag + |
|
message.Winner.Name + |
|
" 🏅" + strconv.Itoa(message.Winner.Level) + |
|
" ❤" + strconv.Itoa(message.Winner.Health) + " \n" + |
|
"Проигравший: " + |
|
message.Loser.Castle + |
|
message.Loser.Tag + |
|
message.Loser.Name + |
|
" 🏅" + strconv.Itoa(message.Loser.Level) + |
|
" ❤" + strconv.Itoa(message.Loser.Health) |
|
|
|
if message.IsChallenge { |
|
msgString += "\n" + "<b>Дружеская дуэль</b>" |
|
} |
|
|
|
if message.IsGuildDuel { |
|
msgString += "\n" + "<b>Гильдейская дуэль</b>" |
|
} |
|
|
|
_, err := a.Bot.Send(a.Chat, msgString, telebot.ModeHTML) |
|
if err != nil { |
|
log.Error().Err(err).Send() |
|
} |
|
} |
|
}
|
|
|