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 ad0269f commit 9aeaad9
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
42 changes: 41 additions & 1 deletion web/service/tgbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (t *Tgbot) OnReceive() {
func (t *Tgbot) answerCommand(message *telego.Message, chatId int64, isAdmin bool) {
msg, onlyMessage := "", false

command, commandArgs := tu.ParseCommand(message.Text)
command, _, commandArgs := tu.ParseCommand(message.Text)

// Extract the command from the Message.
switch command {
Expand Down Expand Up @@ -740,7 +740,15 @@ 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")
Expand Down Expand Up @@ -878,7 +886,15 @@ 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")
Expand Down Expand Up @@ -976,7 +992,15 @@ 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")
Expand Down Expand Up @@ -1036,7 +1060,15 @@ 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")
Expand Down Expand Up @@ -1157,6 +1189,14 @@ func (t *Tgbot) getExhausted() string {
total = common.FormatTraffic((traffic.Total))
}

active := ""
if traffic.Enable {
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 traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
Expand Down
3 changes: 2 additions & 1 deletion web/translation/translate.en_US.toml
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@
"disabled" = "🛑 Disabled: {{ .Disabled }}\r\n"
"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
3 changes: 2 additions & 1 deletion web/translation/translate.fa_IR.toml
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@
"disabled" = "🛑 غیرفعال: {{ .Disabled }}\r\n"
"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
3 changes: 2 additions & 1 deletion web/translation/translate.ru_RU.toml
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@
"disabled" = "🛑 Отключено: {{ .Disabled }}\r\n"
"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
3 changes: 2 additions & 1 deletion web/translation/translate.zh_Hans.toml
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@
"disabled" = "🛑 禁用:{{ .Disabled }}\r\n"
"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 9aeaad9

Please sign in to comment.