diff --git a/kys.txt b/kys.txt index 0697f81..d86bada 100644 --- a/kys.txt +++ b/kys.txt @@ -1,10 +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 +##name## You should try tasting cyanide +##name## Your enzymes are meant to digest rat poison! +##name## You should try sleeping forever +##name## Pick up a gun and shoot yourself +##name## You could make a world record by jumping from a plane without parachute +##name## Stop talking BS and jump in front of a running bullet train +##name## Try bathing with Hydrochloric Acid instead of water +##name## Try this: if you hold your breath underwater for an hour, you can then hold it forever +##name## Go Green! Stop inhaling Oxygen. +##name## God was searching for you. You should leave to meet him diff --git a/webhook.php b/webhook.php index 4e4efcb..d88491b 100644 --- a/webhook.php +++ b/webhook.php @@ -214,8 +214,15 @@ function kys() { $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_id'}; - send_text($random_kys, $reply_id); + if (isset($decoded->{'message'}->{'reply_to_message'}->{'from'}->{'username'})){ + $username = '@' . $decoded->{'message'}->{'reply_to_message'}->{'from'}->{'username'}; + $random_kys = preg_replace('/##name##/g', $username, $random_kys); + } + else { + $first_name = $decoded->{'message'}->{'reply_to_message'}->{'from'}->{'first_name'}; + $random_kys = preg_replace('/##name##/g', $first_name, $random_kys); + } + send_text($random_kys); } else { send_text("Do you want to kill yourself?", true);