Compare commits
4 Commits
1144e0b217
...
45ffed60e2
Author | SHA1 | Date |
---|---|---|
Ceda EI | 45ffed60e2 | |
Ceda EI | f289a8b377 | |
Ceda EI | dcf2ed7fd3 | |
Ceda EI | c143a8dbcb |
|
@ -6,6 +6,7 @@ coin - Tosses a coin
|
|||
wiki - Search Wikipedia
|
||||
arch_wiki - Search the Arch wiki
|
||||
insult - As expected, insults
|
||||
weebify - Weebifies the given text
|
||||
is - Is <your question>
|
||||
are - Are <your question>
|
||||
can - Can <your question>
|
||||
|
|
52
webhook.php
52
webhook.php
|
@ -363,6 +363,54 @@ function commands() {
|
|||
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.
|
||||
$var = file_get_contents('php://input');
|
||||
$decoded = json_decode($var);
|
||||
|
@ -466,6 +514,10 @@ $modules = array(
|
|||
array(
|
||||
"command" => "/commands",
|
||||
"function" => "commands();"
|
||||
),
|
||||
array(
|
||||
"command" => "/weebify",
|
||||
"function" => "weebify();"
|
||||
)
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue