Skip to content

Commit

Permalink
[bot] replace boolian with yes/no MHSanaei#537
Browse files Browse the repository at this point in the history
  • Loading branch information
alireza0 authored and somebodywashere committed Oct 27, 2023
1 parent 0117a82 commit 3748bab
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 40 deletions.
98 changes: 58 additions & 40 deletions web/service/tgbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,17 +740,19 @@ func (t *Tgbot) getClientUsage(chatId int64, tgUserName string, tgUserID string)
total = common.FormatTraffic((traffic.Total))
}

active := ""
if traffic.Enable {
active = t.I18nBot("tgbot.messages.yes")
} else {
active = t.I18nBot("tgbot.messages.no")
}

output := ""
output += t.I18nBot("tgbot.messages.active", "Enable=="+active)
output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)
if traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
} else {
output += t.I18nBot("tgbot.messages.expire", "Time=="+expiryTime)
}
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
} else {
output += t.I18nBot("tgbot.messages.inactive")
output += t.I18nBot("tgbot.messages.expire", "Time=="+expiryTime)
}
output += t.I18nBot("tgbot.messages.upload", "Upload=="+common.FormatTraffic(traffic.Up))
Expand Down Expand Up @@ -878,19 +880,23 @@ func (t *Tgbot) searchClient(chatId int64, email string, messageID ...int) {
total = common.FormatTraffic((traffic.Total))
}

active := ""
if traffic.Enable {
active = t.I18nBot("tgbot.messages.yes")
} else {
active = t.I18nBot("tgbot.messages.no")
}

output := ""
output += t.I18nBot("tgbot.messages.active", "Enable=="+active)
output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)
if traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
} else {
output += t.I18nBot("tgbot.messages.expire", "Time=="+expiryTime)
}

if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
} else {
output += t.I18nBot("tgbot.messages.inactive")
output += t.I18nBot("tgbot.messages.expire", "Time=="+expiryTime)
}

output += t.I18nBot("tgbot.messages.upload", "Upload=="+common.FormatTraffic(traffic.Up))
output += t.I18nBot("tgbot.messages.download", "Download=="+common.FormatTraffic(traffic.Down))
output += t.I18nBot("tgbot.messages.total", "UpDown=="+common.FormatTraffic((traffic.Up+traffic.Down)), "Total=="+total)
Expand Down Expand Up @@ -976,19 +982,23 @@ func (t *Tgbot) searchInbound(chatId int64, remark string) {
total = common.FormatTraffic((traffic.Total))
}

active := ""
if traffic.Enable {
active = t.I18nBot("tgbot.messages.yes")
} else {
active = t.I18nBot("tgbot.messages.no")
}

output := ""
output += t.I18nBot("tgbot.messages.active", "Enable=="+active)
output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)
if traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
} else {
output += t.I18nBot("tgbot.messages.expire", "Time=="+expiryTime)
}

if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
} else {
output += t.I18nBot("tgbot.messages.inactive")
output += t.I18nBot("tgbot.messages.expire", "Time=="+expiryTime)
}

output += t.I18nBot("tgbot.messages.upload", "Upload=="+common.FormatTraffic(traffic.Up))
output += t.I18nBot("tgbot.messages.download", "Download=="+common.FormatTraffic(traffic.Down))
output += t.I18nBot("tgbot.messages.total", "UpDown=="+common.FormatTraffic((traffic.Up+traffic.Down)), "Total=="+total)
Expand Down Expand Up @@ -1036,19 +1046,23 @@ func (t *Tgbot) searchForClient(chatId int64, query string) {
total = common.FormatTraffic((traffic.Total))
}

active := ""
if traffic.Enable {
active = t.I18nBot("tgbot.messages.yes")
} else {
active = t.I18nBot("tgbot.messages.no")
}

output := ""
output += t.I18nBot("tgbot.messages.active", "Enable=="+active)
output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)
if traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
} else {
output += t.I18nBot("tgbot.messages.expire", "Time=="+expiryTime)
}

if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
} else {
output += t.I18nBot("tgbot.messages.inactive")
output += t.I18nBot("tgbot.messages.expire", "Time=="+expiryTime)
}

output += t.I18nBot("tgbot.messages.upload", "Upload=="+common.FormatTraffic(traffic.Up))
output += t.I18nBot("tgbot.messages.download", "Download=="+common.FormatTraffic(traffic.Down))
output += t.I18nBot("tgbot.messages.total", "UpDown=="+common.FormatTraffic((traffic.Up+traffic.Down)), "Total=="+total)
Expand Down Expand Up @@ -1157,18 +1171,22 @@ func (t *Tgbot) getExhausted() string {
total = common.FormatTraffic((traffic.Total))
}

output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)
active := ""
if traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
} else {
output += t.I18nBot("tgbot.messages.expire", "Time=="+expiryTime)
}
active = t.I18nBot("tgbot.messages.yes")
} else {
active = t.I18nBot("tgbot.messages.no")
}

output += t.I18nBot("tgbot.messages.active", "Enable=="+active)
output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)

if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
} else {
output += t.I18nBot("tgbot.messages.inactive")
output += t.I18nBot("tgbot.messages.expire", "Time=="+expiryTime)
}

output += t.I18nBot("tgbot.messages.upload", "Upload=="+common.FormatTraffic(traffic.Up))
output += t.I18nBot("tgbot.messages.download", "Download=="+common.FormatTraffic(traffic.Down))
output += t.I18nBot("tgbot.messages.total", "UpDown=="+common.FormatTraffic((traffic.Up+traffic.Down)), "Total=="+total)
Expand Down
2 changes: 2 additions & 0 deletions web/translation/translate.en_US.toml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@
"depleteSoon" = "🔜 Deplete soon: {{ .Deplete }}\r\n \r\n"
"backupTime" = "🗄 Backup Time: {{ .Time }}\r\n"
"refreshedOn" = "\r\n📋🔄 Refreshed On: {{ .Time }}\r\n \r\n"
"yes" = "✅ Yes"
"no" = "❌ No"

[tgbot.buttons]
"closeKeyboard" = "❌ Close Keyboard"
Expand Down
2 changes: 2 additions & 0 deletions web/translation/translate.fa_IR.toml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@
"depleteSoon" = "🔜 به زودی به پایان خواهد رسید: {{ .Deplete }}\r\n \r\n"
"backupTime" = "🗄 زمان پشتیبان‌گیری: {{ .Time }}\r\n"
"refreshedOn" = "\r\n📋🔄 تازه‌سازی شده در: {{ .Time }}\r\n \r\n"
"yes" = "✅ بله"
"no" = "❌ خیر"

[tgbot.buttons]
"closeKeyboard" = "❌ بستن کیبورد"
Expand Down
2 changes: 2 additions & 0 deletions web/translation/translate.ru_RU.toml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@
"depleteSoon" = "🔜 Скоро исчерпание: {{ .Deplete }}\r\n \r\n"
"backupTime" = "🗄 Время резервного копирования: {{ .Time }}\r\n"
"refreshedOn" = "\r\n📋🔄 Обновлено: {{ .Time }}\r\n \r\n"
"yes" = "✅ Да"
"no" = "❌ Нет"

[tgbot.buttons]
"closeKeyboard" = "❌ Закрыть клавиатуру"
Expand Down
2 changes: 2 additions & 0 deletions web/translation/translate.zh_Hans.toml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@
"depleteSoon" = "🔜 即将耗尽:{{ .Deplete }}\r\n \r\n"
"backupTime" = "🗄 备份时间:{{ .Time }}\r\n"
"refreshedOn" = "\r\n📋🔄 刷新时间:{{ .Time }}\r\n \r\n"
"yes" = "✅ 是"
"no" = "❌ 不"

[tgbot.buttons]
"closeKeyboard" = "❌ 关闭键盘"
Expand Down

0 comments on commit 3748bab

Please sign in to comment.