diff --git a/update_chain.php b/update_chain.php index b471ffe..63b103c 100644 --- a/update_chain.php +++ b/update_chain.php @@ -127,7 +127,7 @@ $chain = get_longest_chain(); $chain_string = chain_to_string($chain); $saved_chain = include('chain.php'); if ($saved_chain != $chain_string) { - $send_message = "Chain Length: " . count($chain) . "\n" . $chain_string; + $send_message = "Chain Length: " . count($chain) . "\n\n" . $chain_string; send_text($send_message); $file = fopen('chain.php', 'w'); $contents = ""; diff --git a/webhook.php b/webhook.php index d569c98..e3a2321 100644 --- a/webhook.php +++ b/webhook.php @@ -53,6 +53,9 @@ function send_html($post_message, $reply=false) { function new_member() { global $decoded; foreach ($decoded->{'message'}->{'new_chat_members'} as $member){ + if ($member->{'is_bot'}) { + continue; + } $username = $member->{"username"}; $user_id = $member->{"chat_id"}; $query = "INSERT INTO users (user_id, username, follows) values($user_id, '$username', -1);"; @@ -73,8 +76,13 @@ function new_member() { $text .= "Have Fun"; send_text($text); } - } + +function update() { + send_text("Update started. New chain will only be send if the chain has changed. Please wait as this takes about a minute."); + include('./update_chain.php'); +} + // Get JSON from post, store it and decode it. $var = file_get_contents('php://input'); $decoded = json_decode($var);