Skip to content

[DISC-120] Update to fix v14 breaking changes #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions commands/admin-standup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed, MessageButton, Permissions } = require("discord.js");
const { EmbedBuilder, ButtonBuilder, Permissions } = require("discord.js");
const paginationEmbed = require("discordjs-button-pagination");

module.exports = {
Expand Down Expand Up @@ -104,7 +104,7 @@ module.exports = {
if (notDone.length == 0) {
standupEmbeded.forEach((el) => {
embedList.push(
new MessageEmbed()
new EmbedBuilder()
.setTitle("Standups (" + role.name + ")")
.setDescription(
el + "\n\n" + "_Everyone has done their standup_\n",
Expand All @@ -114,7 +114,7 @@ module.exports = {
} else {
standupEmbeded.forEach((el) => {
embedList.push(
new MessageEmbed()
new EmbedBuilder()
.setTitle("Standups (" + role.name + ")")
.setDescription(
el +
Expand All @@ -127,7 +127,7 @@ module.exports = {
}

if (thisTeamStandups.length == 0) {
const embed = new MessageEmbed()
const embed = new EmbedBuilder()
.setTitle("Standups (" + role.name + ")")
.setDescription(
"No standups recorded\n\n" +
Expand All @@ -138,11 +138,11 @@ module.exports = {
}

const buttonList = [
new MessageButton()
new ButtonBuilder()
.setCustomId("previousbtn")
.setLabel("Previous")
.setStyle("DANGER"),
new MessageButton().setCustomId("nextbtn").setLabel("Next").setStyle("SUCCESS"),
new ButtonBuilder().setCustomId("nextbtn").setLabel("Next").setStyle("SUCCESS"),
];

paginationEmbed(interaction, embedList, buttonList);
Expand Down
12 changes: 6 additions & 6 deletions commands/anonymouspost.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { SlashCommandBuilder } = require("@discordjs/builders");
const { allowedChannels } = require("../config/anon_channel.json");
const paginationEmbed = require("discordjs-button-pagination");
const fs = require("fs");
const { Util, MessageEmbed, MessageButton, Permissions } = require("discord.js");
const { Util, EmbedBuilder, ButtonBuilder, Permissions } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("anonymouspost")
Expand Down Expand Up @@ -223,7 +223,7 @@ module.exports = {
} else if (interaction.options.getSubcommand() === "whitelist") {
// No allowed roles
if (allowedChannels.length == 0) {
const embed = new MessageEmbed()
const embed = new EmbedBuilder()
.setTitle("Allowed Channels")
.setDescription("No allowed channels");
return await interaction.reply({ embeds: [embed] });
Expand All @@ -239,7 +239,7 @@ module.exports = {
}

if (channels.length == 0) {
const embed = new MessageEmbed()
const embed = new EmbedBuilder()
.setTitle("Allowed Channels")
.setDescription("No allowed channels");
return await interaction.reply({ embeds: [embed] });
Expand All @@ -250,18 +250,18 @@ module.exports = {
const embedList = [];
for (let i = 0; i < channels.length; i += channelsPerPage) {
embedList.push(
new MessageEmbed()
new EmbedBuilder()
.setTitle("Allowed Channels")
.setDescription(channels.slice(i, i + channelsPerPage).join("\n")),
);
}

const buttonList = [
new MessageButton()
new ButtonBuilder()
.setCustomId("previousbtn")
.setLabel("Previous")
.setStyle("DANGER"),
new MessageButton().setCustomId("nextbtn").setLabel("Next").setStyle("SUCCESS"),
new ButtonBuilder().setCustomId("nextbtn").setLabel("Next").setStyle("SUCCESS"),
];

paginationEmbed(interaction, embedList, buttonList);
Expand Down
4 changes: 2 additions & 2 deletions commands/coinFlip.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed } = require("discord.js");
const { EmbedBuilder } = require("discord.js");

module.exports = {
data: new SlashCommandBuilder().setName("coinflip").setDescription("Tosses a coin 💰"),
Expand All @@ -13,7 +13,7 @@ module.exports = {
: 'http://assets.stickpng.com/thumbs/5a521f522f93c7a8d5137fc7.png';
*/
const img = coinNum === 0 ? "attachment://heads.png" : "attachment://tails.png";
const embed = new MessageEmbed().setTitle(`it's ${coin}!`).setImage(img);
const embed = new EmbedBuilder().setTitle(`it's ${coin}!`).setImage(img);
if (coinNum == 0) {
return await interaction.reply({
embeds: [embed],
Expand Down
4 changes: 2 additions & 2 deletions commands/faq.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
const { SlashCommandBuilder, SlashCommandSubcommandBuilder } = require("@discordjs/builders");
const { MessageEmbed } = require("discord.js");
const { EmbedBuilder } = require("discord.js");
const { DiscordScroll } = require("../lib/discordscroll/scroller");

// ////////////////////////////////////////////
Expand Down Expand Up @@ -116,7 +116,7 @@ async function handleFAQGetAll(interaction, faqStorage) {
const answers = [];
let currentPage = 0;
for (const row of rows) {
const newPage = new MessageEmbed({
const newPage = new EmbedBuilder({
title: `FAQS for the tag: ${tag}`,
color: 0xf1c40f,
timestamp: new Date().getTime(),
Expand Down
4 changes: 2 additions & 2 deletions commands/handbook.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const axios = require("axios");
const textVersion = require("textversionjs");
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed } = require("discord.js");
const { EmbedBuilder } = require("discord.js");
const { apiURL, handbookURL } = require("../config/handbook.json");

module.exports = {
Expand Down Expand Up @@ -55,7 +55,7 @@ module.exports = {
terms,
} = data;

const courseInfo = new MessageEmbed()
const courseInfo = new EmbedBuilder()
.setTitle(title)
.setURL(`${handbookURL}/${code}`)
.setColor(0x3a76f8)
Expand Down
14 changes: 7 additions & 7 deletions commands/help.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const help = require("../config/help.json");
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed, MessageActionRow, MessageButton } = require("discord.js");
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require("discord.js");

// Fetches commands from the help data
const commands = help.commands;
Expand All @@ -9,13 +9,13 @@ const commands = help.commands;
const prevId = "helpPrevButtonId";
const nextId = "helpNextButtonId";

const prevButton = new MessageButton({
const prevButton = new ButtonBuilder({
style: "SECONDARY",
label: "Previous",
emoji: "⬅️",
customId: prevId,
});
const nextButton = new MessageButton({
const nextButton = new ButtonBuilder({
style: "SECONDARY",
label: "Next",
emoji: "➡️",
Expand All @@ -27,13 +27,13 @@ const PAGE_SIZE = 10;
/**
* Creates an embed with commands starting from an index.
* @param {number} start The index to start from.
* @returns {MessageEmbed}
* @returns {EmbedBuilder}
*/
const generateEmbed = (start) => {
const current = commands.slice(start, start + PAGE_SIZE);
const pageNum = Math.floor(start / PAGE_SIZE) + 1;

return new MessageEmbed({
return new EmbedBuilder({
title: `Help Command - Page ${pageNum}`,
color: 0x3a76f8,
author: {
Expand Down Expand Up @@ -86,7 +86,7 @@ module.exports = {
await interaction.reply({
embeds: [helpEmbed],
components: [
new MessageActionRow({
new ActionRowBuilder({
components: [
// previous button if it isn't the start
...(currentIndex ? [prevButton] : []),
Expand Down Expand Up @@ -118,7 +118,7 @@ module.exports = {
await i.update({
embeds: [generateEmbed(currentIndex)],
components: [
new MessageActionRow({
new ActionRowBuilder({
components: [
// previous button if it isn't the start
...(currentIndex ? [prevButton] : []),
Expand Down
4 changes: 2 additions & 2 deletions commands/joke.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed } = require("discord.js");
const { EmbedBuilder } = require("discord.js");
const axios = require("axios").default;

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

Expand Down
4 changes: 2 additions & 2 deletions commands/meetingtools.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed } = require("discord.js");
const { EmbedBuilder } = require("discord.js");

// Tools to help manage meetings

Expand Down Expand Up @@ -153,7 +153,7 @@ module.exports = {
});
}

const embed = new MessageEmbed()
const embed = new EmbedBuilder()
.setTitle(command)
.setColor("#0099ff")
.setDescription(ret_val);
Expand Down
4 changes: 2 additions & 2 deletions commands/reactforrole.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { Permissions, MessageEmbed } = require("discord.js");
const { Permissions, EmbedBuilder } = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
Expand Down Expand Up @@ -144,7 +144,7 @@ module.exports = {

// Notify user that they used the command
const botName = sentMessage.author.username;
const notification = new MessageEmbed()
const notification = new EmbedBuilder()
.setColor("#7cd699")
.setTitle("React For Role Command Used!")
.setAuthor(botName, "https://avatars.githubusercontent.com/u/164179?s=200&v=4")
Expand Down
4 changes: 2 additions & 2 deletions commands/schedulepost.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed, Permissions } = require("discord.js");
const { EmbedBuilder, Permissions } = require("discord.js");

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

// Create message preview
const preview = new MessageEmbed()
const preview = new EmbedBuilder()
.setColor("#C492B1")
.setTitle("Message Preview")
.setDescription(
Expand Down
12 changes: 6 additions & 6 deletions commands/vote.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed } = require("discord.js");
const { EmbedBuilder } = require("discord.js");
let { data } = require("../config/votes.json");
const fs = require("fs");

Expand Down Expand Up @@ -44,7 +44,7 @@ module.exports = {
votestring = votestring + ", vote by " + voteauthorname;

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

if (found == undefined) {
const embed = new MessageEmbed().setTitle("0 votes found on this channel");
const embed = new EmbedBuilder().setTitle("0 votes found on this channel");
await interaction.reply({ embeds: [embed], fetchReply: true });
return;
} else {
Expand Down Expand Up @@ -99,7 +99,7 @@ module.exports = {
});
}
});
const embed = new MessageEmbed()
const embed = new EmbedBuilder()
.setTitle(found.string)
.addFields(responses);

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

if (found == undefined) {
const embed = new MessageEmbed().setTitle("0 votes found on this channel");
const embed = new EmbedBuilder().setTitle("0 votes found on this channel");
await interaction.reply({ embeds: [embed], fetchReply: true });
return;
} else {
Expand Down Expand Up @@ -156,7 +156,7 @@ module.exports = {
}
responses.push(temp);
});
const embed = new MessageEmbed()
const embed = new EmbedBuilder()
.setTitle(found.string)
.addFields(responses);

Expand Down
8 changes: 4 additions & 4 deletions commands/xkcd.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed } = require("discord.js");
const { EmbedBuilder } = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
Expand Down Expand Up @@ -34,7 +34,7 @@ module.exports = {
ephemeral: true,
});
} else {
const embed = new MessageEmbed()
const embed = new EmbedBuilder()
.setTitle(response.safe_title)
.setImage(response.img);
return await interaction.reply({ embeds: [embed] });
Expand All @@ -51,7 +51,7 @@ module.exports = {
ephemeral: true,
});
} else {
const embed = new MessageEmbed()
const embed = new EmbedBuilder()
.setTitle(response.safe_title)
.setImage(response.img);
return await interaction.reply({ embeds: [embed] });
Expand All @@ -66,7 +66,7 @@ module.exports = {
ephemeral: true,
});
} else {
const embed = new MessageEmbed()
const embed = new EmbedBuilder()
.setTitle(response.safe_title)
.setImage(response.img);
return await interaction.reply({ embeds: [embed] });
Expand Down
6 changes: 3 additions & 3 deletions events/givereactrole.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { MessageEmbed } = require("discord.js");
const { EmbedBuilder } = require("discord.js");

module.exports = {
name: "messageReactionAdd",
Expand Down Expand Up @@ -43,7 +43,7 @@ module.exports = {
const botName = await reaction.message.author.username;

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

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