Skip to content

Instantly share code, notes, and snippets.

@Kampfkarren
Last active May 24, 2016 01:37
Show Gist options
  • Save Kampfkarren/e8ab49ce3e93a53c14e7eca915ac1fd5 to your computer and use it in GitHub Desktop.
Save Kampfkarren/e8ab49ce3e93a53c14e7eca915ac1fd5 to your computer and use it in GitHub Desktop.
for ttr sub
"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