]> gitweb.factorcode.org Git - factor.git/commitdiff
discord: on reconnect we create a new <discord-bot> so set user-callback on config...
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 15 Apr 2023 13:50:47 +0000 (08:50 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 15 Apr 2023 13:50:47 +0000 (08:50 -0500)
extra/discord/discord.factor

index 2f02de3b5aeae2a62929163346beccbb0ef8ef1c..9d401bf1f816fb058c16e5d7489e880b8c39166e 100644 (file)
@@ -16,14 +16,15 @@ TUPLE: discord-webhook url id token ;
 
 TUPLE: discord-bot-config
     client-id client-secret
-    token application-id guild-id channel-id permissions ;
+    token application-id guild-id channel-id permissions
+    user-callback ;
 
 TUPLE: discord-bot
     config in out bot-thread heartbeat-thread
     send-heartbeat? reconnect?
     messages sequence-number
     application user session_id resume_gateway_url
-    guilds channels user-callback ;
+    guilds channels ;
 
 : <discord-bot> ( in out config -- discord-bot )
     discord-bot new
@@ -409,7 +410,7 @@ ENUM: discord-opcode
         { 0 [
             [ handle-discord-DISPATCH ]
             [
-                [ discord-bot get ] dip over user-callback>>
+                [ discord-bot get ] dip over config>> user-callback>>
                 [ [ dup "t" of ] dip call( discord-bot json message-type -- ) ] [ 2drop ] if*
             ] bi
         ] }