Skip to content

Commit

Permalink
fix: specify intents for Discord.Client
Browse files Browse the repository at this point in the history
discordjs/discord.js#4879 requires intents option
  • Loading branch information
sntran committed Feb 16, 2021
1 parent 6f91522 commit b28b775
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require("fs");

const debug = require("debug")("hoarder:discord");
const shellParser = require("shell-parser");
const Discord = require("discord.js");
const { Client, Intents, Collection } = require("discord.js");
const Queue = require("fastq");

require("nvar")();
Expand All @@ -17,8 +17,16 @@ const {
// Regex to check if a message contains command.
const COMMAND_REGEX = new RegExp(`^${ COMMAND_PREFIX }([a-z-]+)${ COMMAND_SUFFIX }\\s+`);

const client = new Discord.Client();
const commands = client.commands = new Discord.Collection();
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.DIRECT_MESSAGES,
Intents.FLAGS.DIRECT_MESSAGE_REACTIONS,
],
});
const commands = client.commands = new Collection();

const commandFiles = fs.readdirSync("./commands").filter(file => file.endsWith(".js"));

Expand Down

0 comments on commit b28b775

Please sign in to comment.