add leetspeek mode to fancychat

This commit is contained in:
Bella 2020-03-12 20:59:54 -04:00
parent 89803f6d9d
commit d5176b2eec
No known key found for this signature in database
GPG Key ID: 03B01AC937D1C89C
1 changed files with 33 additions and 1 deletions

View File

@ -29,7 +29,7 @@ public class FancyChat extends Module {
case UWU:
return "Error: UWU mode is still experimental";
case LEET:
return "Error: LEET mode is still experimental";
return leetConverter(s);
case MOCKING:
return mockingConverter(s);
default:
@ -45,6 +45,17 @@ public class FancyChat extends Module {
// input.replace("a", "b");
// }
private String leetConverter(String input) {
StringBuilder message = new StringBuilder();
for (int i = 0 ; i < input.length() ; i++) {
String inputChar = input.charAt(i) + "";
inputChar = inputChar.toLowerCase();
inputChar = leetSwitch(inputChar);
message.append(inputChar);
}
return message.toString();
}
private String mockingConverter(String input) {
StringBuilder message = new StringBuilder();
for (int i = 0 ; i < input.length() ; i++) {
@ -79,4 +90,25 @@ public class FancyChat extends Module {
}
private boolean isNumberEven(int i) { return (i & 1) == 0; }
private String leetSwitch(String i) {
switch (i) {
case "a":
return "4";
case "e":
return "3";
case "g":
return "6";
case "l":
case "i":
return "1";
case "o":
return "0";
case "s":
return "5";
case "t":
return "7";
default: return i;
}
}
}