Change .env to config.json

Co-authored-by: loonatiny <fr.tanyan@gmail.com>
This commit is contained in:
Mylloon 2022-06-18 01:01:43 +02:00
parent fd2df7aee9
commit 9fcafc9de4
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
5 changed files with 7 additions and 12 deletions

View file

@ -6,7 +6,7 @@
### En local ### En local
> Cloner le repo. > Cloner le repo.
> Spécifier un fichier `.env` en suivant l'exemple [de l'exemple](example.env). > Renseigner le token du bot dans le fichier [./config/config.json](./config/config.json).
> Installer les dépendences du bot. > Installer les dépendences du bot.
```bash ```bash

3
config/config.json Normal file
View file

@ -0,0 +1,3 @@
{
"token": "OTY1NTk4ODUyNDA3MjMwNDk0.Yl1iAg.TiE_d1FEp8jL_Y_W79Zsb9RTr7Q"
}

View file

@ -1 +0,0 @@
DISCORD_TOKEN=your-token-goes-here

View file

@ -1,16 +1,10 @@
const { Client, Intents } = require('discord.js'); const { Client, Intents } = require('discord.js');
const dotenv = require('dotenv'); const { token } = require('./config/config.json');
// Load .env
dotenv.config();
// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] }); const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
// When the client is ready
client.once('ready', () => { client.once('ready', () => {
console.log('Prêt !'); console.log('Prêt !');
}); });
// Login to Discord with token client.login(token);
client.login(process.env.DISCORD_TOKEN);

View file

@ -13,8 +13,7 @@
"author": "La confrérie du Kassoulait", "author": "La confrérie du Kassoulait",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"dependencies": { "dependencies": {
"discord.js": "^13.6.0", "discord.js": "^13.6.0"
"dotenv": "^16.0.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.13.0" "eslint": "^8.13.0"