-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7cfa3a0
commit 404c92c
Showing
6 changed files
with
251 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package telegram | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
|
||
tele "gopkg.in/telebot.v3" | ||
) | ||
|
||
func (reporter *Reporter) HandleParams(c tele.Context) error { | ||
reporter.Logger.Info(). | ||
Str("sender", c.Sender().Username). | ||
Str("text", c.Text()). | ||
Msg("Got params query") | ||
|
||
params, err := reporter.DataManager.GetParams() | ||
if err != nil { | ||
return reporter.BotReply(c, fmt.Sprintf("Error getting chain params: %s", err)) | ||
} | ||
|
||
template, err := reporter.GetTemplate("params") | ||
if err != nil { | ||
reporter.Logger.Error(). | ||
Err(err). | ||
Msg("Error rendering params template") | ||
return reporter.BotReply(c, "Error rendering params template") | ||
} | ||
|
||
var buffer bytes.Buffer | ||
if err := template.Execute(&buffer, params); err != nil { | ||
reporter.Logger.Error().Err(err).Msg("Error rendering params template") | ||
return err | ||
} | ||
|
||
return reporter.BotReply(c, buffer.String()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{{- range $chainName, $params := . }} | ||
<strong>Params of chain {{ $params.Chain.GetName }}:</strong> | ||
Voting period: {{ FormatDuration $params.VotingPeriod }} | ||
Max deposit period: {{ FormatDuration $params.MaxDepositPeriod }} | ||
Min deposit amount: {{ $params.FormatMinDepositAmount }} | ||
Quorum: {{ $params.FormatQuorum }} | ||
Threshold: {{ $params.FormatThreshold }} | ||
Veto threshold: {{ $params.FormatVetoThreshold }} | ||
{{ end }} |