Handbook
Glossary
parse-discord-op ( json -- )
Vocabulary
discord
Inputs
json
an
object
Outputs
None
Definition
USING:
accessors
assocs
calendar
combinators
kernel
namespaces
sequences
words
;
IN:
discord
:
parse-discord-op
( json -- )
[
clone
now
"timestamp"
pick
set-at
discord-bot
get
[
messages>>
push
]
[
[
"d"
of
]
dip
last-message<<
]
2bi
]
keep
[
]
[
"s"
of
discord-bot
get
sequence-number<<
]
[
"op"
of
]
tri
{
{
0
[
[
"d"
of
]
[
"t"
of
[
"discord"
lookup-word
]
transmute
]
bi
[
dispatch-message
]
[
discord-bot
get
config>>
user-callback>>
[
( json message-type -- )
call-effect
]
[
2drop
]
if*
]
2bi
]
}
{
6
[
handle-discord-RESUME
]
}
{
7
[
handle-discord-RECONNECT
]
}
{
10
[
handle-discord-HELLO
]
}
{
11
[
handle-discord-HEARTBEAT_ACK
]
}
[
"unknown opcode:"
gwrite
g.
g...
gflush
]
}
case
;