Compare commits

..

4 Commits

Author SHA1 Message Date
Ceda EI 45ffed60e2 Make case insensitive, reply to message. 2019-01-06 15:31:50 +05:30
Ceda EI f289a8b377 Remove /weebify from text 2019-01-06 15:21:09 +05:30
Ceda EI dcf2ed7fd3 Add weebify to commands array 2019-01-06 15:14:04 +05:30
Ceda EI c143a8dbcb Add /weebify 2019-01-06 15:12:41 +05:30
2 changed files with 53 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", true);
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(preg_replace('/^\/[^ ]+ /', '', strtolower($decoded->{"message"}->{"text"})));
$text = "";
foreach($chars as $char){
if(key_exists($char, $letters)) {
$text .= $letters[$char];
}
else {
$text .= $char;
}
}
send_text($text, true);
}
// 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);
@ -466,6 +514,10 @@ $modules = array(
array( array(
"command" => "/commands", "command" => "/commands",
"function" => "commands();" "function" => "commands();"
),
array(
"command" => "/weebify",
"function" => "weebify();"
) )
); );