Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Discord应用程序Bot-Discord.js_Javascript_Discord.js - Fatal编程技术网

Javascript Discord应用程序Bot-Discord.js

Javascript Discord应用程序Bot-Discord.js,javascript,discord.js,Javascript,Discord.js,我正在创建一个discord.js bot,但我想为应用程序添加更多命令。例如,我想要一个命令!应用1和命令!应用程序2。当我复制代码、再次粘贴、更改命令名称并键入命令时,它会发送两到三个问题,而不是一个问题。我应该换什么 如果您不理解并想检查我所说的内容,请加入这个假的discord服务器:(它每次发送2个问题,我想发送1个问题,同时,它将两个问题的答案发送到同一个频道,我检查频道id是否正确。) 守则: //需要\\ const botSettings=require(“./botSetti

我正在创建一个discord.js bot,但我想为应用程序添加更多命令。例如,我想要一个命令
!应用1
和命令
!应用程序2
。当我复制代码、再次粘贴、更改命令名称并键入命令时,它会发送两到三个问题,而不是一个问题。我应该换什么

如果您不理解并想检查我所说的内容,请加入这个假的discord服务器:(它每次发送2个问题,我想发送1个问题,同时,它将两个问题的答案发送到同一个频道,我检查频道id是否正确。)

守则:

//需要\\
const botSettings=require(“./botSettings.json”);
const Discord=require(“Discord.js”);
const prefix=botSettings.prefix;
const bot=new Discord.Client({disableEveryone:true});
//就绪控制台上的Bot\\
bot.on('ready',()=>{
日志(“Bot已准备就绪”);
setActivity(“Great”,{type:“WATCHING”})
})
//职员\\
让userApplications={}
bot.on(“消息”,功能(消息){
if(message.author.equals(bot.user))返回;
让authorId=message.author.id;
如果(message.content==“!apply staff”){
log(`Apply begin for authorId${authorId}`);
if(!(用户应用程序中的authorId)){
userApplications[authorId]={“步骤”:1}
message.author.send(“‏‏‎ ‎")
message.author.send(“>>>员工申请”)
message.author.send(“>>>问题1:”);
}
}否则{
if(message.channel.type===“dm”&&authorId在用户应用程序中){
让authorApplication=userApplications[authorId];
if(authorApplication.step==1){
authorApplication.answer1=message.content;
message.author.send(“>>>问题2:”);
authorApplication.step++;
}
else if(authorApplication.step==2){
authorApplication.answer2=message.content;
message.author.send(“>>>问题3:”);
authorApplication.step++;
}
else if(authoraApplication.step==3){
authorApplication.answer3=message.content;
message.author.send(“>>>问题4:”);
authorApplication.step++;
}
else if(authoraApplication.step==4){
authorApplication.answer4=message.content;
message.author.send(“>>>问题5:”);
authorApplication.step++;
}
else if(authoraApplication.step==5){
authorApplication.answer5=message.content;
message.author.send(“>>>问题6:”);
authorApplication.step++;
}
else if(authorApplication.step==6){
authorApplication.answer6=message.content;
message.author.send(“>>>问题7:”);
authorApplication.step++;
}
else if(authorApplication.step==7){
authorApplication.answer7=message.content;
message.author.send(“>>>问题8:”);
authorApplication.step++;
}
else if(authoraApplication.step==8){
authorApplication.answer8=message.content;
message.author.send(“>>>谢谢!”);
bot.channels.cache.get(“7435508838589259287”)
.send(`${message.author}\n>>>问题1:{authorApplication.answer1}\n问题2:{authorApplication.answer2}\n问题3:{authorApplication.answer3}\n问题4:{authorApplication.answer4}\n问题5:{authorApplication.answer5}\n问题6:{authorApplication.answer6}\n问题7:{authorApplication.answer7}\问题8:|${authorApplication.answer8}`);
删除用户应用程序[authorId];
}
}
}
});
//警察\\
bot.on(“消息”,功能(消息){
if(message.author.equals(bot.user))返回;
让authorId=message.author.id;
如果(message.content==“!应用警察”){
log(`Apply begin for authorId${authorId}`);
if(!(用户应用程序中的authorId)){
userApplications[authorId]={“步骤”:1}
message.author.send(“‏‏‎ ‎")
message.author.send(“>>>警方申请”)
message.author.send(“>>>问题1:”);
}
}否则{
if(message.channel.type===“dm”&&authorId在用户应用程序中){
让authorApplication=userApplications[authorId];
if(authorApplication.step==1){
authorApplication.answer1=message.content;
message.author.send(“>>>问题2:”);
authorApplication.step++;
}
else if(authorApplication.step==2){
authorApplication.answer2=message.content;
message.author.send(“>>>问题3:”);
authorApplication.step++;
}
else if(authoraApplication.step==3){
authorApplication.answer3=message.content;
message.author.send(“>>>问题4:”);
authorApplication.step++;
}
else if(authoraApplication.step==4){
authorApplication.answer4=message.content;
message.author.send(“>>>问题5:”);
authorApplication.step++;
}
else if(authoraApplication.step==5){
authorApplication.answer5=message.content;
message.author.send(“>>>问题6:”);
authorApplication.step++;
}
else if(authorApplication.step==6){
authorApplication.answer6=message.content;
混乱