handle float64/string both
This commit is contained in:
parent
3002812c02
commit
81259792b7
|
@ -3,6 +3,7 @@ package mastodon
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
|
@ -128,7 +129,11 @@ func (c *WSClient) handleWS(ctx context.Context, rawurl string, q chan Event) er
|
|||
q <- &NotificationEvent{Notification: ¬ification}
|
||||
}
|
||||
case "delete":
|
||||
q <- &DeleteEvent{ID: ID(strings.TrimSpace(s.Payload.(string)))}
|
||||
if f, ok := s.Payload.(float64); ok {
|
||||
q <- &DeleteEvent{ID: ID(fmt.Sprint(int64(f)))}
|
||||
} else {
|
||||
q <- &DeleteEvent{ID: ID(strings.TrimSpace(s.Payload.(string)))}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
q <- &ErrorEvent{err}
|
||||
|
|
Loading…
Reference in New Issue
Block a user