refactor(chat): remove gateway event wrapper
This commit is contained in:
parent
5f7b024e27
commit
7b8a3d0fd6
2 changed files with 3 additions and 8 deletions
|
|
@ -250,8 +250,8 @@ func (m *Model) Update(msg tview.Msg) tview.Cmd {
|
|||
switch msg := msg.(type) {
|
||||
case tview.InitMsg:
|
||||
return tview.Batch(m.openState(), m.listen())
|
||||
case gatewayEventMsg:
|
||||
switch eventMsg := msg.Event.(type) {
|
||||
case gateway.Event:
|
||||
switch eventMsg := msg.(type) {
|
||||
case *ws.RawEvent:
|
||||
m.onRaw(eventMsg)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import (
|
|||
|
||||
"github.com/ayn2op/tview"
|
||||
"github.com/diamondburned/arikawa/v3/discord"
|
||||
"github.com/diamondburned/arikawa/v3/gateway"
|
||||
)
|
||||
|
||||
func (m *Model) openState() tview.Cmd {
|
||||
|
|
@ -31,13 +30,9 @@ func (m *Model) closeState() tview.Cmd {
|
|||
}
|
||||
}
|
||||
|
||||
type gatewayEventMsg struct {
|
||||
gateway.Event
|
||||
}
|
||||
|
||||
func (m *Model) listen() tview.Cmd {
|
||||
return func() tview.Msg {
|
||||
return gatewayEventMsg{Event: <-m.events}
|
||||
return <-m.events
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue