change intents to use GatewayIntentBits

This commit is contained in:
Sophie Marie 2022-12-06 20:42:00 -06:00
parent 44f71c0e2c
commit dab0aa4799
No known key found for this signature in database
GPG Key ID: 0C9FB786E7770775
1 changed files with 11 additions and 4 deletions

View File

@ -1,13 +1,20 @@
#!/usr/bin/env -S node
const fs = require('fs');
const Discord = require('discord.js');
const { Client, Collection, GatewayIntentBits } = require('discord.js');
const config = require('./config.json');
require('dotenv').config();
console.log('Starting!');
const client = new Discord.Client({ intents: config.intents.map(intent => eval(`Discord.Intents.FLAGS.${intent}`)) });
client.commands = new Discord.Collection();
// const client = new Discord.Client({ intents: config.intents.map(intent => eval(`Discord.Intents.FLAGS.${intent}`)) });
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildPresences
]
});
// todo: move back to file
client.commands = new Collection();
fs.readdirSync('./commands')
.filter(file => file.endsWith('.js'))
.forEach(file => {