diff --git a/.github/actions/avatar-changer/index.js b/.github/actions/avatar-changer/index.js new file mode 100644 index 0000000..9729b05 --- /dev/null +++ b/.github/actions/avatar-changer/index.js @@ -0,0 +1,32 @@ +const fs = require('fs'); +const hyttpo = require('hyttpo').default; + +const list = fs.readFileSync('./list.txt', 'utf-8').split('\n'); +let now = Number(fs.readFileSync('./now.txt', 'utf-8')); + +(async() => { + if (now === list.length) now = 0; + + const url = list[now + 1]; + + const req = await hyttpo.request({ + method: 'GET', + responseType: 'buffer', + url + }).catch(e => e) + + const base64 = `data:image/png;base64,${req.data.toString('base64')}`; + + const bot = await hyttpo.request({ + url: 'https://discord.com/api/v9/applications/745599648110215260', + method: 'PATCH', + headers: { + 'Authorization': 'Bot' + }, + body: JSON.stringify({ + icon: base64 + }) + }).catch(e => e) + + console.log(bot) +})(); \ No newline at end of file diff --git a/.github/actions/avatar-changer/list.txt b/.github/actions/avatar-changer/list.txt new file mode 100644 index 0000000..7cb167c --- /dev/null +++ b/.github/actions/avatar-changer/list.txt @@ -0,0 +1,6 @@ +https://izboxo.cz/sources/images/Bucket_of_Cod_JE2_BE2.png +https://izboxo.cz/sources/images/Bucket_of_Axolotl_JE1_BE1.png +https://izboxo.cz/sources/images/Bucket_of_Pufferfish_JE2_BE2.png +https://izboxo.cz/sources/images/Bucket_of_Salmon_JE2_BE2.png +https://izboxo.cz/sources/images/Bucket_of_Tadpole_BE1.png +https://izboxo.cz/sources/images/Bucket_of_Tropical_Fish_JE3_BE2.png \ No newline at end of file diff --git a/.github/actions/avatar-changer/now.txt b/.github/actions/avatar-changer/now.txt new file mode 100644 index 0000000..c227083 --- /dev/null +++ b/.github/actions/avatar-changer/now.txt @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/.github/actions/avatar-changer/out.png b/.github/actions/avatar-changer/out.png new file mode 100644 index 0000000..ed81d9c Binary files /dev/null and b/.github/actions/avatar-changer/out.png differ diff --git a/.github/actions/avatar-changer/package-lock.json b/.github/actions/avatar-changer/package-lock.json new file mode 100644 index 0000000..5571dde --- /dev/null +++ b/.github/actions/avatar-changer/package-lock.json @@ -0,0 +1,61 @@ +{ + "name": "avatar-changer", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "avatar-changer", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "hyttpo": "^0.3.2" + } + }, + "node_modules/follow-redirects": { + "version": "1.14.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", + "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/hyttpo": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/hyttpo/-/hyttpo-0.3.2.tgz", + "integrity": "sha512-Y1QJlBXOZtHKhME6AEBdxPrzJrV5xcORZm/+rbHwXGlau2n2OBNAbsiIJ3eiT1ZizJClm+RmwjytDSySOXJcOg==", + "dependencies": { + "follow-redirects": "^1.14.6" + }, + "engines": { + "node": ">=16.x" + } + } + }, + "dependencies": { + "follow-redirects": { + "version": "1.14.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", + "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==" + }, + "hyttpo": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/hyttpo/-/hyttpo-0.3.2.tgz", + "integrity": "sha512-Y1QJlBXOZtHKhME6AEBdxPrzJrV5xcORZm/+rbHwXGlau2n2OBNAbsiIJ3eiT1ZizJClm+RmwjytDSySOXJcOg==", + "requires": { + "follow-redirects": "^1.14.6" + } + } + } +} diff --git a/.github/actions/avatar-changer/package.json b/.github/actions/avatar-changer/package.json new file mode 100644 index 0000000..983519f --- /dev/null +++ b/.github/actions/avatar-changer/package.json @@ -0,0 +1,15 @@ +{ + "name": "avatar-changer", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "hyttpo": "^0.3.2" + } +}