]> gitweb.factorcode.org Git - factor.git/commitdiff
discord: add intent slot to discord-bot-config
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 3 Apr 2024 04:20:40 +0000 (23:20 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 3 Apr 2024 13:36:41 +0000 (08:36 -0500)
make gateway-identify-json work even without a discord-bot connected
for testing

extra/discord/discord.factor

index aedccba572a20aaaabd39d20acbc8e3ee2bb2de9..4b132f06670758ed621f84f2744c55b633aaaf27 100644 (file)
@@ -17,7 +17,8 @@ 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 intents
     user-callback obey-names
     metadata
     discord-bot mailbox connect-thread ;
@@ -138,7 +139,11 @@ TUPLE: discord-bot
 : get-discord-bot-gateway ( -- json ) "/gateway/bot" discord-get ;
 
 : gateway-identify-json ( -- json )
-    \ discord-bot get config>> token>> [[ {
+    \ discord-bot get
+    [ config>> ] ?call
+    [ [ token>> ] ?call "0" or  ]
+    [ [ intents>> ] ?call 3276541 or ] bi
+    [[ {
         "op": 2,
         "d": {
             "token": "%s",
@@ -148,7 +153,7 @@ TUPLE: discord-bot
                 "device": "discord.factor"
             },
             "large_threshold": 250,
-            "intents": 3276541
+            "intents": %d
         }
     }]] sprintf json> >json ;