diff --git a/report_generator.go b/report_generator.go index d7c40a0..cb7634a 100644 --- a/report_generator.go +++ b/report_generator.go @@ -92,11 +92,12 @@ func (g *ReportGenerator) GenerateReport() Report { Str("wallet", wallet). Msg("Wallet hasn't voted now - sending an alert") entries = append(entries, ReportEntry{ - Chain: chain, - Wallet: wallet, - ProposalID: proposal.ProposalID, - ProposalTitle: proposal.Content.Title, - ProposalDescription: proposal.Content.Description, + Chain: chain, + Wallet: wallet, + ProposalID: proposal.ProposalID, + ProposalTitle: proposal.Content.Title, + ProposalDescription: proposal.Content.Description, + ProposalVoteEndingTime: proposal.VotingEndTime, }) } @@ -119,12 +120,13 @@ func (g *ReportGenerator) GenerateReport() Report { Msg("Wallet hasn't voted before but voted now - closing an alert") entries = append(entries, ReportEntry{ - Chain: chain, - Wallet: wallet, - ProposalID: proposal.ProposalID, - ProposalTitle: proposal.Content.Title, - ProposalDescription: proposal.Content.Description, - Vote: vote.Option, + Chain: chain, + Wallet: wallet, + ProposalID: proposal.ProposalID, + ProposalTitle: proposal.Content.Title, + ProposalDescription: proposal.Content.Description, + ProposalVoteEndingTime: proposal.VotingEndTime, + Vote: vote.Option, }) } } diff --git a/telegram.go b/telegram.go index ed0a030..fc5c1c3 100644 --- a/telegram.go +++ b/telegram.go @@ -74,6 +74,12 @@ func (reporter *TelegramReporter) SerializeReportEntry(e ReportEntry) string { e.ProposalTitle, )) + sb.WriteString(fmt.Sprintf( + "Voting ends at: %s (in %s)\n\n", + e.ProposalVoteEndingTime.Format(time.RFC3339Nano), + time.Until(e.ProposalVoteEndingTime).Round(time.Second), + )) + if e.Chain.KeplrName != "" { sb.WriteString(fmt.Sprintf( "Keplr\n", diff --git a/types.go b/types.go index cfa4a83..7eaf0b7 100644 --- a/types.go +++ b/types.go @@ -6,9 +6,10 @@ import ( // RPC response types. type Proposal struct { - ProposalID string `json:"proposal_id"` - Status string `json:"status"` - Content *ProposalContent `json:"content"` + ProposalID string `json:"proposal_id"` + Status string `json:"status"` + Content *ProposalContent `json:"content"` + VotingEndTime time.Time `json:"voting_end_time"` } type ProposalContent struct { @@ -40,12 +41,13 @@ func (r *Report) Empty() bool { } type ReportEntry struct { - Chain Chain - Wallet string - ProposalID string - ProposalTitle string - ProposalDescription string - Vote string + Chain Chain + Wallet string + ProposalID string + ProposalTitle string + ProposalDescription string + ProposalVoteEndingTime time.Time + Vote string } func (e *ReportEntry) HasVoted() bool {