【发布时间】:2020-11-03 06:24:51
【问题描述】:
exports.exec = async (client, message, args) => {
// Fires Error message that the command wasn't ran correctly.
if (args.length < 1) {
return message.channel.send({
embed: {
color: 0,
description: `${message.author} Please input something to be generated into the QR code.`
}
});
}
// Fires Error message that the command wasn't ran correctly.
var text = args.join(' ');
var qr_generator = `https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${text}`;
message.channel.send(qr_generator);
};
大家好,上面是命令,但它工作,当尝试添加几个单词时,即。 "hello world 它只捕获 hello,在放置一个空格后它会中断。我不完全确定如何允许空格。
感谢任何帮助。
例子-
【问题讨论】:
-
在
data=之后的所有内容上使用encodeURIComponent。
标签: javascript discord discord.js