首页 > 解决方案 > 为什么使用命令时我的代码无法访问?

问题描述

from let answer = message.contentto Hiring status: ${message.content}) 代码无法访问这里是完整的代码:

module.exports = {
  name: "status",
  category: "status check",
  description: "Checks the status of the pm manager.",
  aliases: [],
  usage: "status",
  userperms: ["ADMINISTRATOR"],
  botperms: [],
  run: async (client, message, args) => {
    return message.channel.send(`what is your hiring status?`);
    let answer = message.content;
    return message.channel.send(`Status of ${message.author}:\n` + `Hiring status: ${message.content}`);
  },
};

标签: javascriptnode.jsdiscord.js

解决方案


删除所有returnfromrun函数。

module.exports = {
    name: 'status',
    category: 'status check',
    description: 'Checks the status of the pm manager.',
    aliases: [],
    usage: 'status',
    userperms: ['ADMINISTRATOR'],
    botperms: [],
    run: async (client, message, args) => {
        message.channel.send(`what is your hiring status?`)
        let answer = message.content
        message.channel.send(`Status of ${message.author}:\n` +
        `Hiring status: ${message.content}`)
    }
}

推荐阅读