My bot once every few hours crashes

I randomly get this during the day, and when it happens i need to manually restart the project.
but after some hours this error back

here is the error: [4/4/2019 | 17:54:52] Error: Unhandled “error” event. ([object Object])

Since I have access to the project, I went and created a file called “error.js” in your events folder. Then I put the following inside it:

// File Created by callumok2004
const { error } = require('./logError.js');

module.exports = (err) => { 
  error(err);
};

Then I created a file called logError.js inside the events folder aswell, and put this inside it:


// File Created by callumok2004

const moment = require('moment');
const chalk = require('chalk');

module.exports = (str) => {
    let time = `[ERR ${moment().format("hh:mm:ss")}]`;
    console.log(`${chalk.bold.red(time)} ${chalk.red(str)}`);
};

If this does not fix the problem then please let me know!

bot crash again, but i got this error
[4/4/2019 | 19:48:0] Error: TypeError: eventFunc.run is not a function
on this line
bot.on(eventName, (…args) => eventFunc.run(bot, …args));
on event handler at bot/index.js

Sorry, that was my bad, I had a typo in the code I had input into the file! It should be fine now!