package cmd import ( "git.db.org.ai/dborg/internal/formatter" "github.com/spf13/cobra" ) var telegramCmd = &cobra.Command{ Use: "telegram", Short: "Telegram lookup commands", Long: `Lookup phone numbers associated with Telegram accounts`, } var phoneCmd = &cobra.Command{ Use: "phone [identifier]", Short: "Get phone number for Telegram user", Long: `Retrieves the phone number associated with a Telegram username (with @ prefix) or user ID`, Args: cobra.ExactArgs(1), RunE: runTelegramPhone, } func init() { rootCmd.AddCommand(telegramCmd) telegramCmd.AddCommand(phoneCmd) } func runTelegramPhone(cmd *cobra.Command, args []string) error { identifier := args[0] c, err := newClient() if err != nil { return err } response, err := c.GetTelegramPhone(identifier) if err != nil { return err } if err := checkError(response.Error); err != nil { return err } return formatter.FormatTelegramResults(response, IsJSONOutput()) }