add frags
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Timofey.Kovalev
2021-06-16 11:33:05 +03:00
parent cbf3bb0303
commit 19d6fff7e7
3 changed files with 48 additions and 1 deletions

View File

@ -24,6 +24,7 @@ const (
emojiUp = "\xE2\xAC\x86"
emojiDeaths = "\xF0\x9F\x92\x80"
emojiTime = "\xF0\x9F\x95\x90"
emojiGun = "\xF0\x9F\x94\xAB"
)
func (p *playerInfo) updatePlayerInfo(ctx context.Context) error {
@ -36,10 +37,16 @@ func (p *playerInfo) updatePlayerInfo(ctx context.Context) error {
return err
}
kills, err := db.getKillsByOPlayerID(ctx, player.id)
if err != nil {
return err
}
test := `*%s* | %s
%s Уровень: *%s*
%s Смертей: *%d*
%s Время в игре: %s
%s Фрагов: %d
`
access := "\xE2\x9D\x8C offLine"
@ -55,12 +62,22 @@ func (p *playerInfo) updatePlayerInfo(ctx context.Context) error {
test = fmt.Sprintf(test, player.name, access,
emojiUp, level,
emojiDeaths, player.deaths,
emojiTime, player.onlineDuration.String())
emojiTime, player.onlineDuration.String(),
emojiGun, kills,
)
if p.playerMessageID != 0 {
mess := tgbotapi.NewEditMessageText(conf.ChatID, p.playerMessageID, test)
mess.ParseMode = tgbotapi.ModeMarkdown
ikm := tgbotapi.NewInlineKeyboardMarkup(
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("Подробнее", "additional"),
),
)
mess.ReplyMarkup = &ikm
_, err := botApi.Send(mess)
if err != nil {
return errors.Wrap(err, "Failed to update message")