diff --git a/.github/discord.js b/.github/discord.js index 332c651..c9cfaed 100644 --- a/.github/discord.js +++ b/.github/discord.js @@ -1,17 +1,11 @@ const bot_token = process.env['BOT_TOKEN'] +const tag = process.env['TAG'] +const body = process.env['BODY'] +const channel = process.env['CHANNEL'] const { request } = require('https') -let tag = undefined, body = undefined, channel = undefined; - -process.argv.forEach((arg) => { - const [ key, value ] = arg.split('=') - if(key === 'tag') tag = value - if(key === 'body') body = value - if(key === 'channel') channel = value -}) - if(!tag || !body || !channel) { - console.log(`Some args are missing`) + console.log(`TAG || BODY || Channel missing`) process.exit(1) } else if(!bot_token) { @@ -35,8 +29,6 @@ else if(!bot_token) { embeds : [embed] } - console.log(payload) - const x = await https_getter(`https://discord.com/api/v9/channels/${channel}/messages`, { headers : { "Authorization" : `Bot ${bot_token}`, diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9e049b8..b1e5acf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,6 +67,9 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Publish on discord - run: node .github/discord.js channel="888999793458835466" body="${{ github.event.release.body }}" tag="${{ github.event.release.tag_name }}" + run: node .github/discord.js env: - BOT_TOKEN: ${{ secrets.BOT_TOKEN }} \ No newline at end of file + BOT_TOKEN: ${{ secrets.BOT_TOKEN }} + CHANNEL: 888999793458835466 + BODY: ${{ github.event.release.body }} + TAG: ${{ github.event.release.tag_name }} \ No newline at end of file