diff --git a/commands/admin-standup.js b/commands/admin-standup.js index 31540dba..13a6d8c9 100644 --- a/commands/admin-standup.js +++ b/commands/admin-standup.js @@ -1,5 +1,5 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); -const { EmbedBuilder, ButtonBuilder, Permissions } = require("discord.js"); +const { EmbedBuilder, ButtonBuilder, PermissionsBitField } = require("discord.js"); const paginationEmbed = require("discordjs-button-pagination"); module.exports = { @@ -28,7 +28,7 @@ module.exports = { const standupDB = global.standupDBGlobal; const TEAM_DIRECTOR_ROLE_ID = "921348676692107274"; if ( - !interaction.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR) && + !interaction.member.permissions.has(PermissionsBitField.Flags.Administrator) && !interaction.member._roles.includes(TEAM_DIRECTOR_ROLE_ID) ) { return await interaction.reply({ diff --git a/commands/admin.js b/commands/admin.js index bea9f98f..88f28a21 100644 --- a/commands/admin.js +++ b/commands/admin.js @@ -1,5 +1,5 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); -const { Permissions } = require("discord.js"); +const { PermissionsBitField } = require("discord.js"); const COMMAND_KICKUNVERIFIED = "kickunverified"; const COMMAND_DROPUSERTABLE = "dropusertable"; @@ -20,7 +20,7 @@ module.exports = { ), async execute(interaction) { try { - if (!interaction.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { + if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) { return await interaction.reply({ content: "You do not have permission to execute this command.", ephemeral: true, @@ -63,9 +63,11 @@ module.exports = { return await interaction.reply("Removed unverified members."); } else if (interaction.options.getSubcommand() === COMMAND_DROPUSERTABLE) { const userDB = global.userDB; - await userDB.drop_table(); - return await interaction.editReply("Deleted user table."); + await userDB.deleteUsers(); + await userDB.create_table_users(); + + return await interaction.reply("Deleted user table."); } return await interaction.reply("Error: unknown subcommand."); diff --git a/commands/anonymouspost.js b/commands/anonymouspost.js index 7f62838e..4d7268f6 100644 --- a/commands/anonymouspost.js +++ b/commands/anonymouspost.js @@ -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, EmbedBuilder, ButtonBuilder, Permissions } = require("discord.js"); +const { Util, EmbedBuilder, ButtonBuilder, PermissionsBitField } = require("discord.js"); module.exports = { data: new SlashCommandBuilder() .setName("anonymouspost") @@ -125,7 +125,7 @@ module.exports = { } // Admin permission check - if (!interaction.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { + if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) { return await interaction.reply({ content: "You do not have permission to execute this command.", ephemeral: true, diff --git a/commands/course.js b/commands/course.js index 10ca6b79..a3c29d7c 100644 --- a/commands/course.js +++ b/commands/course.js @@ -7,6 +7,7 @@ const COMMAND_LEAVE = "leave"; // map of course aliases to their actual names const course_aliases = { comp6841: "comp6441", + comp6843: "comp6443", comp9044: "comp2041", comp3891: "comp3231", comp9201: "comp3231", diff --git a/commands/faqadmin.js b/commands/faqadmin.js index 41e91463..544d13ce 100644 --- a/commands/faqadmin.js +++ b/commands/faqadmin.js @@ -1,6 +1,6 @@ // @ts-check const { SlashCommandBuilder, SlashCommandSubcommandBuilder } = require("@discordjs/builders"); -const { Permissions } = require("discord.js"); +const { PermissionsBitField } = require("discord.js"); // //////////////////////////////////////////// // //////// SETTING UP THE COMMANDS /////////// @@ -46,7 +46,7 @@ async function handleInteraction(interaction) { const faqStorage = global.faqStorage; // Admin permission check (this may not work uhm) - if (!interaction.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { + if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) { await interaction.reply({ content: "You do not have permission to execute this command.", ephemeral: true, diff --git a/commands/handbook.js b/commands/handbook.js index 78ac9387..9b86cde6 100644 --- a/commands/handbook.js +++ b/commands/handbook.js @@ -59,7 +59,10 @@ module.exports = { .setTitle(title) .setURL(`${handbookURL}/${code}`) .setColor(0x3a76f8) - .setAuthor(`Course Info: ${code} (${UOC} UOC)`, "https://i.imgur.com/EE3Q40V.png") + .setAuthor({ + name: `Course Info: ${code} (${UOC} UOC)`, + iconURL: "https://i.imgur.com/EE3Q40V.png", + }) .addFields( { name: "Overview", @@ -106,7 +109,9 @@ module.exports = { /* }, */ ) .setTimestamp() - .setFooter("Data fetched from Circles' Api"); + .setFooter({ + text: "Data fetched from Circles' Api", + }); await interaction.reply({ embeds: [courseInfo] }); } }, diff --git a/commands/logreport.js b/commands/logreport.js index 92ca73f6..bd0476ef 100644 --- a/commands/logreport.js +++ b/commands/logreport.js @@ -1,5 +1,5 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); -const { Permissions } = require("discord.js"); +const { PermissionsBitField } = require("discord.js"); const path = require("path"); const nodemailer = require("nodemailer"); @@ -44,7 +44,7 @@ module.exports = { async execute(interaction) { try { - if (!interaction.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { + if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) { await interaction.reply({ content: "You do not have permission to execute this command.", ephemeral: true, diff --git a/commands/reactforrole.js b/commands/reactforrole.js index e6f52bb6..e170adfa 100644 --- a/commands/reactforrole.js +++ b/commands/reactforrole.js @@ -1,5 +1,5 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); -const { Permissions, EmbedBuilder } = require("discord.js"); +const { PermissionsBitField, EmbedBuilder } = require("discord.js"); module.exports = { data: new SlashCommandBuilder() @@ -27,7 +27,7 @@ module.exports = { async execute(interaction) { // Only admin users should be able to execute this command - if (!interaction.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { + if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) { return await interaction.reply({ content: "You do not have permission to execute this command.", ephemeral: true, diff --git a/commands/rolesPermOverride.js b/commands/rolesPermOverride.js index f859cff2..0c6c50ed 100644 --- a/commands/rolesPermOverride.js +++ b/commands/rolesPermOverride.js @@ -1,5 +1,5 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); -const { Permissions } = require("discord.js"); +const { PermissionsBitField } = require("discord.js"); const is_valid_course_name = (course) => { const reg_comp_course = /^comp\d{4}$/; @@ -136,7 +136,7 @@ module.exports = { ), async execute(interaction) { try { - if (!interaction.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { + if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) { return await interaction.reply({ content: "You do not have permission to execute this command.", ephemeral: true, diff --git a/commands/schedulepost.js b/commands/schedulepost.js index 9d438542..1adc8824 100644 --- a/commands/schedulepost.js +++ b/commands/schedulepost.js @@ -1,5 +1,5 @@ const { SlashCommandBuilder } = require("@discordjs/builders"); -const { EmbedBuilder, Permissions } = require("discord.js"); +const { EmbedBuilder, PermissionsBitField } = require("discord.js"); module.exports = { data: new SlashCommandBuilder() @@ -67,7 +67,7 @@ module.exports = { async execute(interaction) { // Check if user has admin permission - if (!interaction.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) { + if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) { return await interaction.reply({ content: "You do not have permission to execute this command.", ephemeral: true, diff --git a/events/travelguide_ready.js b/events/travelguide_ready.js index ec28b5ee..0f01fbd8 100644 --- a/events/travelguide_ready.js +++ b/events/travelguide_ready.js @@ -1,6 +1,5 @@ // @ts-check const { DBTravelguide } = require("../lib/database/dbtravelguide"); -/* eslint-disable */ module.exports = { name: "ready", diff --git a/package-lock.json b/package-lock.json index 3a634130..a1e6216b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1081,9 +1081,9 @@ "integrity": "sha512-3AungXC4I8kKsS9PuS4JH2nc+0bVY/mjgrephHTIi8fpEeGsTHBUJeosp0Wc1myYMElmD0B3Oc4XL/HVJ4PV2g==" }, "node_modules/axios": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", - "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", + "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -6121,9 +6121,9 @@ "integrity": "sha512-3AungXC4I8kKsS9PuS4JH2nc+0bVY/mjgrephHTIi8fpEeGsTHBUJeosp0Wc1myYMElmD0B3Oc4XL/HVJ4PV2g==" }, "axios": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", - "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", + "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", "requires": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0",