Haha-Yes/commands/utility/feedback.js

33 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2022-06-17 12:50:07 +02:00
import { SlashCommandBuilder } from '@discordjs/builders';
import { MessageEmbed } from 'discord.js';
const { feedbackChannelId } = process.env;
export default {
data: new SlashCommandBuilder()
.setName('feedback')
.setDescription('Send a feedback to the developer.')
.addStringOption(option =>
option.setName('feedback')
.setDescription('The message you want to send me.')
.setRequired(true)),
async execute(interaction) {
const Embed = new MessageEmbed()
2022-06-20 07:59:23 +02:00
.setAuthor({ name: `${interaction.user.tag} (${interaction.user.id})`, iconURL: interaction.user.avatarURL() })
2022-06-17 12:50:07 +02:00
.setTimestamp();
if (interaction.guild) Embed.addField('Guild', `${interaction.guild.name} (${interaction.guild.id})`, true);
Embed.addField('Feedback', interaction.options.getString('feedback'));
// Don't let new account use this command to prevent spam
const date = new Date();
if (interaction.user.createdAt > date.setDate(date.getDate() - 7)) {
2022-07-01 21:24:39 +02:00
return interaction.reply({ content: '❌ Your account is too new to be able to use this command!', ephemeral: true });
2022-06-17 12:50:07 +02:00
}
const channel = interaction.client.channels.resolve(feedbackChannelId);
channel.send({ embeds: [Embed] });
await interaction.reply({ content: 'Your feedback has been sent! Don\'t forget to have dm open if you want to get an answer from the dev!', ephemeral: true });
},
};