-
-
Save fl4ke/3527b342ccda26d5dffe21be058e60de to your computer and use it in GitHub Desktop.
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
function onMessageSend(message){ | |
return message.replace(/%%([^%]*)%%/g, function(autismo){ | |
autismo = autismo.split('') | |
for(var i=0; i<autismo.length; i++){ | |
autismo[i] = i%2?autismo[i].toLowerCase():autismo[i].toUpperCase() | |
} | |
return autismo.join('') | |
}) | |
.replace(/°°([^°]*)°°/g, function(autismo){ | |
return autismo.replace(/[A-Za-z]/g, function(c){ | |
return ":regional_indicator_"+c.toLowerCase()+":" | |
}) | |
}) | |
.split(/(:regional_indicator_.:)/g) | |
.join('') | |
.replace(/§§([^§]*)§§/g, function(autismo){ | |
autismo = autismo.split(' ') | |
for(var i=0; i<autismo.length; i++){ | |
autismo[i] = autismo[i]+":clap:" | |
} | |
return autismo.join() | |
}) | |
.replace(/°°|%%|§§/g, '') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment