Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Ovyerus
Created January 25, 2017 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ovyerus/106a0bf13465751b7ed81eb607e58f11 to your computer and use it in GitHub Desktop.
Save Ovyerus/106a0bf13465751b7ed81eb607e58f11 to your computer and use it in GitHub Desktop.
discord seflbot that does magic
const Eris = require('eris');
const bot = new Eris("TOKEN");
const detideReplace = {
'(': ')',
')': '(',
'{': '}',
'}': '{',
'[': ']',
']': '[',
'<': '>',
'>': '<'
}
bot.on('ready', () => {
console.log('Ready!');
});
bot.on('messageCreate', msg => {
if (!msg.author || msg.author.id !== bot.user.id) return; // author is occasionally undefined. valve pls fix
if (msg.content.includes('detide')) {
let detide = msg.content.split('detide');
let og = detide[0];
detide.splice(0, 1);
let reverse = detide.join('detide').split('').reverse();
reverse.forEach((sa, me) => {
reverse[me] = detideReplace[sa] ? detideReplace[sa] : sa;
});
reverse = reverse.join('');
bot.editMessage(msg.channel.id, msg.id, `${og}\u202e${reverse}\u200b`);
}
});
bot.connect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment