Replaced clang format with prettuier (sadly)
This commit is contained in:
@@ -6,28 +6,32 @@ import fs = require("fs")
|
||||
|
||||
function loadModalEvents(client: Client) {
|
||||
const modalPath = path.join(__dirname, "..", "..", "events", "modals")
|
||||
const modalFiles = fs.readdirSync(modalPath).filter(file => file.endsWith(".js"))
|
||||
const modalFiles = fs
|
||||
.readdirSync(modalPath)
|
||||
.filter(file => file.endsWith(".js"))
|
||||
|
||||
for (const file of modalFiles) {
|
||||
|
||||
const filePath = path.join(modalPath, file)
|
||||
const modal: Modal = require(filePath)
|
||||
|
||||
if ("name" in modal && "execute" in modal && modal.type === "modal") {
|
||||
client.modals.set(modal.name, modal)
|
||||
} else {
|
||||
console.log(`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`)
|
||||
console.log(
|
||||
`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
client.on(Events.InteractionCreate, async interaction => {
|
||||
if (!interaction.isModalSubmit())
|
||||
return
|
||||
if (!interaction.isModalSubmit()) return
|
||||
|
||||
const modal = client.modals.get(interaction.customId)
|
||||
|
||||
if (!modal) {
|
||||
console.error(`No modal matching ${interaction.customId} was found.`)
|
||||
console.error(
|
||||
`No modal matching ${interaction.customId} was found.`,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -37,7 +41,7 @@ function loadModalEvents(client: Client) {
|
||||
console.error(error)
|
||||
await interaction.reply({
|
||||
content: "There was an error while executing this modal!",
|
||||
ephemeral: true
|
||||
ephemeral: true,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user