mirror of
https://github.com/JustusPlays78/DiscordBot.git
synced 2025-04-28 20:26:20 +00:00
feat: added originfilter
This commit is contained in:
parent
3e7b09c194
commit
15f2e8352c
@ -1,3 +1,4 @@
|
||||
CLIENT_AUTH_TOKEN=YOUR PRIVACY TOKEN
|
||||
GIT_PERSONAL_ACCESS_TOKEN=asdasdasd
|
||||
APIPORT=3000
|
||||
APIPORT=3000
|
||||
REQUEST_ORIGIN=https://intjulscha.de
|
16
main.js
16
main.js
@ -3,14 +3,15 @@ import { Client, GatewayIntentBits } from 'discord.js';
|
||||
import {fetchText, getChanges} from './text.js';
|
||||
import {createChangelogEmbed} from "./embed builder.js";
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
|
||||
|
||||
dotenv.config();
|
||||
const token = process.env.CLIENT_AUTH_TOKEN;
|
||||
//const accesstoken = process.env.GITHUB_ACCESS_TOKEN;
|
||||
const accesstoken = process.env.GITHUB_ACCESS_TOKEN;
|
||||
const allowedOrigin = process.env.REQUEST_ORIGIN;
|
||||
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
@ -19,6 +20,13 @@ const client = new Client({
|
||||
],
|
||||
});
|
||||
|
||||
app.use(express.json());
|
||||
app.use(cors({
|
||||
origin: allowedOrigin,
|
||||
}))
|
||||
|
||||
|
||||
|
||||
client.on('ready', async () => {
|
||||
console.log('Ready!');
|
||||
try {
|
||||
@ -28,13 +36,13 @@ client.on('ready', async () => {
|
||||
}
|
||||
})
|
||||
|
||||
/*app.post('/changelog', async (message) => {
|
||||
app.post('/changelog', async (message) => {
|
||||
let result = await fetchText("https://tee.intjulscha.de/Julscha/changelog/raw/branch/main/changelog_november.md", accesstoken);
|
||||
console.log(result);
|
||||
result = await getChanges(result);
|
||||
const embed = createChangelogEmbed();
|
||||
message.channel.send({ embeds: [embed] });
|
||||
});*/
|
||||
});
|
||||
|
||||
app.post('/add-role', async (req, res) => {
|
||||
const { guildId, userId, roleId } = req.body;
|
||||
|
23
package-lock.json
generated
23
package-lock.json
generated
@ -11,6 +11,7 @@
|
||||
"dependencies": {
|
||||
"@discordjs/rest": "^2.3.0",
|
||||
"axios": "^1.7.7",
|
||||
"cors": "^2.8.5",
|
||||
"discord-api-types": "^0.37.88",
|
||||
"discord.js": "^14.16.3",
|
||||
"dotenv": "^16.4.5",
|
||||
@ -366,6 +367,19 @@
|
||||
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cors": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/data-uri-to-buffer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
|
||||
@ -938,6 +952,15 @@
|
||||
"url": "https://opencollective.com/node-fetch"
|
||||
}
|
||||
},
|
||||
"node_modules/object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.3",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz",
|
||||
|
@ -19,6 +19,7 @@
|
||||
"dependencies": {
|
||||
"@discordjs/rest": "^2.3.0",
|
||||
"axios": "^1.7.7",
|
||||
"cors": "^2.8.5",
|
||||
"discord-api-types": "^0.37.88",
|
||||
"discord.js": "^14.16.3",
|
||||
"dotenv": "^16.4.5",
|
||||
|
Loading…
x
Reference in New Issue
Block a user