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