integration mobygames buddy in chat

This commit is contained in:
Wouter Groeneveld 2021-04-01 16:24:46 +02:00
parent d3d50847ff
commit 21669b0b56
2 changed files with 7 additions and 5 deletions

View File

@ -15,7 +15,7 @@ const { toot } = require('./toot');
const message = await chat(buddyConfig) const message = await chat(buddyConfig)
console.log(`buddy ${buddyConfig.name} has this to say: ${JSON.stringify(message)}`) 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... ') console.log('Done! for now... ')

View File

@ -4,9 +4,9 @@ const instance = 'https://chat.brainbaking.com'
const clientName = "plerobuddies" const clientName = "plerobuddies"
// Fill these in after register() ed. calls // Fill these in after register() ed. calls
const clientId = "" let clientId = ""
const clientSecret = "" let clientSecret = ""
const approvalCode = "" let approvalCode = ""
async function register() { async function register() {
@ -16,6 +16,7 @@ async function register() {
scopes: "read write" scopes: "read write"
} }
) )
clientId = raw.data['client_id']
console.log(raw.data) 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`) 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() { (async function() {
try { try {
await fetchToken() await register()
//await fetchToken()
} catch(err) { } catch(err) {
console.log(err.message) console.log(err.message)
console.log(err.response?.data) console.log(err.response?.data)