#help

1 messages · Page 1 of 1 (latest)

twilit jungle
#

can ya help me

jovial nacelle
#

fetch all commands with await client.application.commands.fetch()

#

that returns a Collection of commands

sudden folio
#

he is using message commands

jovial nacelle
#

oh?

sudden folio
#

He just don't know how to create an array out side of for loop...

jovial nacelle
#

@twilit jungle you got a command handler?

twilit jungle
#

ig

#
const commandFiles = readdirSync('./commands').filter((file) => file.endsWith('.js'))
for (const file of commandFiles) {
  const command = require(`./commands/${file}`)
  client.commands.set(command.name, command)
  delete require.cache[require.resolve(`./commands/${file}`)]
}
jovial nacelle
#

[...client.commands.values()]

twilit jungle
#

confused bit

jovial nacelle
twilit jungle
#
const { Client, Message, Interaction, MessageEmbed, MessageActionRow, MessageButton } = require('discord.js')
const db = require('quick.db')
const paginationEmbed = require('discordjs-button-pagination')
const fs = require('fs');
const length = fs.readdirSync('./commands').length

module.exports = {
    name: 'commands',
    async execute(client, message, args) {
        let prefix = await db.fetch(`prefix_${message.guild.id}`)
        if (prefix == null) {
            prefix = 'skune'
        } else {
            prefix = prefix
        }
        let commandsEmbed = new MessageEmbed()
            .setColor('#679ad8')
            .setDescription(`\`\`\`${client.commands.values().toString()}\n\`\`\``)
        message.channel.send({ embeds: [commandsEmbed] })
    }
}
twilit jungle