Skip to content

Instantly share code, notes, and snippets.

@Zenkly
Created March 12, 2018 08:09
Show Gist options
  • Save Zenkly/cacae99cc021f928b8392cbdbe6e2c66 to your computer and use it in GitHub Desktop.
Save Zenkly/cacae99cc021f928b8392cbdbe6e2c66 to your computer and use it in GitHub Desktop.
Discord Moderation BOT
const Discord = require('discord.js')
const dotenv = require('dotenv')
dotenv.config();
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}`)
});
client.on('message', msg => {
if(!msg.author.bot && msg.channel.id === '422478404957372427'){
if(msg.content.includes(" ")){
console.log(`Message deletes: ${msg.content}`);
msg.reply(`No text, just url's`);
msg.delete();
}
else if (!msg.content.includes("https://steemit.com")) {
console.log(`Text Deleted: ${msg.content}`);
msg.reply(':point_up: Introduce a steemit url pls');
msg.delete();
}
var rpts= 0;
msg.channel.fetchMessages({limit:100 , before: msg.id })
.then(messages => {
messages.array().forEach(function(mensaje,index,array){
//messages.last(1)[0].id
if(mensaje.content == msg.content){
console.log(`${rpts} ${msg.author.username} ${msg.content}`);
if(rpts<1){
msg.reply('You only have to promote once each one of your post.');
msg.delete();
}
rpts = rpts+1;
}
});
})
.catch(console.error);
}
});
client.login(process.env.Discord_Token);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment