Skip to content

Instantly share code, notes, and snippets.

@fl4ke

fl4ke/autismo.js Secret

Last active October 12, 2019 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fl4ke/3527b342ccda26d5dffe21be058e60de to your computer and use it in GitHub Desktop.
Save fl4ke/3527b342ccda26d5dffe21be058e60de to your computer and use it in GitHub Desktop.
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