CaptEmulation / clash-of-clans-api

:star::star::star: Clash of Clans :rage1: API NodeJS helper
MIT License
64 stars 25 forks source link

Importing API?! #16

Closed RPGFabi closed 3 years ago

RPGFabi commented 4 years ago

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
});
}

})"

RPGFabi commented 4 years ago

const clashApi = require('clash-of-clans-api'); let CoCClient = clashApi({ token: CoCAPIToken })

works