Importing API?!
RPGFabi opened this issue · 1 comments
Hey,
I'm trying to import the API but getting this error:
"import clashApi from 'clash-of-clans-api';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1063:16)
at Module._compile (internal/modules/cjs/loader.js:1111:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47"
My Code is:
"client.once('ready', () => {
console.log("I'm now Ready to go!")
import clashApi from 'clash-of-clans-api';
let client = clashApi({
token: CoCAPIToken
});
}
})"
const clashApi = require('clash-of-clans-api');
let CoCClient = clashApi({
token: CoCAPIToken
})
works