TypeError: args.join is not a function

im using that code:

const fetch = require(“node-fetch”);
require(‘dotenv’).config()
const crypto = require(‘crypto’);
const Discord = require(‘discord.js’);
exports.run = (client, msg, message, args) => {
var img;
if (msg.attachments.first() == undefined) {
var match = args.join(" ").match(/((([A-Za-z]{3,9}:(?://)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:/[+~%/.\w-]*)???(?:[-+=&;%@.\w])#?(?:[.!/\\w]))?)/);
if (match == null) return;
if (match.length != 0) {
img = match[0];
} else {
msg.channel.send(“Please provide an image.”);
}
} else {
img = msg.attachments.first().url;
}
var p = msg.channel.send(“Alright, processing.”);
fetch(“https://fapi.wrmsr.io/magikscript”, {
method: “post”,
headers: {
“Authorization”: "Bearer "+process.env.FAPI_KEY,
“Content-type”: “application/json”,
“Accept-Charset”: “utf-8”
},
body: JSON.stringify({
“images”: [img],
“args”: {
“text”: “magik”
}
})
}).then(res => {
var type = res.headers.get(“content-type”);
if (type == “text/plain”) {
return Promise.resolve(res.text()).then(function(data) {
msg.channel.send(data)
})
}
msg.channel.send({
“files”: [new Discord.Attachment(res.body, crypto.randomBytes(4) + ‘.gif’)]
});
Promise.resolve(p).then(function(ms) {
ms.delete();
});
});
}

im getting that error:

pls help :confused:

Can you console.log(args) right before you use args.join("") and make sure args is an array? If it’s a string or something, args.join won’t exist