-
-
Save n4n0GH/388508f0248ebc5ff4e723fb906ed8a6 to your computer and use it in GitHub Desktop.
Memescript for Cordless
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() | |
} | |
autismo.unshift(':npc: ') | |
return autismo.join('') | |
}) | |
.replace(/°°([^°]*)°°/g, function(autismo){ | |
autismo = autismo.split('') | |
var numWord = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] | |
for(var i=0; i<autismo.length; i++){ | |
if(autismo[i].match(/[A-Za-z]/g)){ | |
autismo[i] = ":regional_indicator_"+autismo[i].toLowerCase()+":\u200b" | |
} else if(autismo[i].match(/[0-9]/g)){ | |
autismo[i] = ":"+numWord[autismo[i]]+":\u200b" | |
} else { | |
autismo[i] = autismo[i] | |
} | |
} | |
return autismo.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