Skip to content

Commit

Permalink
fix: check if degen account have allowance
Browse files Browse the repository at this point in the history
  • Loading branch information
xfwil committed Feb 16, 2024
1 parent bd1e2c0 commit 6ce69d9
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,14 @@ func autoTimeline() {
return
}

remainingAllowance, _ := strconv.Atoi(myAllowance[0].RemainingAllowance)
remainingAllowance := 0

if len(myAllowance) == 0 {
fmt.Printf("[DEGEN] [ALLOWANCE] No Allowance\n")
}

convertAllowance, _ := strconv.Atoi(myAllowance[0].RemainingAllowance)
remainingAllowance = convertAllowance

fmt.Printf("| Allowance : %s | Remaining Allowance : %s\n", myAllowance[0].TipAllowance, myAllowance[0].RemainingAllowance)

Expand Down Expand Up @@ -289,13 +296,19 @@ func autoTimeline() {
commentText = fmt.Sprintf("%d $DEGEN", randomThreeDigit)
}

if commentText != "" {
if commentText != "" && remainingAllowance > 0 {
_, err := warpcast.Comment(myConfig.Accounts[inputSelectAccount], item.Cast.Hash, commentText)
if err != nil {
fmt.Printf(" ERROR : %s", err)
} else {
fmt.Printf(" SUCCESS [%s]", commentText)
}
} else {
if remainingAllowance == 0 {
fmt.Printf(" SKIP NO ALLOWANCE")
} else {
fmt.Printf(" SKIPPED")
}
}

fmt.Printf(" ")
Expand Down

0 comments on commit 6ce69d9

Please sign in to comment.