Fixed Deprecation of Ephemeral
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Random By Year?
|
||||
Counter (Leaderboard)
|
||||
*/
|
||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder } = require('discord.js')
|
||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, UserSelectMenuBuilder, MessageFlags } = require('discord.js')
|
||||
const { mClient } = require('../..')
|
||||
require('dotenv').config()
|
||||
function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
|
||||
@@ -15,7 +15,7 @@ async function quotesAdd(interaction) {
|
||||
if (!messageLink.match(regex)) {
|
||||
return await interaction.editReply({
|
||||
content: `Invalid URL`,
|
||||
ephemeral: true
|
||||
flags: MessageFlags.Ephemeral
|
||||
})
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ async function quotesAdd(interaction) {
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('items_quotes')
|
||||
const found = await quotesColl.findOne({ messageID: messageID })
|
||||
if (found) { return await interaction.editReply({ content: 'Quote Already in Database', ephemeral: true }) }
|
||||
if (found) { return await interaction.editReply({ content: 'Quote Already in Database', flags: MessageFlags.Ephemeral }) }
|
||||
await quotesColl.findOneAndUpdate({ messageID: messageID }, {
|
||||
$set: {
|
||||
messageID: messageID,
|
||||
@@ -89,18 +89,18 @@ async function quotesRemove(interaction) {
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('items_quotes')
|
||||
const found = await quotesColl.findOne({ messageID: id })
|
||||
if (!found) { return await interaction.reply({ content: 'ID not found!', ephemeral: true }) }
|
||||
if (!found) { return await interaction.reply({ content: 'ID not found!', flags: MessageFlags.Ephemeral }) }
|
||||
|
||||
await quotesColl.deleteOne({ messageID: id })
|
||||
|
||||
return interaction.reply({ content: 'Quote successfully removed!', ephemeral: true })
|
||||
return interaction.reply({ content: 'Quote successfully removed!', flags: MessageFlags.Ephemeral })
|
||||
}
|
||||
async function quotesSearch(interaction) {
|
||||
const id = interaction.options.getString("id")
|
||||
const db = mClient.db(process.env.M_DB)
|
||||
const quotesColl = db.collection('items_quotes')
|
||||
const found = await quotesColl.findOne({ messageID: id })
|
||||
if (!found) { return await interaction.reply({ content: 'ID not found!', ephemeral: true }) }
|
||||
if (!found) { return await interaction.reply({ content: 'ID not found!', flags: MessageFlags.Ephemeral }) }
|
||||
|
||||
|
||||
const guild = await interaction.client.guilds.fetch(found.guildID)
|
||||
@@ -176,7 +176,7 @@ async function quotesRandom(interaction) {
|
||||
]).toArray()
|
||||
}
|
||||
const found = rdm[0]
|
||||
if (!found) { return await interaction.reply({ content: 'Database Empty', ephemeral: true }) }
|
||||
if (!found) { return await interaction.reply({ content: 'Database Empty', flags: MessageFlags.Ephemeral }) }
|
||||
const guild = await interaction.client.guilds.fetch(found.guildID)
|
||||
const channel = await guild.channels.fetch(found.channelID)
|
||||
const message = await channel.messages.fetch(found.messageID)
|
||||
@@ -263,7 +263,7 @@ async function quotesList(interaction) {
|
||||
await interaction.reply({
|
||||
embeds: [embed],
|
||||
components: [select, row],
|
||||
ephemeral: true
|
||||
flags: MessageFlags.Ephemeral
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user