Add /weebify

This commit is contained in:
Ceda EI 2019-01-06 15:12:41 +05:30
parent 1144e0b217
commit c143a8dbcb
2 changed files with 49 additions and 0 deletions

View File

@ -6,6 +6,7 @@ coin - Tosses a coin
wiki - Search Wikipedia wiki - Search Wikipedia
arch_wiki - Search the Arch wiki arch_wiki - Search the Arch wiki
insult - As expected, insults insult - As expected, insults
weebify - Weebifies the given text
is - Is <your question> is - Is <your question>
are - Are <your question> are - Are <your question>
can - Can <your question> can - Can <your question>

View File

@ -363,6 +363,54 @@ function commands() {
send_text(file_get_contents('command_list.txt')); send_text(file_get_contents('command_list.txt'));
} }
function weebify() {
global $decoded;
global $command_list;
if(count($command_list) <= 1){
send_text("Need text to weebify. Send /weebify text");
return;
}
$letters = array(
"a" => "",
"b" => "",
"c" => "",
"d" => "",
"e" => "",
"f" => "",
"g" => "",
"h" => "",
"i" => "",
"j" => "",
"k" => "",
"l" => "",
"m" => "",
"n" => "𠘨",
"o" => "",
"p" => "",
"q" => "",
"r" => "",
"s" => "",
"t" => "",
"u" => "",
"v" => "",
"w" => "",
"x" => "",
"y" => "",
"z" => ""
);
$chars = str_split($decoded->{"message"}->{"text"});
$text = "";
foreach($chars as $char){
if(key_exists($char, $letters)) {
$text .= $letters[$char];
}
else {
$text .= $char;
}
}
send_text($text);
}
// Get JSON from post, store it and decode it. // Get JSON from post, store it and decode it.
$var = file_get_contents('php://input'); $var = file_get_contents('php://input');
$decoded = json_decode($var); $decoded = json_decode($var);