Fix panic

This commit is contained in:
Karmanyaah Malhotra 2021-03-07 11:56:48 -05:00
parent 042fb9a951
commit 8dd5993481

View File

@ -134,8 +134,17 @@ func (r *PushSubscription) StartListening(context context.Context) {
channel := msg.Channel()
if strings.HasPrefix(channel, groupChannel) || strings.HasPrefix(channel, dmChannel) {
c := content.(map[string]interface{})["line"]
d, _ := json.Marshal(c)
c, ok := content.(map[string]interface{})
if !ok {
fmt.Println(content, "err")
continue
}
e, ok := c["line"]
if !ok {
fmt.Println(content, "err")
continue
}
d, _ := json.Marshal(e)
r.chatEvent(contentType, d)
continue
}