Save events
Some checks failed
Retrieve Events Datas / Retrieve-Events-Datas (push) Failing after 28s

This commit is contained in:
Melaine Gérard 2024-10-04 12:54:51 +02:00
commit 3ff221d8c5
5 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,21 @@
name: Retrieve Events Datas
run-name: Retrieve Events Datas
on: [push]
jobs:
Retrieve-Events-Datas:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: "20.x"
- run: npm ci
- run: npm run retrieve-datas
- name: Upload artifact
uses: https://gitea.com/actions/upload-artifact@v4
with:
name: events
path: ./events.json

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
.idea/
.vscode/
.fleet/
*.iml
node_modules/
.env
events.json

28
package-lock.json generated Normal file
View File

@ -0,0 +1,28 @@
{
"name": "camelianimes-datas",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "camelianimes-datas",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"dotenv": "^16.4.5"
}
},
"node_modules/dotenv": {
"version": "16.4.5",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
}
}
}

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "camelianimes-datas",
"version": "1.0.0",
"main": "retrieve-datas.js",
"scripts": {
"retrieve-datas": "node retrieve-datas.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"dotenv": "^16.4.5"
}
}

17
retrieve-datas.js Normal file
View File

@ -0,0 +1,17 @@
const {config} = require('dotenv');
const {writeFileSync} = require("node:fs");
config();
(async () => {
let datas = await fetch("https://discord.com/api/v10/guilds/" + process.env.DISCORD_GUILD_ID + "/scheduled-events?with_user_count=true", {
method: "GET",
headers: {
"Authorization": "Bot " + process.env.DISCORD_BOT_TOKEN,
}
})
.then(response => response.json())
.then(data => data);
writeFileSync("events.json", JSON.stringify(datas, null, 4));
})()