Вчера вечером я переписал свой index. js, и теперь он больше не выполняет команды. Я попытался обновить и понизить свою версию Discord. js, но ничего не изменилось, я попытался использовать свой старый index. js, но по какой-то причине это тоже не сработало.
Вот мой индекс. js:
const {Client} = require('discord.js')
const bot = new Client()
const prefix = "%";
const owners = [''];
bot.login('')
bot.on('ready', (msg) => {
console.log(`${bot.user.tag}: [${new Date(Date.now()).toUTCString()}]`);
});
bot.on("message", async (message) => {
if(!message.author.bot) return;
if(!message.content.startsWith(prefix)) return;
let args = message.content.slice(prefix.length).trim().split(/ +/g);
let path = `./commands/${args.shift().toLowerCase()}.js`;
if(!require("fs").existsSync(path)) return;
const command = require(path);
if(!command.ownersOnly) command.run(bot, message, args);
else {return message.channel.send('You are not allowed to do that!')}
});
bot.on('message', (msg) => {
if(msg.content === "prefix") {
msg.reply("Prefix: " + prefix)
}
});
bot.on("messageDelete", (m) => {
if(m.author.bot) return
const path = __dirname + "/snipe.json"
let snipeFile = require(path)
snipeFile[m.channel.id] = [m.author.id, m.content, m.attachments.first() ? m.attachments.first().proxyURL : undefined]
require("fs").writeFileSync(path, JSON.stringify(snipeFile, null, 2))
});
Спасибо!