some formatting
This commit is contained in:
parent
dcd1d82999
commit
616255e862
1 changed files with 15 additions and 16 deletions
31
src/index.ts
31
src/index.ts
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue