The error is thrown from line 67:
const attachment = new Discord.MessageAttachment(Buffer.from(body.favicon.substr('data:image/png;base64'.length), 'base64'), "icon.png")
Your request to
mcapi.us
did not return a JSON payload with a
favicon
property. You need to debug your code to examine the response, and handle the error accordingly.