Skip to content

Commit b2c1a88

Browse files
authored
Update to fix v14 breaking changes (#176)
1 parent 720e1c6 commit b2c1a88

21 files changed

+93
-93
lines changed

commands/admin-standup.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { SlashCommandBuilder } = require("@discordjs/builders");
2-
const { MessageEmbed, MessageButton, Permissions } = require("discord.js");
2+
const { EmbedBuilder, ButtonBuilder, Permissions } = require("discord.js");
33
const paginationEmbed = require("discordjs-button-pagination");
44

55
module.exports = {
@@ -104,7 +104,7 @@ module.exports = {
104104
if (notDone.length == 0) {
105105
standupEmbeded.forEach((el) => {
106106
embedList.push(
107-
new MessageEmbed()
107+
new EmbedBuilder()
108108
.setTitle("Standups (" + role.name + ")")
109109
.setDescription(
110110
el + "\n\n" + "_Everyone has done their standup_\n",
@@ -114,7 +114,7 @@ module.exports = {
114114
} else {
115115
standupEmbeded.forEach((el) => {
116116
embedList.push(
117-
new MessageEmbed()
117+
new EmbedBuilder()
118118
.setTitle("Standups (" + role.name + ")")
119119
.setDescription(
120120
el +
@@ -127,7 +127,7 @@ module.exports = {
127127
}
128128

129129
if (thisTeamStandups.length == 0) {
130-
const embed = new MessageEmbed()
130+
const embed = new EmbedBuilder()
131131
.setTitle("Standups (" + role.name + ")")
132132
.setDescription(
133133
"No standups recorded\n\n" +
@@ -138,11 +138,11 @@ module.exports = {
138138
}
139139

140140
const buttonList = [
141-
new MessageButton()
141+
new ButtonBuilder()
142142
.setCustomId("previousbtn")
143143
.setLabel("Previous")
144144
.setStyle("DANGER"),
145-
new MessageButton().setCustomId("nextbtn").setLabel("Next").setStyle("SUCCESS"),
145+
new ButtonBuilder().setCustomId("nextbtn").setLabel("Next").setStyle("SUCCESS"),
146146
];
147147

148148
paginationEmbed(interaction, embedList, buttonList);

commands/anonymouspost.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { SlashCommandBuilder } = require("@discordjs/builders");
22
const { allowedChannels } = require("../config/anon_channel.json");
33
const paginationEmbed = require("discordjs-button-pagination");
44
const fs = require("fs");
5-
const { Util, MessageEmbed, MessageButton, Permissions } = require("discord.js");
5+
const { Util, EmbedBuilder, ButtonBuilder, Permissions } = require("discord.js");
66
module.exports = {
77
data: new SlashCommandBuilder()
88
.setName("anonymouspost")
@@ -223,7 +223,7 @@ module.exports = {
223223
} else if (interaction.options.getSubcommand() === "whitelist") {
224224
// No allowed roles
225225
if (allowedChannels.length == 0) {
226-
const embed = new MessageEmbed()
226+
const embed = new EmbedBuilder()
227227
.setTitle("Allowed Channels")
228228
.setDescription("No allowed channels");
229229
return await interaction.reply({ embeds: [embed] });
@@ -239,7 +239,7 @@ module.exports = {
239239
}
240240

241241
if (channels.length == 0) {
242-
const embed = new MessageEmbed()
242+
const embed = new EmbedBuilder()
243243
.setTitle("Allowed Channels")
244244
.setDescription("No allowed channels");
245245
return await interaction.reply({ embeds: [embed] });
@@ -250,18 +250,18 @@ module.exports = {
250250
const embedList = [];
251251
for (let i = 0; i < channels.length; i += channelsPerPage) {
252252
embedList.push(
253-
new MessageEmbed()
253+
new EmbedBuilder()
254254
.setTitle("Allowed Channels")
255255
.setDescription(channels.slice(i, i + channelsPerPage).join("\n")),
256256
);
257257
}
258258

259259
const buttonList = [
260-
new MessageButton()
260+
new ButtonBuilder()
261261
.setCustomId("previousbtn")
262262
.setLabel("Previous")
263263
.setStyle("DANGER"),
264-
new MessageButton().setCustomId("nextbtn").setLabel("Next").setStyle("SUCCESS"),
264+
new ButtonBuilder().setCustomId("nextbtn").setLabel("Next").setStyle("SUCCESS"),
265265
];
266266

267267
paginationEmbed(interaction, embedList, buttonList);

commands/coinFlip.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { SlashCommandBuilder } = require("@discordjs/builders");
2-
const { MessageEmbed } = require("discord.js");
2+
const { EmbedBuilder } = require("discord.js");
33

44
module.exports = {
55
data: new SlashCommandBuilder().setName("coinflip").setDescription("Tosses a coin 💰"),
@@ -13,7 +13,7 @@ module.exports = {
1313
: 'http://assets.stickpng.com/thumbs/5a521f522f93c7a8d5137fc7.png';
1414
*/
1515
const img = coinNum === 0 ? "attachment://heads.png" : "attachment://tails.png";
16-
const embed = new MessageEmbed().setTitle(`it's ${coin}!`).setImage(img);
16+
const embed = new EmbedBuilder().setTitle(`it's ${coin}!`).setImage(img);
1717
if (coinNum == 0) {
1818
return await interaction.reply({
1919
embeds: [embed],

commands/faq.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22
const { SlashCommandBuilder, SlashCommandSubcommandBuilder } = require("@discordjs/builders");
3-
const { MessageEmbed } = require("discord.js");
3+
const { EmbedBuilder } = require("discord.js");
44
const { DiscordScroll } = require("../lib/discordscroll/scroller");
55

66
// ////////////////////////////////////////////
@@ -116,7 +116,7 @@ async function handleFAQGetAll(interaction, faqStorage) {
116116
const answers = [];
117117
let currentPage = 0;
118118
for (const row of rows) {
119-
const newPage = new MessageEmbed({
119+
const newPage = new EmbedBuilder({
120120
title: `FAQS for the tag: ${tag}`,
121121
color: 0xf1c40f,
122122
timestamp: new Date().getTime(),

commands/handbook.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const axios = require("axios");
22
const textVersion = require("textversionjs");
33
const { SlashCommandBuilder } = require("@discordjs/builders");
4-
const { MessageEmbed } = require("discord.js");
4+
const { EmbedBuilder } = require("discord.js");
55
const { apiURL, handbookURL } = require("../config/handbook.json");
66

77
module.exports = {
@@ -55,7 +55,7 @@ module.exports = {
5555
terms,
5656
} = data;
5757

58-
const courseInfo = new MessageEmbed()
58+
const courseInfo = new EmbedBuilder()
5959
.setTitle(title)
6060
.setURL(`${handbookURL}/${code}`)
6161
.setColor(0x3a76f8)

commands/help.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const help = require("../config/help.json");
22
const { SlashCommandBuilder } = require("@discordjs/builders");
3-
const { MessageEmbed, MessageActionRow, MessageButton } = require("discord.js");
3+
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require("discord.js");
44

55
// Fetches commands from the help data
66
const commands = help.commands;
@@ -9,13 +9,13 @@ const commands = help.commands;
99
const prevId = "helpPrevButtonId";
1010
const nextId = "helpNextButtonId";
1111

12-
const prevButton = new MessageButton({
12+
const prevButton = new ButtonBuilder({
1313
style: "SECONDARY",
1414
label: "Previous",
1515
emoji: "⬅️",
1616
customId: prevId,
1717
});
18-
const nextButton = new MessageButton({
18+
const nextButton = new ButtonBuilder({
1919
style: "SECONDARY",
2020
label: "Next",
2121
emoji: "➡️",
@@ -27,13 +27,13 @@ const PAGE_SIZE = 10;
2727
/**
2828
* Creates an embed with commands starting from an index.
2929
* @param {number} start The index to start from.
30-
* @returns {MessageEmbed}
30+
* @returns {EmbedBuilder}
3131
*/
3232
const generateEmbed = (start) => {
3333
const current = commands.slice(start, start + PAGE_SIZE);
3434
const pageNum = Math.floor(start / PAGE_SIZE) + 1;
3535

36-
return new MessageEmbed({
36+
return new EmbedBuilder({
3737
title: `Help Command - Page ${pageNum}`,
3838
color: 0x3a76f8,
3939
author: {
@@ -86,7 +86,7 @@ module.exports = {
8686
await interaction.reply({
8787
embeds: [helpEmbed],
8888
components: [
89-
new MessageActionRow({
89+
new ActionRowBuilder({
9090
components: [
9191
// previous button if it isn't the start
9292
...(currentIndex ? [prevButton] : []),
@@ -118,7 +118,7 @@ module.exports = {
118118
await i.update({
119119
embeds: [generateEmbed(currentIndex)],
120120
components: [
121-
new MessageActionRow({
121+
new ActionRowBuilder({
122122
components: [
123123
// previous button if it isn't the start
124124
...(currentIndex ? [prevButton] : []),

commands/joke.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { SlashCommandBuilder } = require("@discordjs/builders");
2-
const { MessageEmbed } = require("discord.js");
2+
const { EmbedBuilder } = require("discord.js");
33
const axios = require("axios").default;
44

55
module.exports = {
@@ -9,7 +9,7 @@ module.exports = {
99
.get("https://official-joke-api.appspot.com/random_joke")
1010
.then((res) => {
1111
// console.log(res.data);
12-
const embed = new MessageEmbed()
12+
const embed = new EmbedBuilder()
1313
.setTitle(res.data.setup)
1414
.setDescription(res.data.punchline);
1515

commands/meetingtools.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { SlashCommandBuilder } = require("@discordjs/builders");
2-
const { MessageEmbed } = require("discord.js");
2+
const { EmbedBuilder } = require("discord.js");
33

44
// Tools to help manage meetings
55

@@ -153,7 +153,7 @@ module.exports = {
153153
});
154154
}
155155

156-
const embed = new MessageEmbed()
156+
const embed = new EmbedBuilder()
157157
.setTitle(command)
158158
.setColor("#0099ff")
159159
.setDescription(ret_val);

commands/reactforrole.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { SlashCommandBuilder } = require("@discordjs/builders");
2-
const { Permissions, MessageEmbed } = require("discord.js");
2+
const { Permissions, EmbedBuilder } = require("discord.js");
33

44
module.exports = {
55
data: new SlashCommandBuilder()
@@ -144,7 +144,7 @@ module.exports = {
144144

145145
// Notify user that they used the command
146146
const botName = sentMessage.author.username;
147-
const notification = new MessageEmbed()
147+
const notification = new EmbedBuilder()
148148
.setColor("#7cd699")
149149
.setTitle("React For Role Command Used!")
150150
.setAuthor(botName, "https://avatars.githubusercontent.com/u/164179?s=200&v=4")

commands/schedulepost.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { SlashCommandBuilder } = require("@discordjs/builders");
2-
const { MessageEmbed, Permissions } = require("discord.js");
2+
const { EmbedBuilder, Permissions } = require("discord.js");
33

44
module.exports = {
55
data: new SlashCommandBuilder()
@@ -164,7 +164,7 @@ async function create_scheduled_post(interaction, msg_id, channel, datetime) {
164164
const send_in = ("in " + dDisplay + hDisplay + mDisplay + sDisplay).replace(/,\s*$/, "");
165165

166166
// Create message preview
167-
const preview = new MessageEmbed()
167+
const preview = new EmbedBuilder()
168168
.setColor("#C492B1")
169169
.setTitle("Message Preview")
170170
.setDescription(

commands/vote.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { SlashCommandBuilder } = require("@discordjs/builders");
2-
const { MessageEmbed } = require("discord.js");
2+
const { EmbedBuilder } = require("discord.js");
33
let { data } = require("../config/votes.json");
44
const fs = require("fs");
55

@@ -44,7 +44,7 @@ module.exports = {
4444
votestring = votestring + ", vote by " + voteauthorname;
4545

4646
// Generating the embed
47-
const embed = new MessageEmbed().setTitle(votestring);
47+
const embed = new EmbedBuilder().setTitle(votestring);
4848
const message = await interaction.reply({
4949
embeds: [embed],
5050
fetchReply: true,
@@ -71,7 +71,7 @@ module.exports = {
7171
const found = data.find((element) => element.channelid == channelid);
7272

7373
if (found == undefined) {
74-
const embed = new MessageEmbed().setTitle("0 votes found on this channel");
74+
const embed = new EmbedBuilder().setTitle("0 votes found on this channel");
7575
await interaction.reply({ embeds: [embed], fetchReply: true });
7676
return;
7777
} else {
@@ -99,7 +99,7 @@ module.exports = {
9999
});
100100
}
101101
});
102-
const embed = new MessageEmbed()
102+
const embed = new EmbedBuilder()
103103
.setTitle(found.string)
104104
.addFields(responses);
105105

@@ -127,7 +127,7 @@ module.exports = {
127127
const found = data.find((element) => element.channelid == channelid);
128128

129129
if (found == undefined) {
130-
const embed = new MessageEmbed().setTitle("0 votes found on this channel");
130+
const embed = new EmbedBuilder().setTitle("0 votes found on this channel");
131131
await interaction.reply({ embeds: [embed], fetchReply: true });
132132
return;
133133
} else {
@@ -156,7 +156,7 @@ module.exports = {
156156
}
157157
responses.push(temp);
158158
});
159-
const embed = new MessageEmbed()
159+
const embed = new EmbedBuilder()
160160
.setTitle(found.string)
161161
.addFields(responses);
162162

commands/xkcd.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { SlashCommandBuilder } = require("@discordjs/builders");
2-
const { MessageEmbed } = require("discord.js");
2+
const { EmbedBuilder } = require("discord.js");
33

44
module.exports = {
55
data: new SlashCommandBuilder()
@@ -34,7 +34,7 @@ module.exports = {
3434
ephemeral: true,
3535
});
3636
} else {
37-
const embed = new MessageEmbed()
37+
const embed = new EmbedBuilder()
3838
.setTitle(response.safe_title)
3939
.setImage(response.img);
4040
return await interaction.reply({ embeds: [embed] });
@@ -51,7 +51,7 @@ module.exports = {
5151
ephemeral: true,
5252
});
5353
} else {
54-
const embed = new MessageEmbed()
54+
const embed = new EmbedBuilder()
5555
.setTitle(response.safe_title)
5656
.setImage(response.img);
5757
return await interaction.reply({ embeds: [embed] });
@@ -66,7 +66,7 @@ module.exports = {
6666
ephemeral: true,
6767
});
6868
} else {
69-
const embed = new MessageEmbed()
69+
const embed = new EmbedBuilder()
7070
.setTitle(response.safe_title)
7171
.setImage(response.img);
7272
return await interaction.reply({ embeds: [embed] });

events/givereactrole.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { MessageEmbed } = require("discord.js");
1+
const { EmbedBuilder } = require("discord.js");
22

33
module.exports = {
44
name: "messageReactionAdd",
@@ -43,7 +43,7 @@ module.exports = {
4343
const botName = await reaction.message.author.username;
4444

4545
// Notify user that role was not assigned
46-
const notification = new MessageEmbed()
46+
const notification = new EmbedBuilder()
4747
.setColor("#7cd699")
4848
.setTitle("Role could not be assigned")
4949
.setAuthor(
@@ -73,7 +73,7 @@ async function giveRole(reaction, user, roleId) {
7373
const botName = await reaction.message.author.username;
7474

7575
// Notify user role was successfully added
76-
const notification = new MessageEmbed()
76+
const notification = new EmbedBuilder()
7777
.setColor("#7cd699")
7878
.setTitle("Roles updated!")
7979
.setAuthor(botName, "https://avatars.githubusercontent.com/u/164179?s=200&v=4")

0 commit comments

Comments
 (0)