✨ Save events
All checks were successful
Retrieve Events Datas / Retrieve-Events-Datas (push) Successful in 24s
All checks were successful
Retrieve Events Datas / Retrieve-Events-Datas (push) Successful in 24s
This commit is contained in:
commit
bec5e0c422
21
.gitea/workflows/retrieve-datas.yaml
Normal file
21
.gitea/workflows/retrieve-datas.yaml
Normal 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@v3
|
||||
with:
|
||||
name: events
|
||||
path: ./events.json
|
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
.idea/
|
||||
.vscode/
|
||||
.fleet/
|
||||
*.iml
|
||||
|
||||
node_modules/
|
||||
.env
|
||||
events.json
|
28
package-lock.json
generated
Normal file
28
package-lock.json
generated
Normal 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
15
package.json
Normal 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
17
retrieve-datas.js
Normal 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));
|
||||
})()
|
Loading…
Reference in New Issue
Block a user