Add /weebify
This commit is contained in:
		| @@ -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> | ||||||
|   | |||||||
							
								
								
									
										48
									
								
								webhook.php
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								webhook.php
									
									
									
									
									
								
							| @@ -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); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user