Fixed guild apply
This commit is contained in:
@@ -16,9 +16,7 @@ module.exports = {
|
|||||||
|
|
||||||
if (interaction.customId === 'guildapply') {
|
if (interaction.customId === 'guildapply') {
|
||||||
|
|
||||||
// check if there is a file in the applications folder with the user's id as the name
|
|
||||||
const applicationFile = path.join(__dirname, '../../applications/' + user.id);
|
const applicationFile = path.join(__dirname, '../../applications/' + user.id);
|
||||||
|
|
||||||
if (fs.existsSync(applicationFile)) {
|
if (fs.existsSync(applicationFile)) {
|
||||||
await interaction.reply({ content: "You already have an application in progress.", ephemeral: true });
|
await interaction.reply({ content: "You already have an application in progress.", ephemeral: true });
|
||||||
return
|
return
|
||||||
@@ -27,25 +25,26 @@ module.exports = {
|
|||||||
const tooLong = new EmbedBuilder()
|
const tooLong = new EmbedBuilder()
|
||||||
.setDescription("You took too long to respond.")
|
.setDescription("You took too long to respond.")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
|
|
||||||
const cancelled = new EmbedBuilder()
|
const cancelled = new EmbedBuilder()
|
||||||
.setDescription("You have cancelled your application.")
|
.setDescription("You have cancelled your application.")
|
||||||
.setColor(embedColor)
|
.setColor(embedColor)
|
||||||
|
|
||||||
await interaction.reply({ content: "Please check your DMs.", ephemeral: true})
|
try {
|
||||||
|
await user.send({
|
||||||
if (!user.dmChannel) {
|
embeds: [{
|
||||||
await user.createDM();
|
title: 'Guild Application',
|
||||||
|
description: "Please answer the following questions to apply for the guild.\n" +
|
||||||
|
"If you wish to cancel your application, please press the button below or type `cancel`.",
|
||||||
|
color: embedColor,
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
await interaction.reply({ content: "Please enable your DMs.", ephemeral: true });
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await user.send({
|
await interaction.reply({ content: "Please check your DMs.", ephemeral: true})
|
||||||
embeds: [{
|
|
||||||
title: 'Guild Application',
|
|
||||||
description: "Please answer the following questions to apply for the guild.\n" +
|
|
||||||
"If you wish to cancel your application, please press the button below or type `cancel`.",
|
|
||||||
color: embedColor,
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
|
|
||||||
const input = await user.dmChannel.awaitMessages({
|
const input = await user.dmChannel.awaitMessages({
|
||||||
filter: m => m.author.id === user.id,
|
filter: m => m.author.id === user.id,
|
||||||
@@ -229,6 +228,8 @@ module.exports = {
|
|||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await user.deleteDM();
|
||||||
|
|
||||||
await guild.channels.create({
|
await guild.channels.create({
|
||||||
name: `Application-${user.username}`,
|
name: `Application-${user.username}`,
|
||||||
type: ChannelType.GuildText,
|
type: ChannelType.GuildText,
|
||||||
|
|||||||
Reference in New Issue
Block a user