0

I wrote a simple bot that, after using the prefix and the command name, sends a message to the chat, a few months ago it worked, and today after turning it on, it does not work and does not show any errors.

main file ->

    // ----------------------- CONSTY -----------------------
    const Discord = require('discord.js');
    const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] });
    const cron = require('node-cron');
    // ----------------------- CONSTY -----------------------




    // ----------------------- STATUS -----------------------
    var task = cron.schedule('10,30,50 * * * * *', () => {
        client.user.setActivity('status', { type: "PLAYING" });
    });

    var task = cron.schedule('1,20,40,59 * * * * *', () => {
        client.user.setActivity('status', { type: "PLAYING" });
    });
    // ----------------------- STATUS -----------------------




    // ----------------------- HANDLERY -------------------------
    client.commands = new Discord.Collection();
    client.events = new Discord.Collection();

    ['command_handler', 'event_handler'].forEach(handler =>{
        require(`./handlers/${handler}`)(client, Discord);
    });
    // ----------------------- HANDLERY -------------------------

command handler ->

const fs = require('fs');

module.exports = (client, Discord) =>{
    const command_files = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));

    for(const file of command_files){
        const command = require(`../commands/${file}`);
        if(command.name){
            client.commands.set(command.name, command);
        } else {
            continue;
        }
    }
}

prefix ->

module.exports = (Discord, client, message, cron) => {
    const prefix = '!';
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const cmd = args.shift().toLowerCase();

    const command = client.commands.get(cmd);

    if(command) command.execute(client, message, args, Discord);
}

sample command ->

module.exports = {
    name: 'regulamin',

    async execute(client, message, args, Discord) {

        message.channel.send('content');

    }
}

I'm a basic programmer so I have no idea what to do

I tried to update discord.js and look for help on the internet but unfortunately it didn't work

0 Answers0