Converted main codebase to typescript
Signed-off-by: Taken <taken@mairimashita.org>
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
module.exports = {
|
||||
import { Autocomplete } from "../../interfaces"
|
||||
|
||||
export = {
|
||||
name: "unban",
|
||||
description: "Unban a user from the server",
|
||||
type: "autocomplete",
|
||||
|
||||
/** @param { import("discord.js").AutocompleteInteraction } interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
const focusedOption = interaction.options.getFocused(true)
|
||||
if (focusedOption.name !== "user") return
|
||||
if (focusedOption.name !== "user") {
|
||||
return
|
||||
}
|
||||
|
||||
if (focusedOption.value === "") {
|
||||
await interaction.respond([{
|
||||
@@ -17,7 +19,7 @@ module.exports = {
|
||||
return
|
||||
}
|
||||
|
||||
const bannedUsers = await interaction.guild.bans.fetch()
|
||||
const bannedUsers = await interaction.guild!.bans.fetch()
|
||||
const filteredUsers = bannedUsers.filter((user) =>
|
||||
user.user.username.toLowerCase().includes(focusedOption.value.toLowerCase())
|
||||
)
|
||||
@@ -29,4 +31,4 @@ module.exports = {
|
||||
|
||||
await interaction.respond(results.slice(0, 25)).catch((err) => { console.log(err) })
|
||||
}
|
||||
}
|
||||
} as Autocomplete
|
||||
@@ -1,24 +1,22 @@
|
||||
const { color, devMessage } = require("../../../config/options.json")
|
||||
const guildapp = require("../../schemas/guildAppSchema.js")
|
||||
const { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } = require("../../../config/reqs.json")
|
||||
const { hypixelLevel, bedwarsLevel, skywarsLevel, getPlayer, getGuild, getHeadURL } = require("../../utils/utils.js")
|
||||
import { color, devMessage } from "../../../config/options.json"
|
||||
import guildapp from "../../schemas/guildAppSchema"
|
||||
import { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } from "../../../config/reqs.json"
|
||||
import { hypixelLevel, bedwarsLevel, skywarsLevel, getPlayer, getGuild, getHeadURL } from "../../utils/Hypixel"
|
||||
import { Button } from "../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
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 applicantId = embed.footer!.text.split(" ")[1]
|
||||
const guildappdata = await guildapp.findOne({ userID: applicantId })
|
||||
const uuid = guildappdata.uuid
|
||||
const uuid = guildappdata!.uuid
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
const player = await getPlayer(uuid)
|
||||
@@ -71,7 +69,7 @@ module.exports = {
|
||||
if (!guild) {
|
||||
guildRank = "N/A"
|
||||
} else {
|
||||
guildRank = guild.members.find((m) => m.uuid === uuid).rank
|
||||
guildRank = guild.members.find((m) => m.uuid === uuid)!.rank
|
||||
}
|
||||
|
||||
const statsFields = []
|
||||
@@ -180,13 +178,15 @@ module.exports = {
|
||||
"**Current Guild:** `" + guildName + "`\n" +
|
||||
"**Guild Rank:** `" + guildRank + "`",
|
||||
color: embedColor,
|
||||
thumbnail: { url: head },
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild.name + " | " + devMessage,
|
||||
icon_url: interaction.guild.iconURL()
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL()!
|
||||
},
|
||||
fields: statsFields
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,38 +1,35 @@
|
||||
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")
|
||||
import { ActionRowBuilder, ButtonStyle, ButtonBuilder } from "discord.js"
|
||||
import { color } from "../../../config/options.json"
|
||||
import mongoose from "mongoose"
|
||||
import guildapp from "../../schemas/guildAppSchema"
|
||||
import waitingList from "../../schemas/waitinglistSchema"
|
||||
import { waitingListRole } from "../../../config/roles.json"
|
||||
import { Button } from "../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
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 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 applicantId = embed.footer!.text.split(" ")[1]
|
||||
const applicantIGN = embed.fields[0].value.replaceAll("`", "")
|
||||
|
||||
const applicant = await guild.members.fetch(applicantId)
|
||||
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator
|
||||
|
||||
await message.edit({
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("guildapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
@@ -60,7 +57,7 @@ module.exports = {
|
||||
})
|
||||
|
||||
const applicantEntry = await guildapp.findOne({ userID: applicantId })
|
||||
const applicantUUID = applicantEntry.uuid
|
||||
const applicantUUID = applicantEntry!.uuid
|
||||
const time = Date.now()
|
||||
|
||||
const waitingListAdd = new waitingList({
|
||||
@@ -83,13 +80,13 @@ module.exports = {
|
||||
description: "Application has been accepted by <@" + user.id + ">.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL()
|
||||
url: applicant.avatarURL() || guild.iconURL()!
|
||||
},
|
||||
footer: {
|
||||
iconURL: guild.iconURL(),
|
||||
icon_url: guild.iconURL()!,
|
||||
text: "ID: " + applicant.id
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,19 +1,18 @@
|
||||
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js")
|
||||
import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"
|
||||
import { Button } from "../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
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 ActionRowBuilder<TextInputBuilder>().setComponents(
|
||||
new TextInputBuilder()
|
||||
.setLabel("Deny Reason")
|
||||
.setCustomId("denyreason")
|
||||
@@ -24,4 +23,4 @@ module.exports = {
|
||||
)
|
||||
await interaction.showModal(modal)
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,33 +1,32 @@
|
||||
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")
|
||||
import { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder, GuildMember, GuildTextBasedChannel } from "discord.js"
|
||||
import { color } from "../../../config/options.json"
|
||||
import { largeM, smallM, ignM } from "../../../config/limitmessages.json"
|
||||
import { applicationsChannel } from "../../../config/options.json"
|
||||
import questions from "../../../config/questions.json"
|
||||
import { guildRole } from "../../../config/roles.json"
|
||||
import { getUUID } from "../../utils/Hypixel"
|
||||
import mongoose from "mongoose"
|
||||
import guildapp from "../../schemas/guildAppSchema"
|
||||
import { Button } from "../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
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 user = interaction.member as GuildMember
|
||||
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 userRoles = user.roles.cache.map(role => role.id)
|
||||
const guildQuestions = questions.guild
|
||||
|
||||
function qu(n) {
|
||||
function qu(n: number): string {
|
||||
return guildQuestions[n - 1].q
|
||||
}
|
||||
|
||||
function rq(n) {
|
||||
function rq(n: number): string {
|
||||
return guildQuestions[n - 1].r
|
||||
}
|
||||
|
||||
@@ -36,14 +35,14 @@ module.exports = {
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
if (userRoles.includes(guildRole)) {
|
||||
await interaction.editReply({ content: "You are already a member of the guild.", ephemeral: true })
|
||||
await interaction.editReply("You are already a member of the guild.")
|
||||
return
|
||||
}
|
||||
|
||||
const application = await guildapp.findOne({ userID: user.id })
|
||||
const application = await guildapp.findOne({ userID: user.user.id })
|
||||
|
||||
if (application) {
|
||||
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true })
|
||||
await interaction.editReply("You already have an application in progress.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -70,15 +69,14 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
} catch (error) {
|
||||
await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true })
|
||||
await interaction.editReply("Please enable your DMs.")
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({ content: "Please check your DMs.", ephemeral: true })
|
||||
await interaction.editReply("Please check your DMs.")
|
||||
|
||||
|
||||
const input = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const input = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60
|
||||
})
|
||||
@@ -86,11 +84,11 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (input.first().content.toLowerCase() !== "yes") {
|
||||
if (input.first()!.content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (input.first().attachments.size > 0) {
|
||||
if (input.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
@@ -106,8 +104,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer1 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer1 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5,
|
||||
})
|
||||
@@ -115,15 +113,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
||||
if (answer1.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().attachments.size > 0) {
|
||||
if (answer1.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().content > 16) {
|
||||
if (answer1.first()!.content.length > 16) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 16.",
|
||||
@@ -132,7 +130,7 @@ module.exports = {
|
||||
})
|
||||
return
|
||||
}
|
||||
const uuid = await getUUID(answer1.first().content)
|
||||
const uuid = await getUUID(answer1.first()!.content)
|
||||
if (!uuid) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
@@ -143,7 +141,7 @@ module.exports = {
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer1_1 = answer1.first().content
|
||||
const answer1_1 = answer1.first()!.content
|
||||
|
||||
// second question
|
||||
await user.send({
|
||||
@@ -156,8 +154,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer2 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer2 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -165,15 +163,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().content.toLowerCase() === "cancel") {
|
||||
if (answer2.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().attachments.size > 0) {
|
||||
if (answer2.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().content.size > 8) {
|
||||
if (answer2.first()!.content.length > 8) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 8.",
|
||||
@@ -182,7 +180,7 @@ module.exports = {
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer2_1 = answer2.first().content
|
||||
const answer2_1 = answer2.first()!.content
|
||||
|
||||
// third question
|
||||
await user.send({
|
||||
@@ -195,8 +193,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer3 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer3 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -204,15 +202,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().content.toLowerCase() === "cancel") {
|
||||
if (answer3.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().attachments.size > 0) {
|
||||
if (answer3.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().content > 128) {
|
||||
if (answer3.first()!.content.length > 128) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 128.",
|
||||
@@ -220,7 +218,7 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer3_1 = answer3.first().content
|
||||
const answer3_1 = answer3.first()!.content
|
||||
|
||||
// fourth question
|
||||
await user.send({
|
||||
@@ -234,8 +232,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer4 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer4 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -243,15 +241,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().content.toLowerCase() === "cancel") {
|
||||
if (answer4.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().attachments.size > 0) {
|
||||
if (answer4.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().content > 256) {
|
||||
if (answer4.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
@@ -259,7 +257,7 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer4_1 = answer4.first().content
|
||||
const answer4_1 = answer4.first()!.content
|
||||
|
||||
// fifth question
|
||||
await user.send({
|
||||
@@ -272,8 +270,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer5 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer5 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -281,15 +279,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().content.toLowerCase() === "cancel") {
|
||||
if (answer5.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().attachments.size > 0) {
|
||||
if (answer5.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().content > 128) {
|
||||
if (answer5.first()!.content.length > 128) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 128.",
|
||||
@@ -297,7 +295,7 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer5_1 = answer5.first().content
|
||||
const answer5_1 = answer5.first()!.content
|
||||
|
||||
// sixth question
|
||||
await user.send({
|
||||
@@ -310,8 +308,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer6 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer6 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -319,15 +317,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().content.toLowerCase() === "cancel") {
|
||||
if (answer6.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().attachments.size > 0) {
|
||||
if (answer6.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().content > 256) {
|
||||
if (answer6.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
@@ -335,7 +333,7 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer6_1 = answer6.first().content
|
||||
const answer6_1 = answer6.first()!.content
|
||||
|
||||
// seventh question
|
||||
await user.send({
|
||||
@@ -348,8 +346,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer7 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer7 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -357,15 +355,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer7.first().content.toLowerCase() === "cancel") {
|
||||
if (answer7.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer7.first().attachments.size > 0) {
|
||||
if (answer7.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer7.first().content > 128) {
|
||||
if (answer7.first()!.content.length > 128) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 128.",
|
||||
@@ -373,7 +371,7 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer7_1 = answer7.first().content
|
||||
const answer7_1 = answer7!.first()!.content
|
||||
|
||||
// eighth question
|
||||
await user.send({
|
||||
@@ -386,8 +384,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer8 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer8 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -395,15 +393,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer8.first().content.toLowerCase() === "cancel") {
|
||||
if (answer8.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer8.first().attachments.size > 0) {
|
||||
if (answer8.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer8.first().content > 64) {
|
||||
if (answer8.first()!.content.length > 64) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 64.",
|
||||
@@ -411,7 +409,7 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer8_1 = answer8.first().content
|
||||
const answer8_1 = answer8.first()!.content
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
@@ -420,8 +418,8 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
|
||||
const final = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const final = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
@@ -429,11 +427,11 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (final.first().content.toLowerCase() !== "yes") {
|
||||
if (final.first()!.content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (final.first().attachments.size > 0) {
|
||||
if (final.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
@@ -447,19 +445,19 @@ module.exports = {
|
||||
|
||||
const newGuildApp = new guildapp({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
userID: user.id,
|
||||
userID: user.user.id,
|
||||
uuid: uuid,
|
||||
})
|
||||
|
||||
await newGuildApp.save()
|
||||
|
||||
const channel = guild.channels.cache.get(applicationsChannel)
|
||||
const channel = guild.channels.cache.get(applicationsChannel) as GuildTextBasedChannel
|
||||
await channel.send({
|
||||
embeds: [{
|
||||
title: user.username + "#" + user.discriminator + " - Guild Application",
|
||||
title: user.user.username + "#" + user.user.discriminator + " - Guild Application",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user.avatarURL()
|
||||
url: user.avatarURL() || guild.iconURL()!
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
@@ -496,12 +494,12 @@ module.exports = {
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
iconURL: guild.iconURL(),
|
||||
text: "ID: " + user.id
|
||||
icon_url: guild.iconURL()!,
|
||||
text: "ID: " + user.user.id
|
||||
}
|
||||
}],
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("guildapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
@@ -520,4 +518,4 @@ module.exports = {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,8 +1,9 @@
|
||||
const { ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder } = require("discord.js")
|
||||
const { gm, manager, moderator, beast, member, 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")
|
||||
import { ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder, GuildMember, GuildTextBasedChannel } from "discord.js"
|
||||
import { gm, manager, moderator, beast, member, guildStaff, guildRole } from "../../../config/roles.json"
|
||||
import { ignM, smallM, largeM } from "../../../config/limitmessages.json"
|
||||
import { inactivity } from "../../../config/questions.json"
|
||||
import { color, inactivityLogChannel } from "../../../config/options.json"
|
||||
import { Button } from "../../interfaces"
|
||||
const guildRoles = [gm, manager, moderator, beast, member, guildStaff, guildRole]
|
||||
|
||||
module.exports = {
|
||||
@@ -10,13 +11,11 @@ module.exports = {
|
||||
description: "Configure the bot.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
const guild = interaction.guild
|
||||
const user = interaction.user
|
||||
const guild = interaction.guild!
|
||||
const user = interaction.member as GuildMember
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
const userRoles = guild.members.cache.get(user.id).roles.cache
|
||||
const userRoles = user.roles.cache
|
||||
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"
|
||||
|
||||
if (!userRoles.some((role) => guildRoles.includes(role.id))) {
|
||||
@@ -26,6 +25,14 @@ module.exports = {
|
||||
})
|
||||
}
|
||||
|
||||
function sq(n: number): string {
|
||||
return inactivity[n - 1].q
|
||||
}
|
||||
|
||||
function rq(n: number): string {
|
||||
return inactivity[n - 1].r
|
||||
}
|
||||
|
||||
const tooLong = new EmbedBuilder()
|
||||
.setDescription("You took too long to respond.")
|
||||
.setColor(embedColor)
|
||||
@@ -53,12 +60,12 @@ module.exports = {
|
||||
|
||||
await interaction.reply({ content: "Please check your DMs.", ephemeral: true })
|
||||
|
||||
const input = await user.dmChannel.awaitMessages({
|
||||
filter: (m) => m.author.id === user.id,
|
||||
const input = await user.dmChannel!.awaitMessages({
|
||||
filter: (m) => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60
|
||||
})
|
||||
if (input.first().attachments.size > 0) {
|
||||
if (input.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
@@ -66,7 +73,7 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (input.first().content.toLowerCase() !== "yes") {
|
||||
if (input.first()!.content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
@@ -74,7 +81,7 @@ module.exports = {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
title: "**Question 1**",
|
||||
description: ia1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
|
||||
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."
|
||||
@@ -82,16 +89,16 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
|
||||
const answer1 = await user.dmChannel.awaitMessages({
|
||||
filter: (m) => m.author.id === user.id,
|
||||
const answer1 = await user.dmChannel!.awaitMessages({
|
||||
filter: (m) => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
if (answer1.first().attachments.size > 0) {
|
||||
if (answer1.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().content > 16) {
|
||||
if (answer1.first()!.content.length > 16) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 16.",
|
||||
@@ -101,7 +108,7 @@ module.exports = {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await fetch(mojangAPI + answer1.first().content)
|
||||
await fetch(mojangAPI + answer1.first()!.content)
|
||||
} catch (error) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
@@ -115,32 +122,32 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
||||
if (answer1.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
const answer1_1 = answer1.first().content
|
||||
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 + "`",
|
||||
description: sq(2) + "\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,
|
||||
const answer2 = await user.dmChannel!.awaitMessages({
|
||||
filter: (m) => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
if (answer2.first().attachments.size > 0) {
|
||||
if (answer2.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().content > 128) {
|
||||
if (answer2.first()!.content.length > 128) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 128.",
|
||||
@@ -153,32 +160,32 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
||||
if (answer1.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
const answer2_1 = answer1.first().content
|
||||
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 + "`",
|
||||
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,
|
||||
const answer3 = await user.dmChannel!.awaitMessages({
|
||||
filter: (m) => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer3.first().attachments.size > 0) {
|
||||
if (answer3.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().content > 256) {
|
||||
if (answer3.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256",
|
||||
@@ -191,11 +198,11 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
||||
if (answer1.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
const answer3_1 = answer1.first().content
|
||||
const answer3_1 = answer1.first()!.content
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
@@ -203,12 +210,12 @@ module.exports = {
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
const final = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const final = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
if (final.first().attachments.size > 0) {
|
||||
if (final.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
@@ -216,7 +223,7 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (final.first().content.toLowerCase() !== "yes") {
|
||||
if (final.first()!.content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
@@ -228,36 +235,36 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
|
||||
const appChannel = await guild.channels.cache.get(inactivityLogChannel)
|
||||
const appChannel = guild.channels.cache.get(inactivityLogChannel) as GuildTextBasedChannel
|
||||
|
||||
await appChannel.send({
|
||||
embeds: [{
|
||||
title: user.username + "#" + user.discriminator + " - Inactivity Application",
|
||||
title: user.user.username + "#" + user.user.discriminator + " - Inactivity Application",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user.displayAvatarURL({ dynamic: true })
|
||||
url: user.displayAvatarURL({ forceStatic: false })
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: ria1,
|
||||
name: rq(1),
|
||||
value: "`" + answer1_1 + "`"
|
||||
},
|
||||
{
|
||||
name: ria2,
|
||||
name: rq(2),
|
||||
value: "`" + answer2_1 + "`"
|
||||
},
|
||||
{
|
||||
name: ria3,
|
||||
name: rq(3),
|
||||
value: "`" + answer3_1 + "`"
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
icon_url: user.displayAvatarURL({ dynamic: true }),
|
||||
text: "ID: " + user.id
|
||||
icon_url: user.displayAvatarURL({ forceStatic: false }),
|
||||
text: "ID: " + user.user.id
|
||||
}
|
||||
}],
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("inactiveapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
@@ -270,4 +277,4 @@ module.exports = {
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,13 +1,13 @@
|
||||
module.exports = {
|
||||
import { Button } from "../../interfaces"
|
||||
|
||||
export = {
|
||||
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 })
|
||||
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,13 +1,13 @@
|
||||
module.exports = {
|
||||
import { Button } from "../../interfaces"
|
||||
|
||||
export = {
|
||||
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 })
|
||||
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,23 +1,23 @@
|
||||
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
|
||||
const { color } = require("../../../config/options.json")
|
||||
const staffapp = require("../../schemas/staffAppSchema.js")
|
||||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"
|
||||
import { color } from "../../../config/options.json"
|
||||
import staffapp from "../../schemas/staffAppSchema"
|
||||
import { Button } from "../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
name: "staffapplicationaccept",
|
||||
description: "Accept a staff application.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.user
|
||||
const guild = interaction.guild
|
||||
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 applicantId = embed.footer!.text.split(" ")[1]
|
||||
|
||||
const applicant = await guild.members.fetch(applicantId)
|
||||
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator
|
||||
@@ -31,7 +31,7 @@ module.exports = {
|
||||
|
||||
await message.edit({
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("staffapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
@@ -46,22 +46,21 @@ module.exports = {
|
||||
]
|
||||
})
|
||||
|
||||
await staffapp.findOneAndDelete({ userId: applicantId })
|
||||
await staffapp.findOneAndDelete({ userID: applicantId })
|
||||
|
||||
await interaction.reply({
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: applicantUsername + " - Staff Application.",
|
||||
description: "Application accepted by <@" + user.id + ">.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL()
|
||||
url: applicant.avatarURL()!
|
||||
},
|
||||
footer: {
|
||||
iconurl: guild.iconURL(),
|
||||
icon_url: guild.iconURL()!,
|
||||
text: "ID: " + applicantId
|
||||
}
|
||||
}]
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,19 +1,18 @@
|
||||
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js")
|
||||
import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"
|
||||
import { Button } from "../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
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 ActionRowBuilder<TextInputBuilder>().setComponents(
|
||||
new TextInputBuilder()
|
||||
.setLabel("Deny Reason")
|
||||
.setCustomId("staffdenyreason")
|
||||
@@ -24,4 +23,4 @@ module.exports = {
|
||||
)
|
||||
await interaction.showModal(modal)
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,36 +1,35 @@
|
||||
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
|
||||
import { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder, GuildMember, GuildTextBasedChannel } from "discord.js"
|
||||
import { color, staffApplicationsChannel } from "../../../config/options.json"
|
||||
import { largeM, ignM } from "../../../config/limitmessages.json"
|
||||
import questions from "../../../config/questions.json"
|
||||
import { guildRole, guildStaff } from "../../../config/roles.json"
|
||||
import mongoose from "mongoose"
|
||||
import staffapp from "../../schemas/staffAppSchema"
|
||||
import settings from "../../schemas/settingsSchema"
|
||||
import { getUUID } from "../../utils/Hypixel"
|
||||
import { Button } from "../../interfaces"
|
||||
import config from "../../utils/Config"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
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 user = interaction.member as GuildMember
|
||||
const guild = interaction.guild!
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
const userRoles = interaction.member.roles.cache
|
||||
const userRoles = user.roles.cache
|
||||
const setting = await settings.findOne({ name: "staffAppStatus" })
|
||||
const status = setting.value
|
||||
const status = setting!.value || "0"
|
||||
const staffQuestions = questions.staff
|
||||
|
||||
function sq(n) {
|
||||
function sq(n: number): string {
|
||||
return staffQuestions[n - 1].q
|
||||
}
|
||||
|
||||
function rq(n) {
|
||||
function rq(n: number): string {
|
||||
return staffQuestions[n - 1].r
|
||||
}
|
||||
|
||||
@@ -38,27 +37,27 @@ module.exports = {
|
||||
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
if (user.id !== dev) {
|
||||
if (user.user.id !== config.prod.dev) {
|
||||
if (status === "0") {
|
||||
await interaction.editReply({ content: "Staff applications are currently closed.", ephemeral: true })
|
||||
await interaction.editReply("Staff applications are currently closed.")
|
||||
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(guildRole)) {
|
||||
// await interaction.editReply("You must be a member of the guild to apply for staff.")
|
||||
// return
|
||||
// }
|
||||
|
||||
if (userRoles.has(guildStaff)) {
|
||||
await interaction.editReply({ content: "You are already a staff member.", ephemeral: true })
|
||||
return
|
||||
}
|
||||
// if (userRoles.has(guildStaff)) {
|
||||
// await interaction.editReply("You are already a staff member.")
|
||||
// return
|
||||
// }
|
||||
|
||||
const application = await staffapp.findOne({ userID: user.id })
|
||||
const application = await staffapp.findOne({ userID: user.user.id })
|
||||
|
||||
if (application) {
|
||||
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true })
|
||||
await interaction.editReply("You already have an application in progress.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -85,14 +84,14 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
} catch (error) {
|
||||
await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true })
|
||||
await interaction.editReply("Please enable your DMs.")
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({ content: "Please check your DMs.", ephemeral: true })
|
||||
await interaction.editReply("Please check your DMs.")
|
||||
|
||||
const input = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const input = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60
|
||||
})
|
||||
@@ -100,11 +99,11 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (input.first().content.toLowerCase() !== "yes") {
|
||||
if (input.first()!.content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (input.first().attachments.size > 0) {
|
||||
if (input.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
@@ -120,8 +119,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer1 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer1 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5,
|
||||
})
|
||||
@@ -129,15 +128,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
||||
if (answer1.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().attachments.size > 0) {
|
||||
if (answer1.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer1.first().content > 16) {
|
||||
if (answer1.first()!.content.length > 16) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 16.",
|
||||
@@ -146,7 +145,7 @@ module.exports = {
|
||||
})
|
||||
return
|
||||
}
|
||||
const uuid = await getUUID(answer1.first().content)
|
||||
const uuid = await getUUID(answer1.first()!.content)
|
||||
if (!uuid) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
@@ -157,7 +156,7 @@ module.exports = {
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer1_1 = answer1.first().content
|
||||
const answer1_1 = answer1.first()!.content
|
||||
|
||||
// second question
|
||||
await user.send({
|
||||
@@ -170,8 +169,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer2 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer2 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -179,15 +178,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().content.toLowerCase() === "cancel") {
|
||||
if (answer2.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().attachments.size > 0) {
|
||||
if (answer2.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer2.first().content > 64) {
|
||||
if (answer2.first()!.content.length > 64) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 64.",
|
||||
@@ -196,7 +195,7 @@ module.exports = {
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer2_1 = answer2.first().content
|
||||
const answer2_1 = answer2.first()!.content
|
||||
|
||||
// third question
|
||||
await user.send({
|
||||
@@ -209,8 +208,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer3 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer3 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -218,15 +217,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().content.toLowerCase() === "cancel") {
|
||||
if (answer3.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().attachments.size > 0) {
|
||||
if (answer3.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer3.first().content > 256) {
|
||||
if (answer3.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
@@ -234,7 +233,7 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer3_1 = answer3.first().content
|
||||
const answer3_1 = answer3.first()!.content
|
||||
|
||||
// fourth question
|
||||
await user.send({
|
||||
@@ -247,8 +246,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer4 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer4 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -256,15 +255,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().content.toLowerCase() === "cancel") {
|
||||
if (answer4.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().attachments.size > 0) {
|
||||
if (answer4.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer4.first().content > 256) {
|
||||
if (answer4.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
@@ -272,7 +271,7 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer4_1 = answer4.first().content
|
||||
const answer4_1 = answer4.first()!.content
|
||||
|
||||
// fifth question
|
||||
await user.send({
|
||||
@@ -285,8 +284,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer5 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer5 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -294,15 +293,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().content.toLowerCase() === "cancel") {
|
||||
if (answer5.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().attachments.size > 0) {
|
||||
if (answer5.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer5.first().content > 256) {
|
||||
if (answer5.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
@@ -310,7 +309,7 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer5_1 = answer5.first().content
|
||||
const answer5_1 = answer5.first()!.content
|
||||
|
||||
// sixth question
|
||||
await user.send({
|
||||
@@ -324,8 +323,8 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer6 = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const answer6 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
@@ -333,15 +332,15 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().content.toLowerCase() === "cancel") {
|
||||
if (answer6.first()!.content.toLowerCase() === "cancel") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().attachments.size > 0) {
|
||||
if (answer6.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
if (answer6.first().content > 256) {
|
||||
if (answer6.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
@@ -349,7 +348,7 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer6_1 = answer6.first().content
|
||||
const answer6_1 = answer6.first()!.content
|
||||
|
||||
await user.send({
|
||||
embeds: [{
|
||||
@@ -358,8 +357,8 @@ module.exports = {
|
||||
}]
|
||||
})
|
||||
|
||||
const final = await user.dmChannel.awaitMessages({
|
||||
filter: m => m.author.id === user.id,
|
||||
const final = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
@@ -367,11 +366,11 @@ module.exports = {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
return
|
||||
}
|
||||
if (final.first().content.toLowerCase() !== "yes") {
|
||||
if (final.first()!.content.toLowerCase() !== "yes") {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (final.first().attachments.size > 0) {
|
||||
if (final.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
return
|
||||
}
|
||||
@@ -385,21 +384,21 @@ module.exports = {
|
||||
|
||||
const newStaffApp = new staffapp({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
userID: user.id,
|
||||
userID: user.user.id,
|
||||
uuid: uuid,
|
||||
})
|
||||
|
||||
await newStaffApp.save()
|
||||
await user.deleteDM()
|
||||
|
||||
const channel = guild.channels.cache.get(staffApplicationsChannel)
|
||||
const channel = guild.channels.cache.get(staffApplicationsChannel) as GuildTextBasedChannel
|
||||
|
||||
await channel.send({
|
||||
embeds: [{
|
||||
title: user.username + "#" + user.discriminator + " - Staff Application",
|
||||
title: user.user.username + "#" + user.user.discriminator + " - Staff Application",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user.avatarURL()
|
||||
url: user.avatarURL() || guild.iconURL()!
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
@@ -429,12 +428,12 @@ module.exports = {
|
||||
|
||||
],
|
||||
footer: {
|
||||
iconURL: guild.iconURL(),
|
||||
text: "ID: " + user.id
|
||||
icon_url: guild.iconURL()!,
|
||||
text: "ID: " + user.user.id
|
||||
}
|
||||
}],
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("staffapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
@@ -448,4 +447,4 @@ module.exports = {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,19 +1,18 @@
|
||||
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js")
|
||||
import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"
|
||||
import { Button } from "../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
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 ActionRowBuilder<TextInputBuilder>().setComponents(
|
||||
new TextInputBuilder()
|
||||
.setLabel("IGN")
|
||||
.setCustomId("verifyign")
|
||||
@@ -26,4 +25,4 @@ module.exports = {
|
||||
)
|
||||
await interaction.showModal(modal)
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,14 +1,13 @@
|
||||
const waitinglist = require("../../schemas/waitinglistSchema.js")
|
||||
const { getGuild } = require("../../utils/utils.js")
|
||||
const { hypixelGuildID } = require("../../../config/options.json")
|
||||
import waitinglist from "../../schemas/waitinglistSchema"
|
||||
import { getGuild } from "../../utils/Hypixel"
|
||||
import { hypixelGuildID } from "../../../config/options.json"
|
||||
import { Button } from "../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
name: "waitinglistupdate",
|
||||
description: "Update the waiting list.",
|
||||
type: "button",
|
||||
|
||||
/** @param {import('discord.js').ButtonInteraction} interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
@@ -34,8 +33,7 @@ module.exports = {
|
||||
|
||||
for (let i = 0; i < accepted.length; i++) {
|
||||
|
||||
const timestamp1 = accepted[i].timestamp / 1000
|
||||
const timestamp = Math.floor(timestamp1)
|
||||
const timestamp = Math.floor(accepted[i].timestamp / 1000)
|
||||
|
||||
fields.push({
|
||||
name: `${i + 1}. ${accepted[i].IGN}`,
|
||||
@@ -45,19 +43,19 @@ module.exports = {
|
||||
|
||||
await message.edit({
|
||||
embeds: [{
|
||||
title: embed.title,
|
||||
description: embed.description,
|
||||
color: embed.color,
|
||||
title: embed.title!,
|
||||
description: embed.description!,
|
||||
color: embed.color!,
|
||||
footer: {
|
||||
text: "Last updated by " + user.username,
|
||||
icon_url: user.avatarURL(),
|
||||
icon_url: user.avatarURL()!,
|
||||
},
|
||||
thumbnail: embed.thumbnail,
|
||||
thumbnail: embed.thumbnail!,
|
||||
fields: fields,
|
||||
timestamp: new Date(),
|
||||
timestamp: new Date().toISOString(),
|
||||
}],
|
||||
})
|
||||
|
||||
await interaction.editReply({ content: "Updated the waiting list", ephemeral: true })
|
||||
await interaction.editReply("Updated the waiting list")
|
||||
}
|
||||
}
|
||||
} as Button
|
||||
@@ -1,28 +1,27 @@
|
||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
|
||||
const { color } = require("../../../config/options.json")
|
||||
const guildapp = require("../../schemas/guildAppSchema.js")
|
||||
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, Message, GuildMember } from "discord.js"
|
||||
import { color } from "../../../config/options.json"
|
||||
import guildapp from "../../schemas/guildAppSchema"
|
||||
import { Modal } from "../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
name: "denyreasonbox",
|
||||
description: "Deny reason box.",
|
||||
type: "modal",
|
||||
|
||||
/** @param { import('discord.js').ModalSubmitInteraction } interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const guild = interaction.guild
|
||||
const message = interaction.message
|
||||
const guild = interaction.guild!
|
||||
const message = interaction.message as Message
|
||||
const embed = message.embeds[0]
|
||||
const applicantId = embed.footer.text.split(" ")[1]
|
||||
const applicantId = embed.footer!.text.split(" ")[1]
|
||||
|
||||
const reason = interaction.fields.fields.get("denyreason").value || "No reason provided"
|
||||
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 ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("guildapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
@@ -42,7 +41,7 @@ module.exports = {
|
||||
]
|
||||
})
|
||||
|
||||
let applicant = ""
|
||||
let applicant: GuildMember | null
|
||||
try {
|
||||
applicant = await guild.members.fetch(applicantId)
|
||||
} catch (error) {
|
||||
@@ -65,7 +64,7 @@ module.exports = {
|
||||
.setColor(embedColor)
|
||||
.setThumbnail(guild.iconURL())
|
||||
.setFooter({
|
||||
iconURL: guild.iconURL(),
|
||||
iconURL: guild.iconURL()!,
|
||||
text: "ID: " + applicantId
|
||||
})
|
||||
|
||||
@@ -73,7 +72,7 @@ module.exports = {
|
||||
await applicant.send({ embeds: [dmMessage] })
|
||||
}
|
||||
|
||||
let responseEmbeds = ""
|
||||
let responseEmbeds: EmbedBuilder[]
|
||||
if (applicant === null) {
|
||||
responseEmbeds = [responseEmbed, missingUser]
|
||||
} else {
|
||||
@@ -86,4 +85,4 @@ module.exports = {
|
||||
embeds: responseEmbeds
|
||||
})
|
||||
}
|
||||
}
|
||||
} as Modal
|
||||
@@ -1,29 +1,28 @@
|
||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js")
|
||||
const { color } = require("../../../config/options.json")
|
||||
const staffapp = require("../../schemas/staffAppSchema.js")
|
||||
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"
|
||||
import { color } from "../../../config/options.json"
|
||||
import staffapp from "../../schemas/staffAppSchema"
|
||||
import { Modal } from "../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
name: "staffdenyreasonbox",
|
||||
description: "Deny reason box.",
|
||||
type: "modal",
|
||||
|
||||
/** @param { import('discord.js').ModalSubmitInteraction } interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const guild = interaction.guild
|
||||
const reason = interaction.fields.fields.get("staffdenyreason").value || "No reason provided"
|
||||
const reason = interaction.fields.fields.get("staffdenyreason")!.value || "No reason provided"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
const message = interaction.message
|
||||
const message = interaction.message!
|
||||
const embed = message.embeds[0]
|
||||
const applicantId = embed.footer.text.split(" ")[1]
|
||||
const applicant = await guild.members.fetch(applicantId)
|
||||
const applicantId = embed.footer!.text.split(" ")[1]
|
||||
const applicant = await guild!.members.fetch(applicantId)
|
||||
|
||||
await message.edit({
|
||||
components: [
|
||||
new ActionRowBuilder().addComponents(
|
||||
new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("staffapplicationaccept")
|
||||
.setLabel("Accept")
|
||||
@@ -54,13 +53,13 @@ module.exports = {
|
||||
"**Reason:** `" + reason + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL()
|
||||
url: applicant.avatarURL() || guild!.iconURL()!
|
||||
},
|
||||
footer: {
|
||||
iconURL: guild.iconURL(),
|
||||
icon_url: guild!.iconURL()!,
|
||||
text: "ID: " + applicant.id
|
||||
}
|
||||
}],
|
||||
})
|
||||
}
|
||||
}
|
||||
} as Modal
|
||||
@@ -1,24 +1,24 @@
|
||||
const { getUUID, getPlayer, getGuild, getHeadURL } = require("../../utils/utils.js")
|
||||
const { color, hypixelGuildID, devMessage } = require("../../../config/options.json")
|
||||
const verify = require("../../schemas/verifySchema.js")
|
||||
const mongoose = require("mongoose")
|
||||
const { gm, manager, moderator, beast, elite, member, guildRole, guildStaff, defaultMember } = require("../../../config/roles.json")
|
||||
import { getUUID, getPlayer, getGuild, getHeadURL } from "../../utils/Hypixel"
|
||||
import { color, hypixelGuildID, devMessage } from "../../../config/options.json"
|
||||
import verify from "../../schemas/verifySchema"
|
||||
import mongoose from "mongoose"
|
||||
import { gm, manager, moderator, beast, elite, member, guildRole, guildStaff, defaultMember } from "../../../config/roles.json"
|
||||
import { Modal } from "../../interfaces"
|
||||
import { GuildMember } from "discord.js"
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
name: "verifybox",
|
||||
description: "Verify box.",
|
||||
type: "modal",
|
||||
|
||||
/** @param { import('discord.js').ModalSubmitInteraction } interaction */
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
const user1 = interaction.user
|
||||
const user = interaction.guild.members.cache.get(user1.id)
|
||||
const ign = interaction.fields.fields.get("verifyign").value
|
||||
const user = interaction.member as GuildMember
|
||||
const ign = interaction.fields.fields.get("verifyign")!.value
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
const verifyData = await verify.findOne({ userID: user.id })
|
||||
const verifyData = await verify.findOne({ userID: user.user.id })
|
||||
if (verifyData) {
|
||||
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
|
||||
return
|
||||
@@ -48,10 +48,10 @@ module.exports = {
|
||||
}
|
||||
|
||||
let username = ""
|
||||
if (user1.discriminator === "0") {
|
||||
username = user1.username
|
||||
if (user.user.discriminator === "0") {
|
||||
username = user.user.username
|
||||
} else {
|
||||
username = user1.username + "#" + user1.discriminator
|
||||
username = user.user.username + "#" + user.user.discriminator
|
||||
}
|
||||
|
||||
const linkedDiscord = player?.socialMedia?.links?.DISCORD
|
||||
@@ -82,7 +82,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
let guildID = ""
|
||||
let guildID: string | null
|
||||
if (!guild) {
|
||||
guildID = null
|
||||
} else {
|
||||
@@ -90,8 +90,8 @@ module.exports = {
|
||||
}
|
||||
|
||||
if (guildID === hypixelGuildID) {
|
||||
const GuildMembers = guild.members
|
||||
const guildRank = GuildMembers.find((member) => member.uuid === player.uuid).rank
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find((member) => member.uuid === player.uuid)!.rank
|
||||
|
||||
if (guildRank === "Guild Master" && guildID === hypixelGuildID) {
|
||||
await user.roles.add(gm, "Verification")
|
||||
@@ -139,15 +139,15 @@ module.exports = {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: interaction.guild.name,
|
||||
title: interaction.guild!.name,
|
||||
description: "You have successfully verified `" + username + "` with the account `" + player.displayname + "`.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head
|
||||
url: head!
|
||||
},
|
||||
footer: {
|
||||
icon_url: interaction.guild.iconURL(),
|
||||
text: interaction.guild.name + " | " + devMessage
|
||||
icon_url: interaction.guild!.iconURL()!,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -155,4 +155,4 @@ module.exports = {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} as Modal
|
||||
@@ -1,14 +1,14 @@
|
||||
const { userMention } = require("discord.js")
|
||||
const { color, botLogChannel } = require("../../../../config/options.json")
|
||||
import { ChannelType, GuildMember, userMention } from "discord.js"
|
||||
import { color, botLogChannel } from "../../../../config/options.json"
|
||||
import { Event } from "../../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
const event: Event = {
|
||||
name: "logNewJoins",
|
||||
description: "Logs new joins",
|
||||
type: "event",
|
||||
event: "guildMemberAdd",
|
||||
|
||||
/** @param { import('discord.js').GuildMember } member */
|
||||
execute(member) {
|
||||
execute(member: GuildMember) {
|
||||
|
||||
const channel = member.guild.channels.cache.get(botLogChannel)
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
@@ -18,6 +18,11 @@ module.exports = {
|
||||
return
|
||||
}
|
||||
|
||||
if (channel.type !== ChannelType.GuildText) {
|
||||
console.log("[ERROR] The channel used for new join logging is not a text channel.")
|
||||
return
|
||||
}
|
||||
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "New Member",
|
||||
@@ -27,9 +32,11 @@ module.exports = {
|
||||
footer: {
|
||||
text: "ID: " + member.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,12 +1,13 @@
|
||||
module.exports = {
|
||||
import { ChatInputCommandInteraction, ButtonInteraction } from "discord.js"
|
||||
import { Event } from "../../../interfaces"
|
||||
|
||||
const event: Event = {
|
||||
name: "logBtnsCmds",
|
||||
description: "Logs all button and command interactions",
|
||||
type: "event",
|
||||
event: "interactionCreate",
|
||||
|
||||
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
|
||||
|
||||
execute(interaction) {
|
||||
execute(interaction: ChatInputCommandInteraction | ButtonInteraction) {
|
||||
if (interaction.isCommand()) {
|
||||
try {
|
||||
console.log(interaction.user.username + " ran " +
|
||||
@@ -18,11 +19,16 @@ module.exports = {
|
||||
interaction.commandName
|
||||
)
|
||||
}
|
||||
} else if (interaction.isButton()) {
|
||||
}
|
||||
|
||||
if (interaction.isButton()) {
|
||||
console.log(interaction.user.username + "#" +
|
||||
interaction.user.discriminator + " clicked " +
|
||||
interaction.customId
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,14 +1,17 @@
|
||||
module.exports = {
|
||||
import { Event } from "../../../interfaces"
|
||||
import { Message } from "discord.js"
|
||||
|
||||
const event: Event = {
|
||||
name: "ur mom",
|
||||
description: "ur moms someone",
|
||||
type: "event",
|
||||
event: "messageCreate",
|
||||
|
||||
/** @param { import('discord.js').Message } message */
|
||||
|
||||
async execute(message) {
|
||||
async execute(message: Message) {
|
||||
if (message.content.toLowerCase().includes("ur mom") && message.author.username === "taken.lua") {
|
||||
message.react("Woot:734345936347725885")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,11 +0,0 @@
|
||||
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 + "!")
|
||||
}
|
||||
}
|
||||
15
src/events/server/ready/consolelog.ts
Normal file
15
src/events/server/ready/consolelog.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Event } from "../../../interfaces"
|
||||
import { ExtendedClient as Client } from "../../../utils/Client"
|
||||
|
||||
const event: Event = {
|
||||
name: "conolelog",
|
||||
description: "console log",
|
||||
type: "event",
|
||||
event: "ready",
|
||||
|
||||
execute(client: Client) {
|
||||
console.log("Logged in as " + client.user!.tag + "!")
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,12 +1,15 @@
|
||||
const { onlineLogChannel, color } = require("../../../../config/options.json")
|
||||
import { onlineLogChannel, color } from "../../../../config/options.json"
|
||||
import { Event } from "../../../interfaces"
|
||||
import { ExtendedClient as Client } from "../../../utils/Client"
|
||||
import { ChannelType } from "discord.js"
|
||||
|
||||
module.exports = {
|
||||
const event: Event = {
|
||||
name: "sendonlinemessage",
|
||||
description: "send an online message",
|
||||
type: "event",
|
||||
event: "ready",
|
||||
|
||||
execute(client) {
|
||||
execute(client: Client) {
|
||||
if (process.env.NODE_ENV === "dev") return
|
||||
|
||||
const channel = client.channels.cache.get(onlineLogChannel)
|
||||
@@ -17,6 +20,11 @@ module.exports = {
|
||||
return
|
||||
}
|
||||
|
||||
if (channel.type !== ChannelType.GuildText) {
|
||||
console.log("[ERROR] Online message channel is not a text channel.")
|
||||
return
|
||||
}
|
||||
|
||||
channel.send({
|
||||
embeds: [{
|
||||
description: "Bot is online!",
|
||||
@@ -25,3 +33,5 @@ module.exports = {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,14 +1,14 @@
|
||||
const statuses = require("../../../../config/statuses.json")
|
||||
import statuses = require("../../../../config/statuses.json")
|
||||
import { Event } from "../../../interfaces"
|
||||
import { ExtendedClient as Client } from "../../../utils/Client"
|
||||
|
||||
module.exports = {
|
||||
const event: Event = {
|
||||
name: "status",
|
||||
description: "Sets the status of the bot",
|
||||
type: "event",
|
||||
event: "ready",
|
||||
|
||||
/** @param { import('discord.js').Client } client */
|
||||
|
||||
execute(client) {
|
||||
execute(client: Client) {
|
||||
|
||||
// Playing 0
|
||||
// Streaming 1
|
||||
@@ -17,18 +17,22 @@ module.exports = {
|
||||
// Custom 4
|
||||
// Competing 5
|
||||
|
||||
client.user.setActivity(
|
||||
const user = client.user!
|
||||
|
||||
user.setActivity(
|
||||
{ name: statuses[0].name, type: statuses[0].type }
|
||||
)
|
||||
|
||||
let i = 1
|
||||
setInterval(() =>
|
||||
client.user.setActivity(
|
||||
statuses[i, i++ % statuses.length]
|
||||
user.setActivity(
|
||||
statuses[i++ % statuses.length]
|
||||
),
|
||||
1000 * 60 * 10
|
||||
)
|
||||
|
||||
client.user.setStatus("dnd")
|
||||
user.setStatus("dnd")
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
@@ -1,20 +1,16 @@
|
||||
const { userMention, channelMention } = require("discord.js")
|
||||
const { botLogChannel, color } = require("../../../../config/options.json")
|
||||
import { userMention, channelMention, VoiceState, ChannelType } from "discord.js"
|
||||
import { botLogChannel, color } from "../../../../config/options.json"
|
||||
import { Event } from "../../../interfaces"
|
||||
|
||||
module.exports = {
|
||||
const event: Event = {
|
||||
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: VoiceState, newState: VoiceState) {
|
||||
|
||||
execute(oldState, newState) {
|
||||
|
||||
// if (process.env.NODE_ENV === 'dev') return
|
||||
if (process.env.NODE_ENV === 'dev') return
|
||||
|
||||
const guild = oldState.guild
|
||||
const channel = guild.channels.cache.get(botLogChannel)
|
||||
@@ -25,6 +21,11 @@ module.exports = {
|
||||
return
|
||||
}
|
||||
|
||||
if (channel.type !== ChannelType.GuildText) {
|
||||
console.log("[ERROR] The channel used for voice channel join/leave logging is not a text channel.")
|
||||
return
|
||||
}
|
||||
|
||||
const oldChannel = oldState.channel
|
||||
const newChannel = newState.channel
|
||||
|
||||
@@ -33,14 +34,14 @@ module.exports = {
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "Voice Channel Join",
|
||||
description: userMention(oldState.member.id) +
|
||||
description: userMention(newState.member!.id) +
|
||||
" joined " +
|
||||
channelMention(newChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member.id
|
||||
text: "ID: " + newState.member!.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
@@ -49,14 +50,14 @@ module.exports = {
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "Voice Channel Leave",
|
||||
description: userMention(oldState.member.id) +
|
||||
description: userMention(oldState.member!.id) +
|
||||
" left " +
|
||||
channelMention(oldChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member.id
|
||||
text: "ID: " + oldState.member!.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
@@ -67,16 +68,16 @@ module.exports = {
|
||||
channel.send({
|
||||
embeds: [{
|
||||
title: "Voice Channel Switch",
|
||||
description: userMention(oldState.member.id) +
|
||||
description: userMention(oldState.member!.id) +
|
||||
" switched from " +
|
||||
channelMention(oldChannel.id) +
|
||||
" to " +
|
||||
channelMention(newChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member.id
|
||||
text: "ID: " + oldState.member!.id
|
||||
},
|
||||
timestamp: new Date()
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
@@ -84,3 +85,5 @@ module.exports = {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export = event
|
||||
Reference in New Issue
Block a user