发送多个参数时,删除","。

问题描述 投票:0回答:1
module.exports = {
    name: 'say',
    description: 'Makes the Bot say something you want.',
    execute(message, args) {
        if (!args.length) {
            return message.channel.send(You didn't provide me anything to say, ${message.author}!);
        }

        message.channel.send(${args});
    },
};

有没有一种方法,当我让!说多个字的时候,机器人就不会这样发出来。I,am,here,hello . 有没有办法把", "去掉?

javascript bots discord.js args
1个回答
1
投票

你必须使用 .join() 来连接数组值。

所以你需要做 message.channel.send(args.join(' '));

© www.soinside.com 2019 - 2024. All rights reserved.