Skip to content

Commit 8631464

Browse files
author
Magomed
committed
deployment setup
1 parent 758ed07 commit 8631464

4 files changed

Lines changed: 25 additions & 7 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ jobs:
4444
YK_SECRET_KEY=${{ secrets.YK_SECRET_KEY }}
4545
EOL
4646
47-
docker-compose -f docker/docker-compose.yml --env-file .env up --build -d
47+
DOCKER_BUILDKIT=1 docker-compose -f docker/docker-compose.yml --env-file .env up --build -d

internal/bot/handler.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ func (h *CallbackHandler) Message(update tgbotapi.Update) {
4949
}
5050

5151
switch update.Message.Text {
52-
//case "/start":
53-
// h.messenger.GetInfoStart(update)
5452
case "/connect_str":
5553
h.messenger.GetConnectStrOrReferral(update.Message.From.ID, false)
5654
case "/instruction":

internal/bot/keyboard.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
44

55
type KeyBoardInt interface {
66
GetTariffKeyboard() tgbotapi.InlineKeyboardMarkup
7-
GetStartButton() tgbotapi.InlineKeyboardMarkup
7+
GetStartButtonWithKey() tgbotapi.InlineKeyboardMarkup
8+
GetStartButtonWithoutKey() tgbotapi.InlineKeyboardMarkup
89
}
910

1011
type KeyBoard struct {
@@ -39,8 +40,8 @@ func (k *KeyBoard) GetTariffKeyboard() tgbotapi.InlineKeyboardMarkup {
3940
return tgbotapi.NewInlineKeyboardMarkup(buttons...)
4041
}
4142

42-
// GetStartButton - возвращает клавиатуру с кнопками если user уже является пользователем.
43-
func (k *KeyBoard) GetStartButton() tgbotapi.InlineKeyboardMarkup {
43+
// GetStartButtonWithKey - возвращает клавиатуру с кнопками если user уже является пользователем.
44+
func (k *KeyBoard) GetStartButtonWithKey() tgbotapi.InlineKeyboardMarkup {
4445
// Создаём кнопки.
4546
buttons := [][]tgbotapi.InlineKeyboardButton{
4647
{
@@ -51,3 +52,16 @@ func (k *KeyBoard) GetStartButton() tgbotapi.InlineKeyboardMarkup {
5152
// Возвращаем разметку с кнопками.
5253
return tgbotapi.NewInlineKeyboardMarkup(buttons...)
5354
}
55+
56+
// GetStartButtonWithoutKey - возвращает клавиатуру с кнопками если user ещё не является пользователем.
57+
func (k *KeyBoard) GetStartButtonWithoutKey() tgbotapi.InlineKeyboardMarkup {
58+
// Создаём кнопки.
59+
buttons := [][]tgbotapi.InlineKeyboardButton{
60+
{
61+
tgbotapi.NewInlineKeyboardButtonData("💰 Купить", "answer"),
62+
},
63+
}
64+
65+
// Возвращаем разметку с кнопками.
66+
return tgbotapi.NewInlineKeyboardMarkup(buttons...)
67+
}

internal/bot/messages.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func (m *MessengerBot) GetInfoStart(update tgbotapi.Update) {
107107
return
108108
}
109109

110+
var flag bool
110111
var respMessage string
111112
expirationTime, err := m.repo.GetExpirationTimeKey(int(userID))
112113

@@ -117,6 +118,7 @@ func (m *MessengerBot) GetInfoStart(update tgbotapi.Update) {
117118
respMessage = "🔑 *У вас нет активного ключа!*\n\n" +
118119
"❗ *Оформите подписку, чтобы получить доступ к VPN без ограничений.*\n\n" +
119120
"🔹 *Выберите тариф, оплатите — и вы в сети!*"
121+
flag = true
120122

121123
case err == nil && time.Now().After(expirationTime):
122124
// Если ключ истёк
@@ -141,7 +143,11 @@ func (m *MessengerBot) GetInfoStart(update tgbotapi.Update) {
141143
respMessage,
142144
)
143145

144-
keyboard := m.keyBoard.GetStartButton()
146+
keyboard := m.keyBoard.GetStartButtonWithKey()
147+
148+
if flag {
149+
keyboard = m.keyBoard.GetStartButtonWithoutKey()
150+
}
145151

146152
// Отправляем сообщение с клавиатурой
147153
msg := tgbotapi.NewMessage(update.Message.Chat.ID, welcomeMessage)

0 commit comments

Comments
 (0)