interact: if messenger is not set, skip starting

This commit is contained in:
c9s 2022-01-16 00:58:36 +08:00
parent b80f481e7d
commit 5f4239d108
2 changed files with 7 additions and 1 deletions

View File

@ -192,6 +192,7 @@ func (it *Interact) builtin() error {
}
func (it *Interact) init() error {
if err := it.builtin(); err != nil {
return err
}
@ -235,6 +236,11 @@ func (it *Interact) registerCommands(commands map[string]*Command) error {
}
func (it *Interact) Start(ctx context.Context) error {
if it.messenger == nil {
log.Warn("messenger is not set, skip initializing")
return nil
}
if err := it.init(); err != nil {
return err
}

View File

@ -25,7 +25,7 @@ func init() {
type Balance struct {
Currency string `json:"currency"`
Available fixedpoint.Value `json:"available"`
Locked fixedpoint.Value `json:"locked"`
Locked fixedpoint.Value `json:"locked,omitempty"`
}
func (b Balance) Total() fixedpoint.Value {