Skip to content

Instantly share code, notes, and snippets.

@Damiian1
Created December 28, 2017 20:02
Show Gist options
  • Save Damiian1/254e8f110652a5fdf1bdee5f7dce79dd to your computer and use it in GitHub Desktop.
Save Damiian1/254e8f110652a5fdf1bdee5f7dce79dd to your computer and use it in GitHub Desktop.
bot1
const Discord = require("discord.js");
const dictionary = require("dictionary-en-us");
const Nspell = require("nspell");
const token = "";
const guildID = "";
const bot = new Discord.Client();
dictionary((err, dict) => {
let spell = Nspell(dict);
["xd", "lol", "jk", "ttyl", "afk", "diy", "imo", "lmao", "lmfao", "wtf", "wth", "jfc", "omfg", "omg", "jfc", "kys"].forEach(i => {
spell.add(i);
});
bot.on("message", message => {
if(message.guild.id != guildID) return;
if(message.author == bot.user) return;
let words = message.content.split(" ");
let incorrect;
let word;
let done = false;
words.forEach(i => {
if (spell.correct(i) == false && done == false) {
incorrect = spell.suggest(i)[0];
message.guild.channels.first().startTyping();
setTimeout(() => {
if(incorrect) {
message.reply(incorrect + "*".repeat(Math.ceil(Math.random()*2)));
message.guild.channels.first().stopTyping();
}
}, 3000);
console.log(message.author.name + " was a retard and spelt " + word + " wrong. It was orignally spelt it as " + incorrect);
done = true;
}
});
});
});
bot.on("ready", () => {
console.log("[BOT]: Ready");
});
bot.login(token);
{
"name": "spell.jsa",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"dependencies": {
"dictionary-en-us": "^1.2.0",
"discord.js": "^10.0.1",
"nspell": "^1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment