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)
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... ')

View File

@ -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)