Browse Source

Fix security problems

master
Joshua-Gordon 4 years ago
parent
commit
1c2c3696f6
  1. 2
      .gitignore
  2. 3
      auth.json
  3. 13
      main.js

2
.gitignore

@ -0,0 +1,2 @@
*.json
node_modules/

3
auth.json

@ -1,3 +0,0 @@
{
"token" : "NTcyNDkyODE5MDYzNjM1OTY5.XMdFhw.HgXSf-o65lxRYFAZbkoM3l_cxTM"
}

13
main.js

@ -2,6 +2,9 @@ var Discord = require("discord.js");
var logger = require("winston");
var auth = require("./auth.json");
var counting = require("./counting.json")
var fs = require("fs")
//Logger settings
logger.remove(logger.transports.Console);
logger.add(new logger.transports.Console, {
@ -11,7 +14,8 @@ logger.level = "debug";
//Robot time
var bot = new Discord.Client();
prevInt = 76
prevInt = counting.prevInt
function checkCounting(text) {
var n = parseInt(text);
@ -19,7 +23,11 @@ function checkCounting(text) {
return false;
}
if(n == prevInt+1) {
prevInt = n;
var newjson = {
"prevInt" : n+1
}
fs.writeFile("counting.json",JSON.stringify(newjson),'utf-8',() => console.log("New count: " + (n+1)))
prevInt = n
return true;
}
return false;
@ -43,3 +51,4 @@ bot.on("message",msg => {
});
bot.login(auth.token)
Loading…
Cancel
Save