Skip to content

Instantly share code, notes, and snippets.

@fl4ke
Forked from n4n0GH/autismo.js
Last active October 18, 2019 12:18
Show Gist options
  • Save fl4ke/3a6b8fc067526538efa4d4e4242aadb8 to your computer and use it in GitHub Desktop.
Save fl4ke/3a6b8fc067526538efa4d4e4242aadb8 to your computer and use it in GitHub Desktop.
Memescript for Cordless
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()
}
autismo.push(' :spongemock:')
return autismo.join('')
})
.replace(/°°([^°]*)°°/g, function(autismo){
return autismo.replace(/[A-Za-z]/g, function(c){
return ":regional_indicator_"+c.toLowerCase()+":"
})
.replace(/[0-9]/g, function(n){
var numWord = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
return ":"+numWord[n]+":"
})
})
.split(/(:regional_indicator_.:)/g)
.join('\u200b')
.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, function(autismo){
autismo = autismo.split(' ')
for(var i=0; i<autismo.length; i++){
autismo[i] = autismo[i]+":harj7:"
}
return autismo.join('')
})
.replace('nibba', 'ni:b::b:a')
.replace(/°°|%%|§§|!!/g, '')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment