The command is taking in an image and some text with it in channel-1 and posting the same image and text in channel-2. The image gets posted but the text comes out as undefined but when i print out the value in the console it is not empty.
Input in channel -1 input in channel 1
Output in channel 2 Output in channel 2
Code
if(!args.length){
return message.channel.send(`${message.author} There was no input,Command: ${message} ,your input: ${args}`);
}
var str= args.toString();
const values=str.split(' ');
client.channels.cache.get("channel-id").send({
files:Array.from(message.attachments.values()),
content:`${values[1]}`
});
console.log(values);
client.channels.cache.get("channel-id").send(`here it is --- ${values[1]}`);
}
Console-
Ready
[ 'hello,world' ]
I think the problem is with your implementation. You are accessing values[1] whereas in the console.log() it appears the values array has only one element ie at values[0]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.