Added Discord webhook
This commit is contained in:
parent
e8bd529ec9
commit
7e9d5bbafa
|
@ -1,5 +1,6 @@
|
||||||
import ModuleRepos from './modules/index.js';
|
import ModuleRepos from './modules/index.js';
|
||||||
import AutoTag from './autoTag.js';
|
import AutoTag from './autoTag.js';
|
||||||
|
import WebhookSend from './webhook.js';
|
||||||
|
|
||||||
import Parcel from 'parcel-bundler';
|
import Parcel from 'parcel-bundler';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -206,3 +207,5 @@ for (const parentRepo of ModuleRepos) {
|
||||||
writeFileSync(`${distDir}/modules.json`, JSON.stringify(oldTotalModulesJson));
|
writeFileSync(`${distDir}/modules.json`, JSON.stringify(oldTotalModulesJson));
|
||||||
|
|
||||||
copyFileSync(`${__dirname.replace('/src', '')}/_headers`, `${distDir}/_headers`);
|
copyFileSync(`${__dirname.replace('/src', '')}/_headers`, `${distDir}/_headers`);
|
||||||
|
|
||||||
|
WebhookSend();
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
import * as https from 'https';
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
const data = JSON.stringify({
|
||||||
|
username: 'NovaStore',
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
title: 'Module Store Updated',
|
||||||
|
url: 'https://goose.lexisother.tk/nova.json',
|
||||||
|
timestamp: new Date(),
|
||||||
|
author: {
|
||||||
|
name: 'Nova Module Store',
|
||||||
|
icon_url: 'https://goosemod.com/img/logo.jpg',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
hostname: 'discord.com',
|
||||||
|
path: `/api/webhooks/816327784121106452/${process.env.HOOKTOKEN}`,
|
||||||
|
port: 443,
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Content-Length': data.length,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
|
console.log(`Status code: ${res.statusCode}`);
|
||||||
|
|
||||||
|
res.on('data', (d) => {
|
||||||
|
process.stdout.write(d);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on('error', (err) => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.write(data);
|
||||||
|
req.end();
|
||||||
|
};
|
Loading…
Reference in New Issue