diff --git a/web/service/tgbot.go b/web/service/tgbot.go
index e0261775..0ad7c3c6 100644
--- a/web/service/tgbot.go
+++ b/web/service/tgbot.go
@@ -188,7 +188,7 @@ func (t *Tgbot) OnReceive() {
}
func (t *Tgbot) answerCommand(message *telego.Message, chatId int64, isAdmin bool) {
- msg := ""
+ msg, onlyMessage := "", false
command, commandArgs := tu.ParseCommand(message.Text)
@@ -204,8 +204,13 @@ func (t *Tgbot) answerCommand(message *telego.Message, chatId int64, isAdmin boo
}
msg += "\n\n" + t.I18nBot("tgbot.commands.pleaseChoose")
case "status":
+ onlyMessage = true
msg += t.I18nBot("tgbot.commands.status")
+ case "id":
+ onlyMessage = true
+ msg += t.I18nBot("tgbot.commands.getID", "ID=="+strconv.FormatInt(message.From.ID, 10))
case "usage":
+ onlyMessage = true
if len(commandArgs) > 0 {
if isAdmin {
t.searchClient(chatId, commandArgs[0])
@@ -216,6 +221,7 @@ func (t *Tgbot) answerCommand(message *telego.Message, chatId int64, isAdmin boo
msg += t.I18nBot("tgbot.commands.usage")
}
case "inbound":
+ onlyMessage = true
if isAdmin && len(commandArgs) > 0 {
t.searchInbound(chatId, commandArgs[0])
} else {
@@ -224,6 +230,11 @@ func (t *Tgbot) answerCommand(message *telego.Message, chatId int64, isAdmin boo
default:
msg += t.I18nBot("tgbot.commands.unknown")
}
+
+ if onlyMessage {
+ t.SendMsgToTgbot(chatId, msg)
+ return
+ }
t.SendAnswer(chatId, msg, isAdmin)
}
@@ -498,6 +509,7 @@ func (t *Tgbot) SendMsgToTgbot(chatId int64, msg string, replyMarkup ...telego.R
if !isRunning {
return
}
+
if msg == "" {
logger.Info("[tgbot] message is empty!")
return
@@ -723,7 +735,7 @@ func (t *Tgbot) getClientUsage(chatId int64, tgUserName string, tgUserID string)
output := ""
output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)
- if (traffic.Enable) {
+ if traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
@@ -791,6 +803,7 @@ func (t *Tgbot) clientTelegramUserInfo(chatId int64, email string, messageID ...
output := ""
output += t.I18nBot("tgbot.messages.email", "Email=="+email)
output += t.I18nBot("tgbot.messages.TGUser", "TelegramID=="+tgId)
+ output += t.I18nBot("tgbot.messages.refreshedOn", "Time=="+time.Now().Format("2006-01-02 15:04:05"))
inlineKeyboard := tu.InlineKeyboard(
tu.InlineKeyboardRow(
@@ -840,7 +853,7 @@ func (t *Tgbot) searchClient(chatId int64, email string, messageID ...int) {
flag := false
diff := traffic.ExpiryTime/1000 - now
if traffic.ExpiryTime == 0 {
- expiryTime = t.I18nBot("tgbot.unlimited")
+ expiryTime = t.I18nBot("tgbot.unlimited")
} else if diff > 172800 || !traffic.Enable {
expiryTime = time.Unix((traffic.ExpiryTime / 1000), 0).Format("2006-01-02 15:04:05")
} else if traffic.ExpiryTime < 0 {
@@ -860,7 +873,7 @@ func (t *Tgbot) searchClient(chatId int64, email string, messageID ...int) {
output := ""
output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)
- if (traffic.Enable) {
+ if traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
@@ -918,7 +931,7 @@ func (t *Tgbot) searchInbound(chatId int64, remark string) {
t.SendMsgToTgbot(chatId, msg)
return
}
-
+
now := time.Now().Unix()
for _, inbound := range inbouds {
info := ""
@@ -958,7 +971,7 @@ func (t *Tgbot) searchInbound(chatId int64, remark string) {
output := ""
output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)
- if (traffic.Enable) {
+ if traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
@@ -998,7 +1011,7 @@ func (t *Tgbot) searchForClient(chatId int64, query string) {
flag := false
diff := traffic.ExpiryTime/1000 - now
if traffic.ExpiryTime == 0 {
- expiryTime = t.I18nBot("tgbot.unlimited")
+ expiryTime = t.I18nBot("tgbot.unlimited")
} else if diff > 172800 || !traffic.Enable {
expiryTime = time.Unix((traffic.ExpiryTime / 1000), 0).Format("2006-01-02 15:04:05")
} else if traffic.ExpiryTime < 0 {
@@ -1018,7 +1031,7 @@ func (t *Tgbot) searchForClient(chatId int64, query string) {
output := ""
output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)
- if (traffic.Enable) {
+ if traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
@@ -1117,7 +1130,7 @@ func (t *Tgbot) getExhausted() string {
for _, traffic := range exhaustedClients {
expiryTime := ""
flag := false
- diff := (traffic.ExpiryTime - now)/1000
+ diff := (traffic.ExpiryTime - now) / 1000
if traffic.ExpiryTime == 0 {
expiryTime = t.I18nBot("tgbot.unlimited")
} else if diff > 172800 || !traffic.Enable {
@@ -1138,7 +1151,7 @@ func (t *Tgbot) getExhausted() string {
}
output += t.I18nBot("tgbot.messages.email", "Email=="+traffic.Email)
- if (traffic.Enable) {
+ if traffic.Enable {
output += t.I18nBot("tgbot.messages.active")
if flag {
output += t.I18nBot("tgbot.messages.expireIn", "Time=="+expiryTime)
diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml
index edd4ca80..401a1265 100644
--- a/web/translation/translate.en_US.toml
+++ b/web/translation/translate.en_US.toml
@@ -168,7 +168,7 @@
"setDefaultCert" = "Set cert from panel"
"xtlsDesc" = "Xray core needs to be 1.7.5"
"realityDesc" = "Xray core needs to be 1.8.0 or higher."
-"telegramDesc" = "use Telegram ID without @ or chat IDs ( you can get it here @userinfobot )"
+"telegramDesc" = "use Telegram ID without @ or chat IDs ( you can get it here @userinfobot or use '/id' command in bot )"
"subscriptionDesc" = "you can find your sub link on Details, also you can use the same name for several configurations"
[pages.client]
@@ -240,7 +240,7 @@
"telegramToken" = "Telegram Token"
"telegramTokenDesc" = "You must get the token from the manager of Telegram bots @botfather"
"telegramChatId" = "Telegram Admin Chat IDs"
-"telegramChatIdDesc" = "Multiple Chat IDs separated by comma. use @userinfobot to get your Chat IDs."
+"telegramChatIdDesc" = "Multiple Chat IDs separated by comma. use @userinfobot or use '/id' command in bot to get your Chat IDs."
"telegramNotifyTime" = "Telegram bot notification time"
"telegramNotifyTimeDesc" = "Use Crontab timing format."
"tgNotifyBackup" = "Database Backup"
@@ -399,6 +399,7 @@
"welcome" = "🤖 Welcome to {{ .Hostname }} management bot.\r\n"
"status" = "✅ Bot is ok!"
"usage" = "❗ Please provide a text to search!"
+"getID" = "🆔 Your ID: {{ .ID }}
"
"helpAdminCommands" = "Search for a client email:\r\n/usage [Email]
\r\n \r\nSearch for inbounds (with client stats):\r\n/inbound [Remark]
"
"helpClientCommands" = "To search for statistics, just use folowing command:\r\n \r\n/usage [UUID|Password]
\r\n \r\nUse UUID for vmess/vless and Password for Trojan."
diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml
index b8b1b5fb..841483c7 100644
--- a/web/translation/translate.fa_IR.toml
+++ b/web/translation/translate.fa_IR.toml
@@ -168,7 +168,7 @@
"setDefaultCert" = "استفاده از گواهی پنل"
"xtlsDesc" = "هسته Xray باید 1.7.5 باشد"
"realityDesc" = "هسته Xray باید 1.8.0 و بالاتر باشد"
-"telegramDesc" = "از آیدی تلگرام بدون @ یا آیدی چت استفاده کنید (می توانید آن را از اینجا دریافت کنید @userinfobot)"
+"telegramDesc" = "از آیدی تلگرام بدون @ یا آیدی چت استفاده کنید (می توانید آن را از اینجا دریافت کنید @userinfobot یا در ربات دستور '/id' را وارد کنید)"
"subscriptionDesc" = "می توانید ساب لینک خود را در جزئیات پیدا کنید، همچنین می توانید از همین نام برای چندین کانفیگ استفاده کنید"
[pages.client]
@@ -240,7 +240,7 @@
"telegramToken" = "توکن تلگرام"
"telegramTokenDesc" = "توکن را باید از مدیر بات های تلگرام دریافت کنید @botfather"
"telegramChatId" = "آی دی تلگرام مدیریت"
-"telegramChatIdDesc" = "از @userinfobot برای دریافت شناسه های چت خود استفاده کنید. با استفاده از کاما میتونید چند آی دی را از هم جدا کنید. "
+"telegramChatIdDesc" = "از @userinfobot یا دستور '/id' در ربات برای دریافت شناسه های چت خود استفاده کنید. با استفاده از کاما میتونید چند آی دی را از هم جدا کنید. "
"telegramNotifyTime" = "مدت زمان نوتیفیکیشن ربات تلگرام"
"telegramNotifyTimeDesc" = "از فرمت زمان بندی لینوکس استفاده کنید "
"tgNotifyBackup" = "پشتیبان گیری از پایگاه داده"
@@ -399,6 +399,7 @@
"welcome" = "🤖 به ربات مدیریت {{ .Hostname }} خوش آمدید.\r\n"
"status" = "✅ ربات در حالت عادی است!"
"usage" = "❗ لطفاً یک متن برای جستجو وارد کنید!"
+"getID" = "🆔 شناسه شما: {{ .ID }}
"
"helpAdminCommands" = "برای جستجوی ایمیل مشتری:\r\n/usage [ایمیل]
\r\n \r\nبرای جستجوی ورودیها (با آمار مشتری):\r\n/inbound [توضیح]
"
"helpClientCommands" = "برای جستجوی آمار، فقط از دستور زیر استفاده کنید:\r\n \r\n/usage [UUID|رمز عبور]
\r\n \r\nاز UUID برای vmess/vless و از رمز عبور برای Trojan استفاده کنید."
diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml
index a96cad1c..45a73a97 100644
--- a/web/translation/translate.ru_RU.toml
+++ b/web/translation/translate.ru_RU.toml
@@ -168,7 +168,7 @@
"setDefaultCert" = "Установить сертификат с панели"
"xtlsDesc" = "Версия Xray должна быть не ниже 1.7.5"
"realityDesc" = "Версия Xray должна быть не ниже 1.8.0"
-"telegramDesc" = "Используйте Telegram ID без @ или ID пользователя (вы можете получить его у @userinfobot)"
+"telegramDesc" = "Используйте идентификатор Telegram без символа @ или идентификатора чата (можно получить его здесь @userinfobot или использовать команду '/id' в боте)"
"subscriptionDesc" = "Вы можете найти свою ссылку подписки в разделе «Подробнее», также вы можете использовать одно и то же имя для нескольких конфигураций"
[pages.client]
@@ -240,7 +240,7 @@
"telegramToken" = "Токен Telegram бота"
"telegramTokenDesc" = "Необходимо получить токен у менеджера ботов Telegram @botfather"
"telegramChatId" = "Telegram ID админа бота"
-"telegramChatIdDesc" = "Несколько Telegram ID, разделённых запятой. Используйте @userinfobot, чтобы получить Telegram ID"
+"telegramChatIdDesc" = "Множественные идентификаторы чата, разделенные запятыми. Чтобы получить свои идентификаторы чатов, используйте @userinfobot или команду '/id' в боте."
"telegramNotifyTime" = "Частота уведомлений бота Telegram"
"telegramNotifyTimeDesc" = "Используйте формат времени Crontab"
"tgNotifyBackup" = "Резервное копирование базы данных"
@@ -399,6 +399,7 @@
"welcome" = "🤖 Добро пожаловать в бота управления {{ .Hostname }}.\r\n"
"status" = "✅ Бот работает нормально!"
"usage" = "❗ Пожалуйста, укажите текст для поиска!"
+"getID" = "🆔 Ваш ID: {{ .ID }}
"
"helpAdminCommands" = "Поиск по электронной почте клиента:\r\n/usage [Email]
\r\n \r\nПоиск входящих соединений (со статистикой клиента):\r\n/inbound [Remark]
"
"helpClientCommands" = "Для получения статистики используйте следующую команду:\r\n \r\n/usage [UUID|Password]
\r\n \r\nИспользуйте UUID для vmess/vless и пароль для Trojan."
diff --git a/web/translation/translate.zh_Hans.toml b/web/translation/translate.zh_Hans.toml
index febbe4b8..70c24df7 100644
--- a/web/translation/translate.zh_Hans.toml
+++ b/web/translation/translate.zh_Hans.toml
@@ -168,7 +168,7 @@
"setDefaultCert" = "从面板设置证书"
"xtlsDesc" = "Xray核心需要1.7.5"
"realityDesc" = "Xray核心需要1.8.0及以上版本"
-"telegramDesc" = "使用不带@的电报 ID 或聊天 ID(您可以在此处获取 @userinfobot)"
+"telegramDesc" = "使用 Telegram ID,不包含 @ 符号或聊天 ID(可以在 @userinfobot 处获取,或在机器人中使用'/id'命令)"
"subscriptionDesc" = "您可以在详细信息上找到您的子链接,也可以对多个配置使用相同的名称"
[pages.client]
@@ -240,7 +240,7 @@
"telegramToken" = "电报机器人TOKEN"
"telegramTokenDesc" = "重启面板生效"
"telegramChatId" = "以逗号分隔的多个 chatID 重启面板生效"
-"telegramChatIdDesc" = "多个聊天 ID 以逗号分隔。使用@userinfobot 获取您的聊天 ID。重新启动面板以应用更改。"
+"telegramChatIdDesc" = "多个聊天 ID 用逗号分隔。使用 @userinfobot 或在机器人中使用'/id'命令获取您的聊天 ID。"
"telegramNotifyTime" = "电报机器人通知时间"
"telegramNotifyTimeDesc" = "采用Crontab定时格式,重启面板生效"
"tgNotifyBackup" = "数据库备份"
@@ -399,6 +399,7 @@
"welcome" = "🤖 欢迎来到{{ .Hostname }}管理机器人。\r\n"
"status" = "✅ 机器人正常运行!"
"usage" = "❗ 请输入要搜索的文本!"
+"getID" = "🆔 您的ID为:{{ .ID }}
"
"helpAdminCommands" = "搜索客户端邮箱:\r\n/usage [Email]
\r\n \r\n搜索入站连接(包含客户端统计信息):\r\n/inbound [Remark]
"
"helpClientCommands" = "要搜索统计信息,请使用以下命令:\r\n \r\n/usage [UUID|Password]
\r\n \r\n对于vmess/vless,请使用UUID;对于Trojan,请使用密码。"