summaryrefslogtreecommitdiffstats
path: root/internal/formatter/telegram.go
blob: 7491c66e085e8f12444ec9ed56a4aaf8dc922826 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package formatter

import (
	"fmt"
	"git.db.org.ai/dborg/internal/models"
	"git.db.org.ai/dborg/internal/utils"
)

func FormatTelegramResults(response *models.TelegramPhoneResponse, asJSON bool) error {
	if asJSON {
		return utils.PrintJSON(response)
	}

	PrintSection(fmt.Sprintf("📱 Telegram Phone Lookup"))

	fmt.Printf("%s: %s\n", Cyan("Identifier"), response.Identifier)

	if response.PhoneNumber != "" {
		fmt.Printf("%s: %s\n", Cyan("Phone Number"), Green(response.PhoneNumber))
	} else {
		fmt.Printf("%s: %s\n", Cyan("Phone Number"), Red("Not found"))
	}

	fmt.Println()
	PrintDivider()
	fmt.Printf("%s: ", Cyan("Credits Remaining"))
	if response.Credits.Unlimited {
		fmt.Printf("%s\n", Green("Unlimited"))
	} else {
		fmt.Printf("%s\n", FormatCredits(int64(response.Credits.Remaining)))
	}

	return nil
}