Some Fixes

This commit is contained in:
killer069 2021-12-24 13:32:59 +05:30
parent a8df6bca4c
commit 6a52ab38cb
2 changed files with 9 additions and 14 deletions

16
.github/discord.js vendored
View File

@ -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}`,

View File

@ -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 }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CHANNEL: 888999793458835466
BODY: ${{ github.event.release.body }}
TAG: ${{ github.event.release.tag_name }}