mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 21:42:24 +00:00
Refresh button for client report in telegram bot
Added unlimited button for expire days.
This commit is contained in:
parent
961636b510
commit
ff33539fba
1 changed files with 15 additions and 2 deletions
|
@ -154,6 +154,9 @@ func (t *Tgbot) asnwerCallback(callbackQuery *tgbotapi.CallbackQuery, isAdmin bo
|
||||||
if len(dataArray) >= 2 && len(dataArray[1]) > 0 {
|
if len(dataArray) >= 2 && len(dataArray[1]) > 0 {
|
||||||
email := dataArray[1]
|
email := dataArray[1]
|
||||||
switch dataArray[0] {
|
switch dataArray[0] {
|
||||||
|
case "refresh_client":
|
||||||
|
t.sendCallbackAnswerTgBot(callbackQuery.ID, fmt.Sprintf("✅ %s : Refreshed successfully.", email))
|
||||||
|
t.searchClient(callbackQuery.From.ID, email, callbackQuery.Message.MessageID)
|
||||||
case "admin_cancel":
|
case "admin_cancel":
|
||||||
t.sendCallbackAnswerTgBot(callbackQuery.ID, fmt.Sprintf("❌ %s : Operation canceled.", email))
|
t.sendCallbackAnswerTgBot(callbackQuery.ID, fmt.Sprintf("❌ %s : Operation canceled.", email))
|
||||||
t.searchClient(callbackQuery.From.ID, email, callbackQuery.Message.MessageID)
|
t.searchClient(callbackQuery.From.ID, email, callbackQuery.Message.MessageID)
|
||||||
|
@ -176,6 +179,9 @@ func (t *Tgbot) asnwerCallback(callbackQuery *tgbotapi.CallbackQuery, isAdmin bo
|
||||||
tgbotapi.NewInlineKeyboardRow(
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
tgbotapi.NewInlineKeyboardButtonData("❌ Cancel Reset", "admin_cancel "+email),
|
tgbotapi.NewInlineKeyboardButtonData("❌ Cancel Reset", "admin_cancel "+email),
|
||||||
),
|
),
|
||||||
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
|
tgbotapi.NewInlineKeyboardButtonData("♾ Unlimited", "reset_expire_days_confirm "+email+" 0"),
|
||||||
|
),
|
||||||
tgbotapi.NewInlineKeyboardRow(
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
tgbotapi.NewInlineKeyboardButtonData("1 Mounth", "reset_expire_days_confirm "+email+" 30"),
|
tgbotapi.NewInlineKeyboardButtonData("1 Mounth", "reset_expire_days_confirm "+email+" 30"),
|
||||||
tgbotapi.NewInlineKeyboardButtonData("2 Mounth", "reset_expire_days_confirm "+email+" 60"),
|
tgbotapi.NewInlineKeyboardButtonData("2 Mounth", "reset_expire_days_confirm "+email+" 60"),
|
||||||
|
@ -199,7 +205,11 @@ func (t *Tgbot) asnwerCallback(callbackQuery *tgbotapi.CallbackQuery, isAdmin bo
|
||||||
if !err {
|
if !err {
|
||||||
days, error := strconv.Atoi(dataArray[2])
|
days, error := strconv.Atoi(dataArray[2])
|
||||||
if error == nil {
|
if error == nil {
|
||||||
t.inboundService.ResetClientExpiryTimeByEmail(email, int64(-(days * 24 * 60 * 60000)))
|
var date int64 = 0
|
||||||
|
if days > 0 {
|
||||||
|
date = int64(-(days * 24 * 60 * 60000))
|
||||||
|
}
|
||||||
|
t.inboundService.ResetClientExpiryTimeByEmail(email, date)
|
||||||
t.sendCallbackAnswerTgBot(callbackQuery.ID, fmt.Sprintf("✅ %s : Expire days reset successfully.", email))
|
t.sendCallbackAnswerTgBot(callbackQuery.ID, fmt.Sprintf("✅ %s : Expire days reset successfully.", email))
|
||||||
t.searchClient(callbackQuery.From.ID, email, callbackQuery.Message.MessageID)
|
t.searchClient(callbackQuery.From.ID, email, callbackQuery.Message.MessageID)
|
||||||
} else {
|
} else {
|
||||||
|
@ -505,7 +515,10 @@ func (t *Tgbot) searchClient(chatId int64, email string, messageID ...int) {
|
||||||
total, expiryTime)
|
total, expiryTime)
|
||||||
var inlineKeyboard = tgbotapi.NewInlineKeyboardMarkup(
|
var inlineKeyboard = tgbotapi.NewInlineKeyboardMarkup(
|
||||||
tgbotapi.NewInlineKeyboardRow(
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
tgbotapi.NewInlineKeyboardButtonData("🔄 Reset Traffic", "reset_traffic "+email),
|
tgbotapi.NewInlineKeyboardButtonData("🔄 Refresh", "refresh_client "+email),
|
||||||
|
),
|
||||||
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
|
tgbotapi.NewInlineKeyboardButtonData("📈 Reset Traffic", "reset_traffic "+email),
|
||||||
),
|
),
|
||||||
tgbotapi.NewInlineKeyboardRow(
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
tgbotapi.NewInlineKeyboardButtonData("📅 Reset Expire Days", "reset_expire_days "+email),
|
tgbotapi.NewInlineKeyboardButtonData("📅 Reset Expire Days", "reset_expire_days "+email),
|
||||||
|
|
Loading…
Reference in a new issue