Open milklineep opened 5 years ago
Reproduced, thanks for your bug report!
Looks like a bug in keybase/client, list-team-memberships
fails straight after the service's startup. As a workaround either use .initFromRunningService()
, wait a second or two before making the request or implement a retry mechanism:
const Bot = require('../../index.js')
const bot = new Bot()
const username = process.env.KB_USERNAME
const paperkey = process.env.KB_PAPERKEY
function timeout(time) {
return new Promise(resolve => {
setTimeout(() => {
resolve()
}, time)
})
}
bot
.init(username, paperkey, {verbose: false})
.then(async () => {
console.log(`Your bot is initialized. It is logged in as ${bot.myInfo().username}`)
while (true) {
try {
const res = await bot.team.listTeamMemberships({team: process.env.KB_TEAM})
console.log(res)
break
} catch (err) {
console.log(err)
await timeout(500)
}
}
})
.catch(error => {
console.error(error)
bot.deinit()
})
This seems to be working fine with the current master.
I am trying to write a simple keybase bot. My intention was to auto-subscribe people to a rules channel as soon as they join. But I can't get the list of members. Here is my code:
I get the following error when I run it:
I have copy-pasted the code from the example so I don't think the error comes from there. Keybase connects to the internet just fine. I don't know where the error comes from.