From 21669b0b56f3e093c1522684aa4c959499a24140 Mon Sep 17 00:00:00 2001 From: wgroeneveld Date: Thu, 1 Apr 2021 16:24:46 +0200 Subject: [PATCH] integration mobygames buddy in chat --- src/chat.js | 2 +- src/registerApp.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/chat.js b/src/chat.js index 0964c27..a576d22 100644 --- a/src/chat.js +++ b/src/chat.js @@ -15,7 +15,7 @@ const { toot } = require('./toot'); const message = await chat(buddyConfig) console.log(`buddy ${buddyConfig.name} has this to say: ${JSON.stringify(message)}`) - //await toot(message, buddyConfig) + await toot(message, buddyConfig) } console.log('Done! for now... ') diff --git a/src/registerApp.js b/src/registerApp.js index 12df5cc..681c8a6 100644 --- a/src/registerApp.js +++ b/src/registerApp.js @@ -4,9 +4,9 @@ const instance = 'https://chat.brainbaking.com' const clientName = "plerobuddies" // Fill these in after register() ed. calls -const clientId = "" -const clientSecret = "" -const approvalCode = "" +let clientId = "" +let clientSecret = "" +let approvalCode = "" async function register() { @@ -16,6 +16,7 @@ async function register() { scopes: "read write" } ) + clientId = raw.data['client_id'] console.log(raw.data) console.log(`${instance}/oauth/authorize?redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=${clientId}&scope=read%20write`) @@ -39,7 +40,8 @@ async function fetchToken() { (async function() { try { - await fetchToken() + await register() + //await fetchToken() } catch(err) { console.log(err.message) console.log(err.response?.data)