Remove config.json
Remove config.json (not secure) and replace with .env.
Update deploy-commands.js:
- const { token, clientId } = require('./config.json');
+ const { token, clientId } = process.env;
Update index.js:
- const { token, clientId } = require('./config.json');
+ const token = process.env.TOKEN;
This commit is contained in:
6
index.js
6
index.js
@@ -1,13 +1,15 @@
|
||||
require('dotenv').config();
|
||||
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { Client, Collection, GatewayIntentBits } = require('discord.js');
|
||||
const { token } = require('./config.json');
|
||||
const token = process.env.TOKEN;
|
||||
|
||||
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
||||
|
||||
const db = require ('./functions/database/db.js');
|
||||
const autoUnban = require('./functions/moderation/autoUnban.js');
|
||||
autoUnban(client, db); // db = instance mysql2/promise
|
||||
autoUnban(client, db);
|
||||
|
||||
client.commands = new Collection();
|
||||
const foldersPath = path.join(__dirname, 'commands');
|
||||
|
||||
Reference in New Issue
Block a user