diff options
Diffstat (limited to 'cmd/x.go')
| -rw-r--r-- | cmd/x.go | 198 |
1 files changed, 198 insertions, 0 deletions
@@ -70,6 +70,12 @@ func init() { xCmd.AddCommand(xNFLCmd) xCmd.AddCommand(xRepliesCmd) xCmd.AddCommand(xSearchCmd) + xCmd.AddCommand(xDeletedTweetsCmd) + xCmd.AddCommand(xDomainCmd) + xCmd.AddCommand(xHoldersMapCmd) + xCmd.AddCommand(xIDCmd) + xCmd.AddCommand(xImageCmd) + xCmd.AddCommand(xUserIDCmd) xRepliesCmd.Flags().Int("limit", 100, "Maximum number of replies to fetch") xSearchCmd.Flags().Int("limit", 100, "Maximum number of tweets to fetch") @@ -225,3 +231,195 @@ func runXSearch(cmd *cobra.Command, args []string) error { return nil } + +var xDeletedTweetsCmd = &cobra.Command{ + Use: "deleted-tweets [handle]", + Short: "Check deleted tweets for a Twitter/X account", + Long: `Checks deleted token-related tweets from a Twitter account`, + Args: cobra.ExactArgs(1), + RunE: runXDeletedTweets, +} + +var xDomainCmd = &cobra.Command{ + Use: "domain [domain]", + Short: "Check domain/website age", + Long: `Checks the age of a domain/website`, + Args: cobra.ExactArgs(1), + RunE: runXDomain, +} + +var xHoldersMapCmd = &cobra.Command{ + Use: "holders-map [address]", + Short: "Analyze holder trading behavior for a token", + Long: `Analyzes trading behavior of top 50 holders for a token`, + Args: cobra.ExactArgs(1), + RunE: runXHoldersMap, +} + +var xIDCmd = &cobra.Command{ + Use: "id [handle]", + Short: "Get Twitter ID for a handle", + Long: `Retrieves the Twitter ID for a given handle`, + Args: cobra.ExactArgs(1), + RunE: runXID, +} + +var xImageCmd = &cobra.Command{ + Use: "image [address]", + Short: "Reverse image search for a token", + Long: `Performs reverse image search for a token (SOL/TRON)`, + Args: cobra.ExactArgs(1), + RunE: runXImage, +} + +var xUserIDCmd = &cobra.Command{ + Use: "user-id [handle]", + Short: "Get Twitter user ID for a handle", + Long: `Retrieves the Twitter user ID for a given handle`, + Args: cobra.ExactArgs(1), + RunE: runXUserID, +} + +func runXDeletedTweets(cmd *cobra.Command, args []string) error { + c, err := newClient() + if err != nil { + return err + } + + response, err := c.CheckDeletedTweets(args[0]) + if err != nil { + return err + } + + if err := checkError(response.Error); err != nil { + return err + } + + output, err := formatter.FormatXGeneric(response, IsJSONOutput()) + if err != nil { + return err + } + + printOutput(output) + return nil +} + +func runXDomain(cmd *cobra.Command, args []string) error { + c, err := newClient() + if err != nil { + return err + } + + response, err := c.CheckDomainAge(args[0]) + if err != nil { + return err + } + + if err := checkError(response.Error); err != nil { + return err + } + + output, err := formatter.FormatXGeneric(response, IsJSONOutput()) + if err != nil { + return err + } + + printOutput(output) + return nil +} + +func runXHoldersMap(cmd *cobra.Command, args []string) error { + c, err := newClient() + if err != nil { + return err + } + + response, err := c.GetHoldersMap(args[0]) + if err != nil { + return err + } + + if err := checkError(response.Error); err != nil { + return err + } + + output, err := formatter.FormatXGeneric(response, IsJSONOutput()) + if err != nil { + return err + } + + printOutput(output) + return nil +} + +func runXID(cmd *cobra.Command, args []string) error { + c, err := newClient() + if err != nil { + return err + } + + response, err := c.GetTwitterID(args[0]) + if err != nil { + return err + } + + if err := checkError(response.Error); err != nil { + return err + } + + output, err := formatter.FormatXGeneric(response, IsJSONOutput()) + if err != nil { + return err + } + + printOutput(output) + return nil +} + +func runXImage(cmd *cobra.Command, args []string) error { + c, err := newClient() + if err != nil { + return err + } + + response, err := c.ReverseImageSearch(args[0]) + if err != nil { + return err + } + + if err := checkError(response.Error); err != nil { + return err + } + + output, err := formatter.FormatXGeneric(response, IsJSONOutput()) + if err != nil { + return err + } + + printOutput(output) + return nil +} + +func runXUserID(cmd *cobra.Command, args []string) error { + c, err := newClient() + if err != nil { + return err + } + + response, err := c.GetTwitterUserID(args[0]) + if err != nil { + return err + } + + if err := checkError(response.Error); err != nil { + return err + } + + output, err := formatter.FormatXGeneric(response, IsJSONOutput()) + if err != nil { + return err + } + + printOutput(output) + return nil +} |
