Add kys, Fix reply.
Added kys.txt, kys() function and its corresponding array to modules array. Also, replace == with === in reply for send methods.
This commit is contained in:
		| @@ -1,6 +1,7 @@ | |||||||
| question - Get a random question | question - Get a random question | ||||||
| word - Get a random word | word - Get a random word | ||||||
| words - Get n random words | words - Get n random words | ||||||
|  | kys - Kill yourself | ||||||
| dc - Check availability of .com domain | dc - Check availability of .com domain | ||||||
| coin - Tosses a coin | coin - Tosses a coin | ||||||
| wiki - search the Arch wiki | wiki - search the Arch wiki | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								kys.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								kys.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | You should try tasting cyanide | ||||||
|  | Your enzymes are meant to digest rat poison! | ||||||
|  | You should try sleeping forever | ||||||
|  | Pick up a gun and shoot yourself | ||||||
|  | You could make a world record by jumping from a plane without parachute | ||||||
|  | Stop talking BS and jump in front of a running bullet train | ||||||
|  | Try bathing with Hydrochloric Acid instead of water | ||||||
|  | Try this: if you hold your breath underwater for an hour, you can then hold it forever | ||||||
|  | Go Green! Stop inhaling Oxygen. | ||||||
|  | God was searching for you. You should leave to meet him | ||||||
							
								
								
									
										24
									
								
								webhook.php
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								webhook.php
									
									
									
									
									
								
							| @@ -23,7 +23,7 @@ function send_code($post_message, $reply=false) { | |||||||
|   $url = 'https://api.telegram.org/bot' . $bot_api . '/sendMessage'; |   $url = 'https://api.telegram.org/bot' . $bot_api . '/sendMessage'; | ||||||
|   $post_msg = array('chat_id' => $chat_id, 'text' => '```\n ' . $post_message . '```', 'parse_mode' => 'markdown' ); |   $post_msg = array('chat_id' => $chat_id, 'text' => '```\n ' . $post_message . '```', 'parse_mode' => 'markdown' ); | ||||||
|   if ($reply != false) { |   if ($reply != false) { | ||||||
|     if ($reply == true){ |     if ($reply === true){ | ||||||
|       $post_msg['reply_to_message_id'] = $decoded->{'message'}->{'message_id'}; |       $post_msg['reply_to_message_id'] = $decoded->{'message'}->{'message_id'}; | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @@ -49,7 +49,7 @@ function send_text($post_message, $reply=false) { | |||||||
|   $url = 'https://api.telegram.org/bot' . $bot_api . '/sendMessage'; |   $url = 'https://api.telegram.org/bot' . $bot_api . '/sendMessage'; | ||||||
|   $post_msg = array('chat_id' => $chat_id, 'text' =>$post_message ); |   $post_msg = array('chat_id' => $chat_id, 'text' =>$post_message ); | ||||||
|   if ($reply != false) { |   if ($reply != false) { | ||||||
|     if ($reply == true){ |     if ($reply === true){ | ||||||
|       $post_msg['reply_to_message_id'] = $decoded->{'message'}->{'message_id'}; |       $post_msg['reply_to_message_id'] = $decoded->{'message'}->{'message_id'}; | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @@ -76,7 +76,7 @@ function send_html($post_message, $reply=false) { | |||||||
|   $url = 'https://api.telegram.org/bot' . $bot_api . '/sendMessage'; |   $url = 'https://api.telegram.org/bot' . $bot_api . '/sendMessage'; | ||||||
|   $post_msg = array('chat_id' => $chat_id, 'text' =>$post_message, 'parse_mode' => 'html'); |   $post_msg = array('chat_id' => $chat_id, 'text' =>$post_message, 'parse_mode' => 'html'); | ||||||
|   if ($reply != false) { |   if ($reply != false) { | ||||||
|     if ($reply == true){ |     if ($reply === true){ | ||||||
|       $post_msg['reply_to_message_id'] = $decoded->{'message'}->{'message_id'}; |       $post_msg['reply_to_message_id'] = $decoded->{'message'}->{'message_id'}; | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @@ -208,6 +208,20 @@ function yes_or_no() | |||||||
|    } |    } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Kill yourself | ||||||
|  | function kys() { | ||||||
|  |   global $decoded; | ||||||
|  |   $kys = file('kys.txt'); | ||||||
|  |   $random_kys = $kys[rand(0,count($kys)-1)]; | ||||||
|  |   if (isset($decoded->{'message'}->{'reply_to_message'})) { | ||||||
|  |     $reply_id = $decoded->{'message'}->{'reply_to_message'}->{'message'}->{'message_id'}; | ||||||
|  |     send_text($random_kys, $reply_id); | ||||||
|  |   } | ||||||
|  |   else { | ||||||
|  |     send_text("Do you want to kill yourself?", 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'); | ||||||
| $json = fopen('json', "w"); | $json = fopen('json', "w"); | ||||||
| @@ -274,6 +288,10 @@ $modules = array( | |||||||
|   array( |   array( | ||||||
|     "command" => "/should", |     "command" => "/should", | ||||||
|     "function" => "yes_or_no();" |     "function" => "yes_or_no();" | ||||||
|  |   ), | ||||||
|  |   array( | ||||||
|  |     "command" => "/kys", | ||||||
|  |     "function" => "kys();" | ||||||
|   ) |   ) | ||||||
| ); | ); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user