Last active
May 24, 2016 01:37
-
-
Save Kampfkarren/e8ab49ce3e93a53c14e7eca915ac1fd5 to your computer and use it in GitHub Desktop.
for ttr sub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
/* | |
npm install discord.js | |
make a file with config.json that looks like this | |
{ | |
"email": "botemail", | |
"password": "password" | |
} | |
*/ | |
const Discord = require("discord.js"); | |
const config = require("./config.json"); | |
const bot = new Discord.Client(); | |
let messages = {}; | |
bot.on("message", function(message){ | |
console.log(message.content); | |
console.log(message.author.id); | |
if(message.author.id in messages){ | |
if(messages[message.author.id].indexOf(message.content) !== -1) | |
bot.deleteMessage(message); | |
else{ | |
messages[message.author.id].shift(); | |
messages[message.author.id].push(message.content); | |
} | |
}else{ | |
messages[message.author.id] = [null, null, null, null, message.content]; | |
} | |
}); | |
bot.on("ready", function(){ | |
console.log("Bot ready."); | |
}); | |
bot.login(config.email, config.password); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment