noahcoolboy / funcaptcha

A library used to interact with funcaptchas.
Other
186 stars 43 forks source link

Error Bug #86

Closed CidAintBad closed 11 months ago

CidAintBad commented 11 months ago

I got this message

      if (!this.token.startsWith("token="))
                      ^
TypeError:Cannot read properties of undefined (reading 'startsWith')
          at new Session (/home/runner/RoughSandyDos/node_modules/funcaptcha/lib/session.js:19:25)
          at /home/runner/RoughSandyDos/index.js:20:19
          at process.processTicksAndRejections (node:internal/process/task_queues:95:5 

Here's the code I used


const fun = require("funcaptcha")
const readline = require("readline")
let rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})

function ask(question) {
    return new Promise((resolve, reject) => {
        rl.question(question, (answer) => {
            resolve(answer)
        })
    })
}

fun.getToken({
    pkey: "69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC",
}).then(async token => { 
    let session = new fun.Session(token)
    let challenge = await session.getChallenge()
    console.log(challenge.data.game_data.game_variant)
    console.log(challenge.data.game_data.customGUI.api_breaker)

    for(let x = 0; x < challenge.data.game_data.waves; x++) {
        fs.writeFileSync(`${x}.gif`, await challenge.getImage())
        console.log(await challenge.answer(parseInt(await ask("Answer: "))))
    }
    console.log("Done!")
})
noahcoolboy commented 11 months ago

Hi The public key for the example code is no longer valid This causes an ACCESS DENIED issue. Please try switching it out with a new, and valid, public key. This will be fixed in the near future.