some formatting

This commit is contained in:
IThundxr 2023-03-28 15:25:03 -04:00
parent dcd1d82999
commit 616255e862
No known key found for this signature in database
GPG key ID: 1A6215040459750E

View file

@ -99,26 +99,25 @@ client.once('ready', async () => {
client.on('interactionCreate', async (interaction) => {
if (interaction.isButton() && interaction.customId === 'delete-message') {
try {
const messageRef = interaction.message.reference?.messageId;
if (messageRef) {
const msg = await interaction.message.channel.messages.fetch(messageRef);
try {
const messageRef = interaction.message.reference?.messageId;
if (messageRef) {
const msg = await interaction.message.channel.messages.fetch(messageRef);
if (interaction?.user === msg.author) {
await interaction.message.delete();
} else {
await interaction.reply({
content: 'You can only delete your own messages!',
ephemeral: true,
});
if (interaction?.user === msg.author) {
await interaction.message.delete();
} else {
await interaction.reply({
content: 'You can only delete your own messages!',
ephemeral: true,
});
}
}
} catch (e) {
console.error(e);
interaction.reply({ content: 'Something went wrong!', ephemeral: true });
}
}
catch (e) {
console.error(e);
interaction.reply({ content: 'Something went wrong!', ephemeral: true})
}
}
if (interaction.isChatInputCommand()) {
const { commandName } = interaction;