Created
January 25, 2017 05:33
-
-
Save Ovyerus/106a0bf13465751b7ed81eb607e58f11 to your computer and use it in GitHub Desktop.
discord seflbot that does magic
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
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