mirror of
				https://gitlab.com/ceda_ei/Zeeth-Naaw-Bot
				synced 2025-10-31 18:30:05 +01:00 
			
		
		
		
	Add /update
This commit is contained in:
		| @@ -127,7 +127,7 @@ $chain = get_longest_chain(); | |||||||
| $chain_string = chain_to_string($chain); | $chain_string = chain_to_string($chain); | ||||||
| $saved_chain = include('chain.php'); | $saved_chain = include('chain.php'); | ||||||
| if ($saved_chain != $chain_string) { | 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); |   send_text($send_message); | ||||||
|   $file = fopen('chain.php', 'w'); |   $file = fopen('chain.php', 'w'); | ||||||
|   $contents = "<?php return '". $chain_string . "'; ?>"; |   $contents = "<?php return '". $chain_string . "'; ?>"; | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								webhook.php
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								webhook.php
									
									
									
									
									
								
							| @@ -53,6 +53,9 @@ function send_html($post_message, $reply=false) { | |||||||
| function new_member() { | function new_member() { | ||||||
|   global $decoded; |   global $decoded; | ||||||
|   foreach ($decoded->{'message'}->{'new_chat_members'} as $member){ |   foreach ($decoded->{'message'}->{'new_chat_members'} as $member){ | ||||||
|  |     if ($member->{'is_bot'}) { | ||||||
|  |       continue; | ||||||
|  |     } | ||||||
|     $username = $member->{"username"}; |     $username = $member->{"username"}; | ||||||
|     $user_id = $member->{"chat_id"}; |     $user_id = $member->{"chat_id"}; | ||||||
|     $query = "INSERT INTO users (user_id, username, follows) values($user_id, '$username', -1);"; |     $query = "INSERT INTO users (user_id, username, follows) values($user_id, '$username', -1);"; | ||||||
| @@ -73,8 +76,13 @@ function new_member() { | |||||||
|     $text .= "Have Fun"; |     $text .= "Have Fun"; | ||||||
|     send_text($text); |     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. | // 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