Так что, в принципе, я пытался решить эту проблему часами, но безуспешно.Вот что происходит, когда я пытаюсь запустить бота:
https://gyazo.com/3a941b4372c88be07c76c5b004327f71
Я проверил, что главное правильно и что все правильно, как файлы json и фактический код.
bot.js ->
const botconfig = require("./botconfig.json");
const Discord = require("discord.js");
const bot = new Discord.Client({disableEveryone: true});
bot.on("ready", async () => {
console.log(`${bot.user.username} is online!`);
bot.user.setActivity("Tickets", {type: "WATCHING"});
});
bot.on('message', async message => {
if(message.author.bot) return;
if(message.channel.type === "dm") return;
let prefix = botconfig.prefix;
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
if(cmd === `${prefix}new`){
let embed = new Discord.RichEmbed()
.setTitle("Ticket created")
.setDescription("Ticket #ticket- has been created successfully.")
.setColor("#15f153")
.setFooter("chefren#9582 | 2019")
return message.channel.send(embed);
}
if(cmd === `${prefix}ticketcreation`){
let embed = new Discord.RichEmbed()
.setTitle("Ticket")
.setDescription("Do you require help or support? React with :white_check_mark: ")
.setColor("#15f153")
.setFooter("dl121#9582 | 2019")
msg = await message.channel.send(embed);
await msg.react('✅')
message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '✅') {
message.reply('you reacted with a thumbs up.');
}
});
bot.login(botconfig.token);
}
})
Package.json
{
"name": "bot",
"version": "1.0.0",
"description": "A bot",
"main": "bot.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "andrew",
"license": "ISC",
"dependencies": {
"cjs": "0.0.11",
"discord.js": "^11.5.1",
"fs": "0.0.1-security",
"node.js": "0.0.0"
},
"devDependencies": {}
}
До этого я исправлял это сообщение об ошибке:
Error: Cannot find module 'C:\Users\Andrew\Desktop\Discord Bots\Bot\bot,js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)