Adding inactive log applications
This commit is contained in:
@@ -145,7 +145,7 @@ module.exports = {
|
||||
components: [
|
||||
new ActionRowBuilder()
|
||||
.addComponents(new ButtonBuilder()
|
||||
.setCustomId("inactivitylog")
|
||||
.setCustomId("guildinactivitylog")
|
||||
.setLabel("Submit")
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setEmoji({ name: "✅" }))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"color": "#eeaadb",
|
||||
"applicationsChannel": "776705352456470550",
|
||||
"staffApplicationsChannel": "1039258641393520700",
|
||||
"inactivityLogChannel": "829742524796239882",
|
||||
"staffOtherChannel": "1082036748558803104",
|
||||
"hypixelGuildID": "5a353a170cf2e529044f2935"
|
||||
}
|
||||
@@ -26,5 +26,11 @@
|
||||
"rsq3": "Have you been guild muted for any reason?",
|
||||
"rsq4": "Are you an active guild member?",
|
||||
"rsq5": "Do you have any experience as a staff member (guild moderator) at all?",
|
||||
"rsq6": "Why should we choose you as a Guild Moderator?"
|
||||
"rsq6": "Why should we choose you as a Guild Moderator?",
|
||||
"ia1": "What is your IGN?",
|
||||
"ia2": "Duration of the absence?",
|
||||
"ia3": "Reason of the absence?",
|
||||
"ria1": "What is your IGN?",
|
||||
"ria2": "Duration of the absence?",
|
||||
"ria3": "Reason of the absence?"
|
||||
}
|
||||
283
events/buttons/guildinactivitylog.js
Normal file
283
events/buttons/guildinactivitylog.js
Normal file
@@ -0,0 +1,283 @@
|
||||
const { ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder } = require("discord.js");
|
||||
const { gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole } = require("../../config/roles.json");
|
||||
const { ignM, smallM, largeM } = require("../../config/limitmessages.json");
|
||||
const { ia1, ia2, ia3, ria1, ria2, ria3 } = require("../../config/questions.json");
|
||||
const { color, inactivityLogChannel } = require("../../config/options.json");
|
||||
const guildRoles = [gm, manager, moderator, beast, member, trialmember, guildStaff, guildRole];
|
||||
|
||||
module.exports = {
|
||||
name: "guildinactivitylog",
|
||||
description: "Configure the bot.",
|
||||
type: "button",
|
||||
|
||||
async execute(interaction) {
|
||||
const guild = interaction.guild;
|
||||
const user = interaction.user;
|
||||
const embedColor = Number(color.replace("#", "0x"));
|
||||
const userRoles = guild.members.cache.get(user.id).roles.cache;
|
||||
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/";
|
||||
|
||||
if (!userRoles.some((role) => guildRoles.includes(role.id))) {
|
||||
return await interaction.reply({
|
||||
content: "Only guild members can use this button.",
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
const tooLong = new EmbedBuilder()
|
||||
.setDescription("You took too long to respond.")
|
||||
.setColor(embedColor);
|
||||
const cancelled = new EmbedBuilder()
|
||||
.setDescription("You have cancelled your application.")
|
||||
.setColor(embedColor);
|
||||
const attachments = new EmbedBuilder()
|
||||
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
|
||||
.setColor(embedColor);
|
||||
|
||||
try {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "Guild Inactivity Log",
|
||||
description: "Please answer the following questions to submit an inactivity log for the guild.\n" +
|
||||
"If you wish to cancel your form, please press type `cancel` at any time.\n" +
|
||||
"If you wish to proceed with your form, please type `yes`.\n\n" + "**Do not upload images, videos, or GIFS.**\n" +
|
||||
"You have a minute to respond to this message.",
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
});
|
||||
} catch (error) {
|
||||
return await interaction.reply({ content: "Please enable your DMs.", ephemeral: true });
|
||||
}
|
||||
|
||||
await interaction.reply({ content: "Please check your DMs.", ephemeral: true });
|
||||
|
||||
const input = await user.dmChannel.awaitMessages({
|
||||
filter: (m) => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60
|
||||
});
|
||||
if (input.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] });
|
||||
return;
|
||||
}
|
||||
if (input.size === 0) {
|
||||
await user.send({ embeds: [tooLong] });
|
||||
return;
|
||||
}
|
||||
if (input.first().content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] });
|
||||
return;
|
||||
}
|
||||
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Question 1**",
|
||||
description: ia1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 5 minutes to respond to this message."
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const answer1 = await user.dmChannel.awaitMessages({
|
||||
filter: (m) => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5
|
||||
});
|
||||
if (answer1.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] });
|
||||
return;
|
||||
}
|
||||
if (answer1.first().content > 16) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 16.",
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
});
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await fetch(mojangAPI + answer1.first().content);
|
||||
} catch (error) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "That is not a valid Minecraft username.\n" + "Application cancelled.",
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (answer1.size === 0) {
|
||||
await user.send({ embeds: [tooLong] });
|
||||
return;
|
||||
}
|
||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] });
|
||||
return;
|
||||
}
|
||||
const answer1_1 = answer1.first().content;
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 2**",
|
||||
description: ia2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 5 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
});
|
||||
const answer2 = await user.dmChannel.awaitMessages({
|
||||
filter: (m) => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5
|
||||
});
|
||||
if (answer2.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] });
|
||||
return;
|
||||
}
|
||||
if (answer2.first().content > 128) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 128.",
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (answer1.size === 0) {
|
||||
await user.send({ embeds: [tooLong] });
|
||||
return;
|
||||
}
|
||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] });
|
||||
return;
|
||||
}
|
||||
const answer2_1 = answer1.first().content;
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 3**",
|
||||
description: ia3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
});
|
||||
const answer3 = await user.dmChannel.awaitMessages({
|
||||
filter: (m) => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
});
|
||||
if (answer3.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] });
|
||||
return;
|
||||
}
|
||||
if (answer3.first().content > 256) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 256",
|
||||
color: embedColor
|
||||
}
|
||||
]
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (answer1.size === 0) {
|
||||
await user.send({ embeds: [tooLong] });
|
||||
return;
|
||||
}
|
||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] });
|
||||
return;
|
||||
}
|
||||
const answer3_1 = answer1.first().content;
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "If you want to submit your application, type `yes` if not, type `no`",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
const final = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5
|
||||
});
|
||||
if (final.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] });
|
||||
return
|
||||
}
|
||||
if (final.size === 0) {
|
||||
await user.send({ embeds: [tooLong] });
|
||||
return
|
||||
}
|
||||
if (final.first().content.toLowerCase() !== 'yes') {
|
||||
await user.send({ embeds: [cancelled]} );
|
||||
return
|
||||
}
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Your application has been submitted!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const appChannel = await guild.channels.cache.get(inactivityLogChannel);
|
||||
|
||||
await appChannel.send({
|
||||
embeds: [{
|
||||
title: user.username + "#" + user.discriminator + " - Inactivity Application",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user.displayAvatarURL({ dynamic: true })
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: ria1,
|
||||
value: "`" + answer1_1 + "`"
|
||||
},
|
||||
{
|
||||
name: ria2,
|
||||
value: "`" + answer2_1 + "`"
|
||||
},
|
||||
{
|
||||
name: ria3,
|
||||
value: "`" + answer3_1 + "`"
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
icon_url: user.displayAvatarURL({ dynamic: true }),
|
||||
text: "ID: " + user.id
|
||||
}
|
||||
}],
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("inactiveapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("inactiveapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
)
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
11
events/buttons/inactiveapplicationaccept.js
Normal file
11
events/buttons/inactiveapplicationaccept.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
name: "inactiveapplicationaccept",
|
||||
description: "Accept an inactivity application.",
|
||||
type: "button",
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.reply({ content: "This button is currently disabled.", ephemeral: true });
|
||||
|
||||
}
|
||||
}
|
||||
11
events/buttons/inactiveapplicationdeny.js
Normal file
11
events/buttons/inactiveapplicationdeny.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
name: "inactiveapplicationdeny",
|
||||
description: "Denies an inactivity application.",
|
||||
type: "button",
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.reply({ content: "This button is currently disabled.", ephemeral: true });
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user