layout: replace json tags with yaml ones

pull/425/head
Demian 3 years ago
parent 965bc10466
commit 91a85c9b5a

@ -34,11 +34,11 @@ type (
Markup struct {
inline *bool
keyboard *template.Template
ResizeKeyboard *bool `json:"resize_keyboard,omitempty"` // nil == true
ForceReply bool `json:"force_reply,omitempty"`
OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
RemoveKeyboard bool `json:"remove_keyboard,omitempty"`
Selective bool `json:"selective,omitempty"`
ResizeKeyboard *bool `yaml:"resize_keyboard,omitempty"` // nil == true
ForceReply bool `yaml:"force_reply,omitempty"`
OneTimeKeyboard bool `yaml:"one_time_keyboard,omitempty"`
RemoveKeyboard bool `yaml:"remove_keyboard,omitempty"`
Selective bool `yaml:"selective,omitempty"`
}
)

@ -17,12 +17,12 @@ type Settings struct {
Token string
Updates int
LocalesDir string `json:"locales_dir"`
TokenEnv string `json:"token_env"`
ParseMode string `json:"parse_mode"`
LocalesDir string `"locales_dir"`
TokenEnv string `yaml:"token_env"`
ParseMode string `yaml:"parse_mode"`
Webhook *tele.Webhook `json:"webhook"`
LongPoller *tele.LongPoller `json:"long_poller"`
Webhook *tele.Webhook `yaml:"webhook"`
LongPoller *tele.LongPoller `yaml:"long_poller"`
}
func (lt *Layout) UnmarshalYAML(data []byte) error {
@ -80,7 +80,7 @@ func (lt *Layout) UnmarshalYAML(data []byte) error {
var btn struct {
Button `yaml:",inline"`
Data interface{} `json:"data"`
Data interface{} `yaml:"data"`
}
if err := yaml.Unmarshal(data, &btn); err != nil {
return err
@ -161,7 +161,7 @@ func (lt *Layout) UnmarshalYAML(data []byte) error {
var markup struct {
Markup `yaml:",inline"`
Keyboard [][]string `json:"keyboard"`
Keyboard [][]string `yaml:"keyboard"`
}
if err := yaml.Unmarshal(data, &markup); err != nil {
return err

Loading…
Cancel
Save