Moved code to src folder
This commit is contained in:
173
src/events/buttons/checkstats.js
Normal file
173
src/events/buttons/checkstats.js
Normal file
@@ -0,0 +1,173 @@
|
||||
const { color } = require("../../../config/options.json")
|
||||
const guildapp = require("../../schemas/guildAppSchema.js")
|
||||
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../../../config/reqs.json")
|
||||
const { hypixelLevel, bedwarsLevel, skywarsLevel, getPlayer, getGuild, getHeadURL } = require("../../utils/utils.js")
|
||||
|
||||
module.exports = {
|
||||
name: "checkstats",
|
||||
description: "Check your stats.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.deferReply()
|
||||
|
||||
const message = interaction.message
|
||||
const embed = message.embeds[0]
|
||||
const applicantId = embed.footer.text.split(" ")[1]
|
||||
const guildappdata = await guildapp.findOne({ userID: applicantId })
|
||||
const uuid = guildappdata.uuid
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
const player = await getPlayer(uuid)
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
embeds: [{
|
||||
description: "That player hasn't played Hypixel before.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const ign = player.playername
|
||||
const head = await getHeadURL(ign)
|
||||
const rank2 = player.newPackageRank
|
||||
const monthlyRank = player.monthlyPackageRank
|
||||
|
||||
let rank = ""
|
||||
if (rank2 === "VIP") {
|
||||
rank = "[VIP] "
|
||||
} else if (rank2 === "VIP_PLUS") {
|
||||
rank = "[VIP+] "
|
||||
} else if (rank2 === "MVP") {
|
||||
rank = "[MVP] "
|
||||
} else if (rank2 === "MVP_PLUS" && monthlyRank === "NONE") {
|
||||
rank = "[MVP+] "
|
||||
} else if (rank2 === "MVP_PLUS" && monthlyRank === "SUPERSTAR") {
|
||||
rank = "[MVP++] "
|
||||
}
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
let guildName = ""
|
||||
if (!guild) {
|
||||
guildName = "None"
|
||||
} else {
|
||||
guildName = guild.name
|
||||
}
|
||||
|
||||
let guildTag = ""
|
||||
if (!guild) {
|
||||
guildTag = ""
|
||||
} else if (!guild.tag) {
|
||||
guildTag = ""
|
||||
} else {
|
||||
guildTag = " [" + guild.tag + "]"
|
||||
}
|
||||
|
||||
//bedwars level
|
||||
const hsbwexp = player.stats.Bedwars.Experience
|
||||
const hsbwstars = bedwarsLevel(hsbwexp)
|
||||
// bedwars fkdr
|
||||
const hsbwfk = player.stats.Bedwars.final_kills_bedwars
|
||||
const hsbwfd = player.stats.Bedwars.final_deaths_bedwars
|
||||
const hsbwfkdr = hsbwfk / hsbwfd
|
||||
// bedwars wins
|
||||
const hsbwwins = player.stats.Bedwars.wins_bedwars
|
||||
// skywars level
|
||||
const hsswexp = player.stats.SkyWars.skywars_experience
|
||||
const hsswstars = skywarsLevel(hsswexp)
|
||||
// skywars kdr
|
||||
const hsswkills = player.stats.SkyWars.kills
|
||||
const hsswdeaths = player.stats.SkyWars.deaths
|
||||
const hsswkd = hsswkills / hsswdeaths
|
||||
//skywars wins
|
||||
const hsswwins = player.stats.SkyWars.wins
|
||||
// dueks kdr
|
||||
const hsduelskills = player.stats.Duels.kills
|
||||
const hsduelsdeaths = player.stats.Duels.deaths
|
||||
const hsduelskd = hsduelskills / hsduelsdeaths
|
||||
// duels wins
|
||||
const hsduelswins = player.stats.Duels.wins
|
||||
// duels wlr
|
||||
const hsduelslosses = player.stats.Duels.losses
|
||||
const hsduelswlr = hsduelswins / hsduelslosses
|
||||
// network level
|
||||
const hypixelExp = player.networkExp
|
||||
const level = hypixelLevel(hypixelExp)
|
||||
|
||||
let bwtitle = ""
|
||||
let swtitle = ""
|
||||
let duelstitle = ""
|
||||
if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
|
||||
bwtitle = "<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
|
||||
} else {
|
||||
bwtitle = "<a:check_a:1087808632172847134> This player meets the BedWars requirements."
|
||||
}
|
||||
|
||||
if (hsswstars < swstars) {
|
||||
swtitle = "<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."
|
||||
} else {
|
||||
swtitle = "<a:check_a:1087808632172847134> This player meets the SkyWars requirements."
|
||||
}
|
||||
|
||||
if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
|
||||
duelstitle = "<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."
|
||||
} else {
|
||||
duelstitle = "<a:check_a:1087808632172847134> This player meets the Duels requirements."
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: rank + player.displayname + guildTag,
|
||||
description: "**Network Level:** `" +
|
||||
level.toFixed(2).toString() + "`\n" +
|
||||
"**Current Guild:** `" + guildName + "`",
|
||||
color: embedColor,
|
||||
thumbnail: { url: head },
|
||||
footer: {
|
||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||
icon_url: interaction.guild.iconURL()
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: bwtitle,
|
||||
value: "**➺ Stars:** `" +
|
||||
hsbwstars.toFixed(2).toString() + " / " +
|
||||
bwstars.toString() + "`\n" +
|
||||
"**➺ FKDR:** `" +
|
||||
hsbwfkdr.toFixed(2).toString() +
|
||||
" / " + bwfkdr.toString() + "`\n" +
|
||||
"**➺ Wins:** `" +
|
||||
hsbwwins.toString() + " / " +
|
||||
bwwins.toString() + "`"
|
||||
},
|
||||
{
|
||||
name: swtitle,
|
||||
value:
|
||||
"**➺ Stars:** `" +
|
||||
hsswstars.toFixed(2).toString() +
|
||||
" / " + swstars.toString() + "`\n" +
|
||||
"**➺ KDR:** `" +
|
||||
hsswkd.toFixed(2).toString() + "`\n" +
|
||||
"**➺ Wins:** `" +
|
||||
hsswwins.toString() + "`"
|
||||
},
|
||||
{
|
||||
name: duelstitle,
|
||||
value: "**➺ Wins:** `" +
|
||||
hsduelswins.toString() +
|
||||
" / " + duelswins.toString() + "`\n" +
|
||||
"**➺ WLR:** `" +
|
||||
hsduelswlr.toFixed(2).toString() +
|
||||
" / " + duelswlr.toString() + "`\n" +
|
||||
"**➺ KDR:** `" +
|
||||
hsduelskd.toFixed(2).toString() + "`"
|
||||
}
|
||||
]
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
95
src/events/buttons/guildapplicationaccept.js
Normal file
95
src/events/buttons/guildapplicationaccept.js
Normal file
@@ -0,0 +1,95 @@
|
||||
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require("discord.js")
|
||||
const { color } = require("../../../config/options.json")
|
||||
const mongoose = require("mongoose")
|
||||
const guildapp = require("../../schemas/guildAppSchema.js")
|
||||
const waitingList = require("../../schemas/waitinglistSchema.js")
|
||||
const { waitingListRole } = require("../../../config/roles.json")
|
||||
|
||||
module.exports = {
|
||||
name: "guildapplicationaccept",
|
||||
description: "Accept a guild application.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.user
|
||||
const guild = interaction.guild
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
const message = interaction.message
|
||||
const embed = message.embeds[0]
|
||||
const applicantId = embed.footer.text.split(" ")[1]
|
||||
|
||||
const applicantIGN1 = embed.fields[0].value
|
||||
const applicantIGN = applicantIGN1.replaceAll("`", "")
|
||||
|
||||
const applicant = await guild.members.fetch(applicantId)
|
||||
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator
|
||||
|
||||
await message.edit({
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("guildapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(true),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("guildapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
.setDisabled(true),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("checkstats")
|
||||
.setLabel("Check Stats")
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
.setDisabled(true)
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
await applicant.send({
|
||||
embeds: [{
|
||||
description: "Your application for the Illegitimate guild has been accepted.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const applicantEntry = await guildapp.findOne({ userID: applicantId })
|
||||
const applicantUUID = applicantEntry.uuid
|
||||
const time = Date.now()
|
||||
|
||||
const waitingListAdd = new waitingList({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
userID: applicantId,
|
||||
uuid: applicantUUID,
|
||||
IGN: applicantIGN,
|
||||
timestamp: time
|
||||
})
|
||||
|
||||
await waitingListAdd.save()
|
||||
|
||||
await applicant.roles.add(waitingListRole)
|
||||
await guildapp.findOneAndDelete({ userID: applicantId })
|
||||
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: applicantUsername + " - Guild Application",
|
||||
description: "Application has been accepted by <@" + user.id + ">.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL()
|
||||
},
|
||||
footer: {
|
||||
iconURL: guild.iconURL(),
|
||||
text: "ID: " + applicant.id
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
27
src/events/buttons/guildapplicationdeny.js
Normal file
27
src/events/buttons/guildapplicationdeny.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js")
|
||||
|
||||
module.exports = {
|
||||
name: "guildapplicationdeny",
|
||||
description: "Deny a guild application.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
const modal = new ModalBuilder()
|
||||
.setTitle("Deny Reason")
|
||||
.setCustomId("denyreasonbox")
|
||||
.setComponents(
|
||||
new ActionRowBuilder().setComponents(
|
||||
new TextInputBuilder()
|
||||
.setLabel("Deny Reason")
|
||||
.setCustomId("denyreason")
|
||||
.setStyle(TextInputStyle.Paragraph)
|
||||
.setPlaceholder("Enter a reason for denying the application")
|
||||
.setRequired(false)
|
||||
)
|
||||
)
|
||||
await interaction.showModal(modal)
|
||||
}
|
||||
}
|
||||
523
src/events/buttons/guildapply.js
Normal file
523
src/events/buttons/guildapply.js
Normal file
@@ -0,0 +1,523 @@
|
||||
const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require("discord.js")
|
||||
const { color } = require("../../../config/options.json")
|
||||
const { largeM, smallM, ignM } = require("../../../config/limitmessages.json")
|
||||
const { applicationsChannel } = require("../../../config/options.json")
|
||||
const questions = require("../../../config/questions.json")
|
||||
const { guildRole } = require("../../../config/roles.json")
|
||||
const { getUUID } = require("../../utils/utils.js")
|
||||
const mongoose = require("mongoose")
|
||||
const guildapp = require("../../schemas/guildAppSchema.js")
|
||||
|
||||
module.exports = {
|
||||
name: "guildapply",
|
||||
description: "Guild application button.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
const user = interaction.user
|
||||
const guild = interaction.guild
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
const userRoles = guild.members.cache.get(user.id).roles.cache.map(role => role.id)
|
||||
const guildQuestions = questions.guild
|
||||
|
||||
function qu(n) {
|
||||
return guildQuestions[n - 1].q
|
||||
}
|
||||
|
||||
function rq(n) {
|
||||
return guildQuestions[n - 1].r
|
||||
}
|
||||
|
||||
if (interaction.customId === "guildapply") {
|
||||
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
if (userRoles.includes(guildRole)) {
|
||||
await interaction.editReply({ content: "You are already a member of the guild.", ephemeral: true })
|
||||
return
|
||||
}
|
||||
|
||||
const application = await guildapp.findOne({ userID: user.id })
|
||||
|
||||
if (application) {
|
||||
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true })
|
||||
return
|
||||
}
|
||||
|
||||
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 Application",
|
||||
description: "Please answer the following questions to apply for the guild.\n" +
|
||||
"If you wish to cancel your application, please type `cancel` at any time.\n" +
|
||||
"If you wish to proceed with your application, 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) {
|
||||
await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true })
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({ 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.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (input.first().content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (input.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
|
||||
// first question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 1**",
|
||||
description: qu(1) + "\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.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
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
|
||||
}
|
||||
const uuid = await getUUID(answer1.first().content)
|
||||
if (!uuid) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "That is not a valid Minecraft username.\n" +
|
||||
"Application cancelled.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer1_1 = answer1.first().content
|
||||
|
||||
// second question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 2**",
|
||||
description: qu(2) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(8 characters max)`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer2 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer2.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().content.size > 8) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 8.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer2_1 = answer2.first().content
|
||||
|
||||
// third question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 3**",
|
||||
description: qu(3) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
|
||||
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.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().content > 128) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 128.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer3_1 = answer3.first().content
|
||||
|
||||
// fourth question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 4**",
|
||||
description: qu(4) + "\n\nPlease type your answer below or type `cancel` to cancel your application." +
|
||||
" `(We expect a longer answer.)`\n`" + largeM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer4 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer4.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().content > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer4_1 = answer4.first().content
|
||||
|
||||
// fifth question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 5**",
|
||||
description: qu(5) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer5 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer5.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().content > 128) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 128.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer5_1 = answer5.first().content
|
||||
|
||||
// sixth question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 6**",
|
||||
description: qu(6) + "\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 answer6 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer6.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().content > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer6_1 = answer6.first().content
|
||||
|
||||
// seventh question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 7**",
|
||||
description: qu(7) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer7 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer7.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer7.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer7.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer7.first().content > 128) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 128.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer7_1 = answer7.first().content
|
||||
|
||||
// eighth question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 8**",
|
||||
description: qu(8) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer8 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer8.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer8.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer8.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer8.first().content > 64) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 64.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer8_1 = answer8.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.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (final.first().content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (final.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Your application has been submitted!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const newGuildApp = new guildapp({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
userID: user.id,
|
||||
uuid: uuid,
|
||||
})
|
||||
|
||||
await newGuildApp.save()
|
||||
|
||||
const channel = guild.channels.cache.get(applicationsChannel)
|
||||
await channel.send({
|
||||
embeds: [{
|
||||
title: user.username + "#" + user.discriminator + " - Guild Application",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user.avatarURL()
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: rq(1),
|
||||
value: "```" + answer1_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(2),
|
||||
value: "```" + answer2_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(3),
|
||||
value: "```" + answer3_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(4),
|
||||
value: "```" + answer4_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(5),
|
||||
value: "```" + answer5_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(6),
|
||||
value: "```" + answer6_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(7),
|
||||
value: "```" + answer7_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(8),
|
||||
value: "```" + answer8_1 + "```"
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
iconURL: guild.iconURL(),
|
||||
text: "ID: " + user.id
|
||||
}
|
||||
}],
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("guildapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("guildapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("checkstats")
|
||||
.setLabel("Check Stats")
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
273
src/events/buttons/guildinactivitylog.js
Normal file
273
src/events/buttons/guildinactivitylog.js
Normal file
@@ -0,0 +1,273 @@
|
||||
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",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
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),
|
||||
)
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
13
src/events/buttons/inactiveapplicationaccept.js
Normal file
13
src/events/buttons/inactiveapplicationaccept.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
name: "inactiveapplicationaccept",
|
||||
description: "Accept an inactivity application.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.reply({ content: "This button is currently disabled.", ephemeral: true })
|
||||
|
||||
}
|
||||
}
|
||||
13
src/events/buttons/inactiveapplicationdeny.js
Normal file
13
src/events/buttons/inactiveapplicationdeny.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
name: "inactiveapplicationdeny",
|
||||
description: "Denies an inactivity application.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.reply({ content: "This button is currently disabled.", ephemeral: true })
|
||||
|
||||
}
|
||||
}
|
||||
67
src/events/buttons/staffapplicationaccept.js
Normal file
67
src/events/buttons/staffapplicationaccept.js
Normal file
@@ -0,0 +1,67 @@
|
||||
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
|
||||
const { color } = require("../../../config/options.json")
|
||||
const staffapp = require("../../schemas/staffAppSchema.js")
|
||||
|
||||
module.exports = {
|
||||
name: "staffapplicationaccept",
|
||||
description: "Accept a staff application.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
const user = interaction.user
|
||||
const guild = interaction.guild
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
const message = interaction.message
|
||||
const embed = message.embeds[0]
|
||||
const applicantId = embed.footer.text.split(" ")[1]
|
||||
|
||||
const applicant = await guild.members.fetch(applicantId)
|
||||
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator
|
||||
|
||||
await applicant.send({
|
||||
embeds: [{
|
||||
description: "Your application for the Illegitimate staff team has been accepted.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
await message.edit({
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("staffapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(true),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("staffapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
.setDisabled(true)
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
await staffapp.findOneAndDelete({ userId: applicantId })
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
title: applicantUsername + " - Staff Application.",
|
||||
description: "Application accepted by <@" + user.id + ">.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL()
|
||||
},
|
||||
footer: {
|
||||
iconurl: guild.iconURL(),
|
||||
text: "ID: " + applicantId
|
||||
}
|
||||
}]
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
27
src/events/buttons/staffapplicationdeny.js
Normal file
27
src/events/buttons/staffapplicationdeny.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js")
|
||||
|
||||
module.exports = {
|
||||
name: "staffapplicationdeny",
|
||||
description: "Deny a guild application.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
const modal = new ModalBuilder()
|
||||
.setTitle("Deny Reason")
|
||||
.setCustomId("staffdenyreasonbox")
|
||||
.setComponents(
|
||||
new ActionRowBuilder().setComponents(
|
||||
new TextInputBuilder()
|
||||
.setLabel("Deny Reason")
|
||||
.setCustomId("staffdenyreason")
|
||||
.setStyle(TextInputStyle.Paragraph)
|
||||
.setPlaceholder("Enter a reason for denying the application")
|
||||
.setRequired(false)
|
||||
)
|
||||
)
|
||||
await interaction.showModal(modal)
|
||||
}
|
||||
}
|
||||
451
src/events/buttons/staffapply.js
Normal file
451
src/events/buttons/staffapply.js
Normal file
@@ -0,0 +1,451 @@
|
||||
const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require("discord.js")
|
||||
const { color, staffApplicationsChannel } = require("../../../config/options.json")
|
||||
const { largeM, ignM } = require("../../../config/limitmessages.json")
|
||||
const questions = require("../../../config/questions.json")
|
||||
const { guildRole, guildStaff } = require("../../../config/roles.json")
|
||||
const mongoose = require("mongoose")
|
||||
const staffapp = require("../../schemas/staffAppSchema.js")
|
||||
const settings = require("../../schemas/settingsSchema.js")
|
||||
const { getUUID } = require("../../utils/utils.js")
|
||||
const dev = process.env.DEV
|
||||
|
||||
module.exports = {
|
||||
name: "staffapply",
|
||||
description: "Apply for the staff team.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
const user = interaction.user
|
||||
const guild = interaction.guild
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
const userRoles = interaction.member.roles.cache
|
||||
const setting = await settings.findOne({ name: "staffAppStatus" })
|
||||
const status = setting.value
|
||||
const staffQuestions = questions.staff
|
||||
|
||||
function sq(n) {
|
||||
return staffQuestions[n - 1].q
|
||||
}
|
||||
|
||||
function rq(n) {
|
||||
return staffQuestions[n - 1].r
|
||||
}
|
||||
|
||||
if (interaction.customId === "staffapply") {
|
||||
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
if (user.id !== dev) {
|
||||
if (status === "0") {
|
||||
await interaction.editReply({ content: "Staff applications are currently closed.", ephemeral: true })
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (!userRoles.has(guildRole)) {
|
||||
await interaction.editReply({ content: "You must be a member of the guild to apply for staff.", ephemeral: true })
|
||||
return
|
||||
}
|
||||
|
||||
if (userRoles.has(guildStaff)) {
|
||||
await interaction.editReply({ content: "You are already a staff member.", ephemeral: true })
|
||||
return
|
||||
}
|
||||
|
||||
const application = await staffapp.findOne({ userID: user.id })
|
||||
|
||||
if (application) {
|
||||
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true })
|
||||
return
|
||||
}
|
||||
|
||||
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: "Staff Application",
|
||||
description: "Please answer the following questions to apply for staff.\n" +
|
||||
"If you wish to cancel your application, please press type `cancel` at any time.\n" +
|
||||
"If you wish to proceed with your application, 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) {
|
||||
await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true })
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({ 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.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (input.first().content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (input.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
|
||||
// first question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 1**",
|
||||
description: sq(1) + "\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.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
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
|
||||
}
|
||||
const uuid = await getUUID(answer1.first().content)
|
||||
if (!uuid) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "That is not a valid Minecraft username.\n" +
|
||||
"Application cancelled.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer1_1 = answer1.first().content
|
||||
|
||||
// second question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 2**",
|
||||
description: sq(2) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer2 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer2.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().content > 64) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 64.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer2_1 = answer2.first().content
|
||||
|
||||
// third question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 3**",
|
||||
description: sq(3) + "\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.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
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
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer3_1 = answer3.first().content
|
||||
|
||||
// fourth question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 4**",
|
||||
description: sq(4) + "\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 answer4 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer4.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().content > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer4_1 = answer4.first().content
|
||||
|
||||
// fifth question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 5**",
|
||||
description: sq(5) + "\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 answer5 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer5.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().content > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer5_1 = answer5.first().content
|
||||
|
||||
// sixth question
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 6**",
|
||||
description: sq(6) + "\n\nPlease type your answer below or type `cancel` to cancel your application." +
|
||||
"`(We expect a longer answer here)`\n`" + largeM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer6 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer6.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().content > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer6_1 = answer6.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.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (final.first().content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (final.first().attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Your application has been submitted!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const newStaffApp = new staffapp({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
userID: user.id,
|
||||
uuid: uuid,
|
||||
})
|
||||
|
||||
await newStaffApp.save()
|
||||
await user.deleteDM()
|
||||
|
||||
const channel = guild.channels.cache.get(staffApplicationsChannel)
|
||||
|
||||
await channel.send({
|
||||
embeds: [{
|
||||
title: user.username + "#" + user.discriminator + " - Staff Application",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user.avatarURL()
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: rq(1),
|
||||
value: "```" + answer1_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(2),
|
||||
value: "```" + answer2_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(3),
|
||||
value: "```" + answer3_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(4),
|
||||
value: "```" + answer4_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(5),
|
||||
value: "```" + answer5_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(6),
|
||||
value: "```" + answer6_1 + "```"
|
||||
}
|
||||
|
||||
],
|
||||
footer: {
|
||||
iconURL: guild.iconURL(),
|
||||
text: "ID: " + user.id
|
||||
}
|
||||
}],
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("staffapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("staffapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
)
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/events/buttons/verify.js
Normal file
29
src/events/buttons/verify.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js")
|
||||
|
||||
module.exports = {
|
||||
name: "verify",
|
||||
description: "Configure the bot.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
const modal = new ModalBuilder()
|
||||
.setTitle("Verification")
|
||||
.setCustomId("verifybox")
|
||||
.setComponents(
|
||||
new ActionRowBuilder().setComponents(
|
||||
new TextInputBuilder()
|
||||
.setLabel("IGN")
|
||||
.setCustomId("verifyfield")
|
||||
.setStyle(TextInputStyle.Short)
|
||||
.setPlaceholder("Enter your ign.")
|
||||
.setRequired(true)
|
||||
.setMinLength(3)
|
||||
.setMaxLength(16)
|
||||
)
|
||||
)
|
||||
await interaction.showModal(modal)
|
||||
}
|
||||
}
|
||||
63
src/events/buttons/waitingListUpdate.js
Normal file
63
src/events/buttons/waitingListUpdate.js
Normal file
@@ -0,0 +1,63 @@
|
||||
const waitinglist = require("../../schemas/waitinglistSchema.js")
|
||||
const { getGuild } = require("../../utils/utils.js")
|
||||
const { hypixelGuildID } = require("../../../config/options.json")
|
||||
|
||||
module.exports = {
|
||||
name: "waitinglistupdate",
|
||||
description: "Update the waiting list.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
const user = interaction.user
|
||||
const message = interaction.message
|
||||
const embed = message.embeds[0]
|
||||
const accepted = await waitinglist.find()
|
||||
|
||||
for (let i = 0; i < accepted.length; i++) {
|
||||
|
||||
const uuid = accepted[i].uuid
|
||||
const guild = await getGuild(uuid)
|
||||
|
||||
if (guild && guild._id === hypixelGuildID) {
|
||||
await waitinglist.findOneAndDelete({ uuid: uuid })
|
||||
continue
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let fields = []
|
||||
|
||||
for (let i = 0; i < accepted.length; i++) {
|
||||
|
||||
const timestamp1 = accepted[i].timestamp / 1000
|
||||
const timestamp = Math.floor(timestamp1)
|
||||
|
||||
fields.push({
|
||||
name: `${i + 1}. ${accepted[i].IGN}`,
|
||||
value: `TS: <t:${timestamp}:R>`
|
||||
})
|
||||
}
|
||||
|
||||
await message.edit({
|
||||
embeds: [{
|
||||
title: embed.title,
|
||||
description: embed.description,
|
||||
color: embed.color,
|
||||
footer: {
|
||||
text: "Last updated by " + user.username,
|
||||
icon_url: user.avatarURL(),
|
||||
},
|
||||
thumbnail: embed.thumbnail,
|
||||
fields: fields,
|
||||
timestamp: new Date(),
|
||||
}],
|
||||
})
|
||||
|
||||
await interaction.editReply({ content: "Updated the waiting list", ephemeral: true })
|
||||
}
|
||||
}
|
||||
93
src/events/modals/denyreasonbox.js
Normal file
93
src/events/modals/denyreasonbox.js
Normal file
@@ -0,0 +1,93 @@
|
||||
const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
|
||||
const { color } = require("../../../config/options.json")
|
||||
const guildapp = require("../../schemas/guildAppSchema.js")
|
||||
|
||||
module.exports = {
|
||||
name: "denyreasonbox",
|
||||
description: "Deny reason box.",
|
||||
type: "modal",
|
||||
|
||||
/** @param {import('discord.js').ModalSubmitInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
if (interaction.type !== InteractionType.ModalSubmit) return
|
||||
if (interaction.customId !== "denyreasonbox") return
|
||||
|
||||
interaction.deferReply()
|
||||
|
||||
const guild = interaction.guild
|
||||
|
||||
const message = interaction.message
|
||||
const embed = message.embeds[0]
|
||||
const applicantId = embed.footer.text.split(" ")[1]
|
||||
|
||||
let applicant = ""
|
||||
try {
|
||||
applicant = await guild.members.fetch(applicantId)
|
||||
} catch (error) {
|
||||
applicant = null
|
||||
}
|
||||
const reason = interaction.fields.fields.get("denyreason").value || "No reason provided"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
await message.edit({
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("guildapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(true),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("guildapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
.setDisabled(true),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("checkstats")
|
||||
.setLabel("Check Stats")
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
.setDisabled(true)
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
const dmMessage = new EmbedBuilder()
|
||||
.setDescription("Your application for the Illegitimate guild has been denied\n" +
|
||||
"**Reason:** `" + reason + "`")
|
||||
.setColor(embedColor)
|
||||
|
||||
const missingUser = new EmbedBuilder()
|
||||
.setDescription("[WARN] User has left the server and cannot be notified.")
|
||||
.setColor(embedColor)
|
||||
|
||||
const responseEmbed = new EmbedBuilder()
|
||||
.setTitle("Application Denied")
|
||||
.setDescription("The application has been denied by <@" + interaction.user.id + ">.\n" +
|
||||
"**Reason:** `" + reason + "`")
|
||||
.setColor(embedColor)
|
||||
.setThumbnail(guild.iconURL())
|
||||
.setFooter({
|
||||
iconURL: guild.iconURL(),
|
||||
text: "ID: " + applicant.id
|
||||
})
|
||||
|
||||
if (applicant !== null) {
|
||||
await applicant.send({ embeds: [dmMessage] })
|
||||
}
|
||||
|
||||
let responseEmbeds = ""
|
||||
if (applicant === null) {
|
||||
responseEmbeds = [responseEmbed, missingUser]
|
||||
} else {
|
||||
responseEmbeds = [responseEmbed]
|
||||
}
|
||||
|
||||
await guildapp.findOneAndDelete({ userID: applicantId })
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: responseEmbeds
|
||||
})
|
||||
}
|
||||
}
|
||||
70
src/events/modals/staffdenyreasonbox.js
Normal file
70
src/events/modals/staffdenyreasonbox.js
Normal file
@@ -0,0 +1,70 @@
|
||||
const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
|
||||
const { color } = require("../../../config/options.json")
|
||||
const staffapp = require("../../schemas/staffAppSchema.js")
|
||||
|
||||
module.exports = {
|
||||
name: "staffdenyreasonbox",
|
||||
description: "Deny reason box.",
|
||||
type: "modal",
|
||||
|
||||
/** @param {import('discord.js').ModalSubmitInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
if (interaction.type !== InteractionType.ModalSubmit) return
|
||||
if (interaction.customId !== "staffdenyreasonbox") return
|
||||
|
||||
interaction.deferReply()
|
||||
|
||||
const guild = interaction.guild
|
||||
const reason = interaction.fields.fields.get("staffdenyreason").value || "No reason provided"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
const message = interaction.message
|
||||
const embed = message.embeds[0]
|
||||
const applicantId = embed.footer.text.split(" ")[1]
|
||||
const applicant = await guild.members.fetch(applicantId)
|
||||
|
||||
await message.edit({
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("staffapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(true),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("staffapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
.setDisabled(true),
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
const dmMessage = new EmbedBuilder()
|
||||
.setDescription("Your application for the Illegitimate guild staff has been denied\n" +
|
||||
"**Reason:** `" + reason + "`")
|
||||
.setColor(embedColor)
|
||||
|
||||
await applicant.send({ embeds: [dmMessage] })
|
||||
|
||||
await staffapp.findOneAndDelete({ userID: applicantId })
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: "Application Denied",
|
||||
description: "The application has been denied by <@" + interaction.user.id + ">.\n" +
|
||||
"**Reason:** `" + reason + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL()
|
||||
},
|
||||
footer: {
|
||||
iconURL: guild.iconURL(),
|
||||
text: "ID: " + applicant.id
|
||||
}
|
||||
}],
|
||||
})
|
||||
}
|
||||
}
|
||||
35
src/events/server/guildMemberAdd/logNewJoins.js
Normal file
35
src/events/server/guildMemberAdd/logNewJoins.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const { userMention } = require("discord.js")
|
||||
const { color, botLogChannel } = require("../../../../config/options.json")
|
||||
|
||||
module.exports = {
|
||||
name: "logNewJoins",
|
||||
description: "Logs new joins",
|
||||
type: "event",
|
||||
event: "guildMemberAdd",
|
||||
|
||||
/** @param { import('discord.js').GuildMember } member */
|
||||
execute(member) {
|
||||
|
||||
const channel = member.guild.channels.cache.get(botLogChannel)
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (!channel) {
|
||||
console.log("[ERROR] Could not find channel used for new join logging.")
|
||||
return
|
||||
}
|
||||
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "New Member",
|
||||
description: userMention(member.id) + " has joined the server.\n" +
|
||||
"Account created: " + member.user.createdAt.toLocaleString(),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + member.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
}]
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
22
src/events/server/interactions/logBtnsCmds.js
Normal file
22
src/events/server/interactions/logBtnsCmds.js
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = {
|
||||
name: "logBtnsCmds",
|
||||
description: "Logs all button and command interactions",
|
||||
type: "event",
|
||||
event: "interactionCreate",
|
||||
|
||||
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
|
||||
|
||||
execute(interaction) {
|
||||
if (interaction.isCommand()) {
|
||||
console.log(interaction.user.username + "#" +
|
||||
interaction.user.discriminator + " ran " +
|
||||
interaction.commandName
|
||||
)
|
||||
} else if (interaction.isButton()) {
|
||||
console.log(interaction.user.username + "#" +
|
||||
interaction.user.discriminator + " clicked " +
|
||||
interaction.customId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
14
src/events/server/messages/clown.js
Normal file
14
src/events/server/messages/clown.js
Normal file
@@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
name: "ur mom",
|
||||
description: "ur moms someone",
|
||||
type: "event",
|
||||
event: "messageCreate",
|
||||
|
||||
/** @param { import('discord.js').Message } message */
|
||||
|
||||
async execute(message) {
|
||||
if (message.content.toLowerCase().includes("ur mom") && message.author.username === "taken.lua") {
|
||||
message.react("Woot:734345936347725885")
|
||||
}
|
||||
}
|
||||
}
|
||||
11
src/events/server/ready/consolelog.js
Normal file
11
src/events/server/ready/consolelog.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
name: "conolelog",
|
||||
description: "console log",
|
||||
type: "event",
|
||||
event: "ready",
|
||||
|
||||
/** @param { import('discord.js').Client } client */
|
||||
execute(client) {
|
||||
console.log("Logged in as " + client.user.tag + "!")
|
||||
}
|
||||
}
|
||||
27
src/events/server/ready/sendOnlineMessage.js
Normal file
27
src/events/server/ready/sendOnlineMessage.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const { onlineLogChannel, color } = require("../../../../config/options.json")
|
||||
|
||||
module.exports = {
|
||||
name: "sendonlinemessage",
|
||||
description: "send an online message",
|
||||
type: "event",
|
||||
event: "ready",
|
||||
|
||||
execute(client) {
|
||||
if (process.env.NODE_ENV === "dev") return
|
||||
|
||||
const channel = client.channels.cache.get(onlineLogChannel)
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (!channel) {
|
||||
console.log("[ERROR] Could not find channel used for online message.")
|
||||
return
|
||||
}
|
||||
|
||||
channel.send({
|
||||
embeds: [{
|
||||
description: "Bot is online!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
34
src/events/server/ready/status.js
Normal file
34
src/events/server/ready/status.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const statuses = require("../../../../config/statuses.json")
|
||||
|
||||
module.exports = {
|
||||
name: "status",
|
||||
description: "Sets the status of the bot",
|
||||
type: "event",
|
||||
event: "ready",
|
||||
|
||||
/** @param { import('discord.js').Client } client */
|
||||
|
||||
execute(client) {
|
||||
|
||||
// Playing 0
|
||||
// Streaming 1
|
||||
// Listening 2
|
||||
// Watching 3
|
||||
// Custom 4
|
||||
// Competing 5
|
||||
|
||||
client.user.setActivity(
|
||||
{ name: statuses[0].name, type: 3}
|
||||
)
|
||||
|
||||
let i = 0
|
||||
setInterval(() =>
|
||||
client.user.setActivity(
|
||||
statuses[i = 1, i++ % statuses.length]
|
||||
),
|
||||
1000 * 60 * 10
|
||||
)
|
||||
|
||||
client.user.setStatus("dnd")
|
||||
}
|
||||
}
|
||||
86
src/events/server/voiceStateUpdate/vcJoinLeave.js
Normal file
86
src/events/server/voiceStateUpdate/vcJoinLeave.js
Normal file
@@ -0,0 +1,86 @@
|
||||
const { userMention, channelMention } = require("discord.js")
|
||||
const { botLogChannel, color } = require("../../../../config/options.json")
|
||||
|
||||
module.exports = {
|
||||
name: "vcJoinLeave",
|
||||
description: "Logs when a user joins or leaves a voice channel.",
|
||||
type: "event",
|
||||
event: "voiceStateUpdate",
|
||||
|
||||
/**
|
||||
* @param { import('discord.js').VoiceState } oldState
|
||||
* @param { import('discord.js').VoiceState } newState
|
||||
*/
|
||||
|
||||
execute(oldState, newState) {
|
||||
|
||||
// if (process.env.NODE_ENV === 'dev') return
|
||||
|
||||
const guild = oldState.guild
|
||||
const channel = guild.channels.cache.get(botLogChannel)
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (!channel) {
|
||||
console.log("[ERROR] Could not find channel used for voice channel join/leave logging.")
|
||||
return
|
||||
}
|
||||
|
||||
const oldChannel = oldState.channel
|
||||
const newChannel = newState.channel
|
||||
|
||||
if (oldChannel === null && newChannel !== null) {
|
||||
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "Voice Channel Join",
|
||||
description: userMention(oldState.member.id) +
|
||||
" joined " +
|
||||
channelMention(newChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
}]
|
||||
})
|
||||
|
||||
} else if (oldChannel !== null && newChannel === null) {
|
||||
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "Voice Channel Leave",
|
||||
description: userMention(oldState.member.id) +
|
||||
" left " +
|
||||
channelMention(oldChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
}]
|
||||
})
|
||||
|
||||
} else if (oldChannel !== null && newChannel !== null) {
|
||||
|
||||
if (oldChannel.id === newChannel.id) return
|
||||
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "Voice Channel Switch",
|
||||
description: userMention(oldState.member.id) +
|
||||
" switched from " +
|
||||
channelMention(oldChannel.id) +
|
||||
" to " +
|
||||
channelMention(newChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
}]
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user