const Discord = require("discord.js");
const bot = new Discord.Client();
const TOKEN = "NOPE"
var color = require('chalk');
var fs = require('fs');

bot.on("ready", function(message) {
    console.log(color.green("Online"))
})
bot.on("message", function(message){
    console.log("Channel:" + color.blue(message.channel) + " " + "Author:" + color.blue(message.author) + " " + "Message:" + color.blue(message.content))
    if (message.content.includes("uranium") || message.content == "Uranium" || message.content == "uranium" || message.content.includes("uranium")) {
        console.log(color.black.yellow("Message Flagged As Suspicous"))
        console.log(color.black.yellow("Contains: Uranium"))
        console.log(color.black.bgYellow("Message:" + message.content))
        console.log(color.black.bgYellow("Message Id:" + message.id))
        console.log(color.black.bgYellow("Author Id:" + message.author.id))
        console.log(color.black.bgYellow("Channel Id:" + message.channel.id))
        console.log(color.yellow("Severity:" + "1"))
        var alertsev1 =  `Message + Id: + ${message.id} + | + Author + Id: + ${message.author.id} + | + Message + Channel Id: ${message.channel.id} + | + Message: + ${message.content}` 
        fs.writeFile('alerts.txt', `${alertsev2}`)
    }
    if (message.content.includes("raid") || message.content.includes("Raid")) {
        console.log(color.black.red("Message Flagged As Suspicous"))
        console.log(color.black.red("Contains: Raid"))
        console.log(color.black.bgRed("Message:" + message.content))
        console.log(color.black.bgRed("Message Id:" + message.id))
        console.log(color.black.bgRed("Author Id:" + message.author.id))
        console.log(color.black.bgRed("Channel Id:" + message.channel.id))
        console.log(color.black.red("Severity:" + "2"))
        var alertsev2 =  `Message + Id: + ${message.id} + | + Author + Id: + ${message.author.id} + | + Message + Channel Id: ${message.channel.id} + | + Message: + ${message.content}` 
        fs.writeFile('alerts.txt', `${alertsev2}`)
    }
    if (message.content.includes("raid") && message.content.includes("uranium") || message.content.includes("raid") && message.content.includes("Uranium") || message.content.includes("raid") && message.content.includes("uranium") || message.content.includes("Raid") && message.content.includes("uranium") || message.content.includes("Raid")) {
        console.log(color.black.red("Message Flagged As Possible Raid Initiation"))
        console.log(color.black.red("Contains: Raid, Uranium"))
        console.log(color.black.bgRed("Message:" + message.content))
        console.log(color.black.bgRed("Message Id:" + message.id))
        console.log(color.black.bgRed("Author Id:" + message.author.id))
        console.log(color.black.bgRed("Channel Id:" + message.channel.id))
        console.log(color.black.red("Severity:" + "3"))
        var alertsev3 =  `Message + Id: + ${message.id} + | + Author + Id: + ${message.author.id} + | + Message + Channel Id: ${message.channel.id} + | + Message: + ${message.content}` 
        fs.writeFile('alerts.txt', `${alertsev3}`)
    }
})
bot.login(TOKEN)

I'm making a discord message logger but I want to output message.content message.author message.id message.channel.id into one text file everytime a message is sent in the following format: Message ID:(Id here) Message Author: (Author ID here) Channel ID: (Channel ID here) Message: (message here) ive tried with the following code but it printed undefined out into the text document

By JackThePug, 2019-03-16 22:31:03