Monday 10 April 2017

Javascript adding and retrieving from a file

I'm making a bot and when I do certain commands !warn @user reason I want it to log this into another file called warnings. I also want to be able to retrieve this data so I can make a statement like if (user in warnings.array). How would I go about doing this? If possible I want it to store in JSON for ex:

IN CHAT: !warn @pewdiepie ur bad , !warn @ksi ur bad

IN FILE:

{
  var warnings = [
    {
      user: "pewdiepie",
      reason: "ur bad"
    },
    {
      user: "KSI",
      reason: "also bad"
    }];
}



via Rusty

No comments:

Post a Comment