Skip to content

Commit

Permalink
Fix the TG reminder bug for unlimited accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
mjef committed Apr 11, 2023
1 parent 9ed3b78 commit 7bd6b37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/service/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ func (j *TelegramService) NotifyUsersAboutToExpire() {
if err != nil || !traffic.Enable {
continue
}
if (traffic.Up + traffic.Down) > traffic.Total*85/100 {
if traffic.Total > 0 && ((traffic.Up + traffic.Down) > traffic.Total*85/100) {
msg := tgbotapi.NewMessage(clients[i].ChatID, Tr("msgTrafficExceeds85"))
bot.Send(msg)

usageMsg := j.GetClientUsage(clients[i].ChatID, uuid, j.settingService.GetTgCrmEnabled())
bot.Send(usageMsg)
} else {
} else if traffic.ExpiryTime > 0 {
remainingHours := time.Unix((traffic.ExpiryTime / 1000), 0).Sub(time.Now())
if remainingHours <= time.Hour*24 {
msg := tgbotapi.NewMessage(clients[i].ChatID, Tr("msgAccExpiringSoon"))
Expand Down

0 comments on commit 7bd6b37

Please sign in to comment.