Browse Source

Secure counting and xmonad channels

master
Joshua-Gordon 3 years ago
parent
commit
8488df6aae
  1. 20
      main.js

20
main.js

@ -18,10 +18,13 @@ var bot = new Discord.Client();
prevInt = counting.prevInt
function checkCounting(text) {
var n = parseInt(text);
var n = parseInt(text.replace(" ",""));
if(n === NaN) {
return false;
}
if(n != text) {
return false;
}
if(n == prevInt+1) {
var newjson = {
"prevInt" : n+1
@ -33,6 +36,14 @@ function checkCounting(text) {
return false;
}
function checkXMonad(msg) {
var valid = (msg.attachments.array().length != 0) || (msg.embeds.length != 0);
if(msg.embeds.length == 0) {
console.log(msg.attachments.array())
}
console.log("XMonad: " + valid);
return valid;
}
bot.on("ready",() => {
logger.info("Connected");
@ -40,10 +51,13 @@ bot.on("ready",() => {
bot.on("message",msg => {
console.log(msg.content,msg.channel.name);
valid = true
switch(msg.channel.name) {
case "counting":
switch(msg.channel.id) {
case "572490043302871040":
valid = checkCounting(msg.content);
break;
case "572497453631143936":
valid = checkXMonad(msg);
break;
}
if(!valid) {
msg.delete().then(() => console.log("DELETED"));

Loading…
Cancel
Save