Skip to content

Commit

Permalink
Merge pull request #5 from ComposableFi/fix-url
Browse files Browse the repository at this point in the history
fix url for gov proposal button
  • Loading branch information
rjonczy authored Apr 25, 2024
2 parents fece5e9 + c9b0726 commit 1eb3ec5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"github.com/ashwanthkumar/slack-go-webhook"
)

const proposalPrefixUrl = "https://explorer.stavr.tech/Composable-Testnet/gov/"
const proposalPrefixTestnetUrl = "https://explorer.stavr.tech/Composable-Testnet/gov/"
const proposalPrefixMainnetUrl = "https://explorer.stavr.tech/Composable-Mainnet/gov/"

func postToSlack(chainId string, proposal Proposal, slackWebookUrl string) error {

Expand All @@ -18,7 +19,12 @@ func postToSlack(chainId string, proposal Proposal, slackWebookUrl string) error
attachment.AddField(slack.Field{Title: "VotingStartTime", Value: proposal.VotingStartTime})
attachment.AddField(slack.Field{Title: "VotingEndTime", Value: proposal.VotingEndTime})

attachment.AddAction(slack.Action{Type: "button", Text: "Open", Url: proposalPrefixUrl + proposal.ID, Style: "primary"})
switch chainId {
case "centauri-1":
attachment.AddAction(slack.Action{Type: "button", Text: "Open", Url: proposalPrefixMainnetUrl + proposal.ID, Style: "primary"})
case "banksy-testnet-5":
attachment.AddAction(slack.Action{Type: "button", Text: "Open", Url: proposalPrefixTestnetUrl + proposal.ID, Style: "primary"})
}

payload := slack.Payload{
Text: "Found new governance proposal",
Expand Down

0 comments on commit 1eb3ec5

Please sign in to comment.