From 6e50489f3597a4cc1674772e837bf30c509a4bf2 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Mon, 2 Apr 2018 16:41:36 +0530 Subject: [PATCH] Add kys, Fix reply. Added kys.txt, kys() function and its corresponding array to modules array. Also, replace == with === in reply for send methods. --- command_list.txt | 1 + kys.txt | 10 ++++++++++ webhook.php | 24 +++++++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 kys.txt diff --git a/command_list.txt b/command_list.txt index 3e39ab6..d36c3dd 100644 --- a/command_list.txt +++ b/command_list.txt @@ -1,6 +1,7 @@ question - Get a random question word - Get a random word words - Get n random words +kys - Kill yourself dc - Check availability of .com domain coin - Tosses a coin wiki - search the Arch wiki diff --git a/kys.txt b/kys.txt new file mode 100644 index 0000000..0697f81 --- /dev/null +++ b/kys.txt @@ -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 diff --git a/webhook.php b/webhook.php index 3c35a41..25f2b13 100644 --- a/webhook.php +++ b/webhook.php @@ -23,7 +23,7 @@ function send_code($post_message, $reply=false) { $url = 'https://api.telegram.org/bot' . $bot_api . '/sendMessage'; $post_msg = array('chat_id' => $chat_id, 'text' => '```\n ' . $post_message . '```', 'parse_mode' => 'markdown' ); if ($reply != false) { - if ($reply == true){ + if ($reply === true){ $post_msg['reply_to_message_id'] = $decoded->{'message'}->{'message_id'}; } else { @@ -49,7 +49,7 @@ function send_text($post_message, $reply=false) { $url = 'https://api.telegram.org/bot' . $bot_api . '/sendMessage'; $post_msg = array('chat_id' => $chat_id, 'text' =>$post_message ); if ($reply != false) { - if ($reply == true){ + if ($reply === true){ $post_msg['reply_to_message_id'] = $decoded->{'message'}->{'message_id'}; } else { @@ -76,7 +76,7 @@ function send_html($post_message, $reply=false) { $url = 'https://api.telegram.org/bot' . $bot_api . '/sendMessage'; $post_msg = array('chat_id' => $chat_id, 'text' =>$post_message, 'parse_mode' => 'html'); if ($reply != false) { - if ($reply == true){ + if ($reply === true){ $post_msg['reply_to_message_id'] = $decoded->{'message'}->{'message_id'}; } 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. $var = file_get_contents('php://input'); $json = fopen('json', "w"); @@ -274,6 +288,10 @@ $modules = array( array( "command" => "/should", "function" => "yes_or_no();" + ), + array( + "command" => "/kys", + "function" => "kys();" ) );