dispatch-message ( json singleton -- )


Vocabulary
discord

Inputs
jsonan object
singletonan object


Outputs
None

Definition

GENERIC: dispatch-message ( json singleton -- )


Methods
















































































































M: MESSAGE_CREATE dispatch-message
drop [
"MESSAGE_CREATE" write bl [
{
[
[ "guild_id" of ] [ "channel_id" of ] bi
guild-channel-name write bl
]
[ "id" of "id:" prepend write bl ]
[
"author" of "username" of ":" append write
bl
]
[ "content" of "`" dup surround print flush ]
} cleave
] [
{
[ [ "guild_id" of ] [ "channel_id" of ] bi ]
[ "id" of ]
[ "author" of "username" of ]
[ "content" of ]
} cleave handle-incoming-message
] bi
] with-global ;



M: MESSAGE_DELETE dispatch-message
drop [
"MESSAGE_DELETE" write bl {
[
[ "guild_id" of ] [ "channel_id" of ] bi
guild-channel-name write bl
]
[ "id" of "id:" prepend print flush ]
} cleave
] with-global ;












M: MESSAGE_UPDATE dispatch-message
drop [
"MESSAGE_UPDATE" write bl {
[
[ "guild_id" of ] [ "channel_id" of ] bi
guild-channel-name write bl
]
[ "id" of "id:" prepend write bl ]
[ "author" of "username" of ":" append write bl ]
[ "content" of "`" dup surround print flush ]
} cleave
] with-global ;





















M: READY dispatch-message
drop [ discord-bot get ] dip {
[ "user" of >>user ]
[ "session_id" of >>session_id ]
[ "application" of >>application ]
[ "resume_gateway_url" of >>resume_gateway_url ]
} cleave drop ;
















































M: TYPING_START dispatch-message
drop [
"TYPING_START:" write bl [
[ "guild_id" of ] [ "channel_id" of ] bi
guild-channel-name write bl
] [
"member" of
[ "nick" of json-null>f ]
[ "user" of "username" of ] bi or
" started typing" append print flush
] bi
] with-global ;