diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..7e96314 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,55 @@ +{ + "name": "lolswap", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==" + }, + "@types/node": { + "version": "12.0.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.10.tgz", + "integrity": "sha512-LcsGbPomWsad6wmMNv7nBLw7YYYyfdYcz6xryKYQhx89c3XXan+8Q6AJ43G5XDIaklaVkK3mE4fCb0SBvMiPSQ==" + }, + "@types/ws": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.1.tgz", + "integrity": "sha512-EzH8k1gyZ4xih/MaZTXwT2xOkPiIMSrhQ9b8wrlX88L0T02eYsddatQlwVFlEPyEqV0ChpdpNnE51QPH6NVT4Q==", + "requires": { + "@types/events": "*", + "@types/node": "*" + } + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "league-connect": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/league-connect/-/league-connect-1.0.3.tgz", + "integrity": "sha512-eapa2Dmp95qwyjvqSktpt2rboc3q4xmxNVlwnCknpjfSZI8lxkpHvJdUfNa7BmBa0rcY7ZkiQpwY9e82KoWsCw==", + "requires": { + "@types/ws": "^6.0.1", + "node-fetch": "^2.6.0", + "ws": "^7.0.0" + } + }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, + "ws": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.0.1.tgz", + "integrity": "sha512-ILHfMbuqLJvnSgYXLgy4kMntroJpe8hT41dOVWM8bxRuw6TK4mgMp9VJUNsZTEc5Bh+Mbs0DJT4M0N+wBG9l9A==", + "requires": { + "async-limiter": "^1.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..04b69d9 --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "lolswap", + "version": "1.0.0", + "description": "", + "main": "src/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/supergrecko/lolswap.git" + }, + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/supergrecko/lolswap/issues" + }, + "homepage": "https://github.com/supergrecko/lolswap#readme", + "dependencies": { + "league-connect": "^1.0.3" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..8df0893 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,21 @@ +import Connector from 'league-connect'; + +let id: string = process.argv[2]; + +const icon: number = parseFloat(id); + +Connector.connect().then((res) => { + Connector.sendRequest({ + url: 'lol-summoner/v1/current-summoner/icon', + method: 'PUT', + body: { + profileIconId: icon + } + }).then((res) => { + console.log('Summoner Icon has been changed.'); + }).catch(() => { + console.log('Invalid Summoner Icon ID. If this problem persists, restart your League Client and retry.') + }) +}).catch((err) => { + console.error(err); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..728e4a2 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "outDir": "./dist" + } +}