From a547530aa27510e5e3b313034dc6ee1f9b92429e Mon Sep 17 00:00:00 2001 From: somebodywashere <68244480+somebodywashere@users.noreply.github.com> Date: Sat, 27 May 2023 17:23:15 +0000 Subject: [PATCH] fix tg bot expiryTime + additions to translations --- web/service/tgbot.go | 4 ++-- web/translation/translate.en_US.toml | 1 + web/translation/translate.fa_IR.toml | 1 + web/translation/translate.ru_RU.toml | 6 +++--- web/translation/translate.zh_Hans.toml | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/web/service/tgbot.go b/web/service/tgbot.go index 9cd88516..6e2e7556 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -701,8 +701,8 @@ func (t *Tgbot) getClientUsage(chatId int64, tgUserName string, tgUserID string) expiryTime := "" if traffic.ExpiryTime == 0 { expiryTime = t.I18nBot("tgbot.unlimited") - } else if traffic.ExpiryTime < 0 { - expiryTime = fmt.Sprintf("%d %s", traffic.ExpiryTime/-86400000, t.I18nBot("tgbot.days")) + } else if (traffic.ExpiryTime/1000 - time.Now().Unix() < 259200) { + expiryTime = fmt.Sprintf("%d %s", traffic.ExpiryTime/3600000, t.I18nBot("tgbot.hours")) } else { expiryTime = time.Unix((traffic.ExpiryTime / 1000), 0).Format("2006-01-02 15:04:05") } diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index 25872f98..2a2fcc08 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -384,6 +384,7 @@ "months" = "Months" "day" = "Day" "days" = "Days" +"hours" = "Hours" "unknown" = "Unknown" "inbounds" = "Inbounds" "clients" = "Clients" diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index 93419352..832ec085 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -384,6 +384,7 @@ "months" = "ماه‌ها" "day" = "روز" "days" = "روزها" +"hours" = "ساعت ها" "unknown" = "نامشخص" "inbounds" = "ورودی‌ها" "clients" = "کلاینت‌ها" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index a25f0e6a..bd927ba6 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -428,8 +428,8 @@ "expireIn" = "📅 Окончание через: {{ .Time }}\r\n \r\n" "active" = "💡 Активен: {{ .Enable }}\r\n" "email" = "📧 Email: {{ .Email }}\r\n" -"upload" = "🔼 Загрузка↑: {{ .Upload }}\r\n" -"download" = "🔽 Скачивание↓: {{ .Download }}\r\n" +"upload" = "🔼 Исходящий трафик: {{ .Upload }}\r\n" +"download" = "🔽 Входящий трафик: {{ .Download }}\r\n" "total" = "🔄 Всего: {{ .UpDown }} / {{ .Total }}\r\n" "TGUser" = "👤 Пользователь Telegram: {{ .TelegramID }}\r\n" "exhaustedMsg" = "🚨 Исчерпаны {{ .Type }}:\r\n" @@ -437,7 +437,7 @@ "disabled" = "🛑 Отключено: {{ .Disabled }}\r\n" "depleteSoon" = "🔜 Скоро исчерпание: {{ .Deplete }}\r\n \r\n" "backupTime" = "🗄 Время резервного копирования: {{ .Time }}\r\n" -"refreshedOn" = "🔄🕒 Обновлено: {{ .Time }}\r\n" +"refreshedOn" = "🔄🕒 Данные обновлены: {{ .Time }}\r\n" [tgbot.buttons] "closeKeyboard" = "❌ Закрыть клавиатуру" diff --git a/web/translation/translate.zh_Hans.toml b/web/translation/translate.zh_Hans.toml index c77549b1..c8054616 100644 --- a/web/translation/translate.zh_Hans.toml +++ b/web/translation/translate.zh_Hans.toml @@ -384,6 +384,7 @@ "months" = "月" "day" = "天" "days" = "天" +"hours" = "小时" "unknown" = "未知" "inbounds" = "入站连接" "clients" = "客户端"