From c143a8dbcb320e276c6c11575ec79359e3d594f3 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Sun, 6 Jan 2019 15:12:41 +0530 Subject: [PATCH] Add /weebify --- command_list.txt | 1 + webhook.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/command_list.txt b/command_list.txt index f5c8e4f..709c03a 100644 --- a/command_list.txt +++ b/command_list.txt @@ -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 are - Are can - Can diff --git a/webhook.php b/webhook.php index 4454852..71a737e 100644 --- a/webhook.php +++ b/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"); + 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. $var = file_get_contents('php://input'); $decoded = json_decode($var);