Skip to content

Commit

Permalink
Merge pull request #27 from AlecM33/update-discord-js
Browse files Browse the repository at this point in the history
update discord.js
  • Loading branch information
AlecM33 authored Mar 11, 2024
2 parents 8b1e54f + 2a4b6f6 commit 75afd17
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Intents } = require('discord.js');
const { Client, Collection, GatewayIntentBits } = require('discord.js');
const responseMessages = require('./modules/response-messages.js');

const BOT = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages
]
});

BOT.commands = new Collection();
Expand All @@ -18,7 +21,6 @@ for (const file of commandFiles) {
}

BOT.once('ready', () => {
BOT.user.setActivity('profound quotes', { type: 'LISTENING' });
console.log('Ready!');
});

Expand Down
10 changes: 5 additions & 5 deletions modules/interaction-handlers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const responseMessages = require('./response-messages.js');
const queries = require('../database/queries.js');
const { MessageAttachment } = require('discord.js');
const { AttachmentBuilder } = require('discord.js');
const wordcloudConstructor = require('../modules/wordcloud-constructor.js');
const { JSDOM } = require('jsdom');
const canvas = require('canvas');
Expand Down Expand Up @@ -64,13 +64,13 @@ module.exports = {
}
const buffer = Buffer.from(content);
await interaction.followUp({
files: [new MessageAttachment(buffer, 'quotes.txt')],
files: [new AttachmentBuilder(buffer, { name: 'quotes.txt' })],
content: 'Here you go: all the quotes saved from this server!',
ephemeral: true
});
} catch (e) {
console.error(e);
await interaction.followUp({ content: responseMessages.GENERIC_ERROR, ephemeral: true });
await interaction.followUp({ content: responseMessages.GENERIC_INTERACTION_ERROR, ephemeral: true });
}
},

Expand Down Expand Up @@ -225,7 +225,7 @@ module.exports = {
const myContext = myCanvas.getContext('2d');
myContext.drawImage(img, 0, 0);
await interaction.followUp({
files: [new MessageAttachment(myCanvas.toBuffer('image/png'), 'wordcloud.png')],
files: [new AttachmentBuilder(myCanvas.toBuffer('image/png'), { name: 'wordcloud.png' })],
content: author && author.length > 0
? 'Here\'s a wordcloud for quotes said by "' + author + '"!'
: 'Here\'s a wordcloud I generated from this server\'s quotes!'
Expand Down Expand Up @@ -269,7 +269,7 @@ module.exports = {
}, '');
const buffer = Buffer.from(reply);
await interaction.followUp({
files: [new MessageAttachment(buffer, 'authors.txt')],
files: [new AttachmentBuilder(buffer, { name: 'authors.txt' })],
content: 'Here are all the different authors. There are a lot of them, so I put them in the attached text file.'
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"d3": "^7.8.3",
"d3-cloud": "^1.2.5",
"discord-api-types": "^0.36.2",
"discord.js": "^13.14.0",
"discord.js": "^14.14.1",
"jsdom": "^21.1.1",
"pg": "^8.5.1",
"randomcolor": "^0.6.2"
Expand Down

0 comments on commit 75afd17

Please sign in to comment.