mirror of
				https://gitlab.com/ceda_ei/Zeeth-Naaw-Bot
				synced 2025-10-30 01:40:05 +01:00 
			
		
		
		
	Fixed member exit function
This commit is contained in:
		
							
								
								
									
										29
									
								
								webhook.php
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								webhook.php
									
									
									
									
									
								
							| @@ -77,33 +77,12 @@ function member_exit() { | |||||||
|       die("Connection failed: " . $conn->connect_error); |       die("Connection failed: " . $conn->connect_error); | ||||||
|   } |   } | ||||||
|   $user = $decoded->{"message"}->{"left_chat_member"}; |   $user = $decoded->{"message"}->{"left_chat_member"}; | ||||||
|  |   if ($user->{"is_bot"} == true){ | ||||||
|  |     exit(); | ||||||
|  |   } | ||||||
|   $user_id = $user->{"id"}; |   $user_id = $user->{"id"}; | ||||||
|   $username = $user->{"username"}; |   $username = $user->{"username"}; | ||||||
|   $follows_return = $conn->query("select * from users where user_id = $user_id;"); |   $text = "$username has left the group. They have been removed from the database."; | ||||||
|   $follows = $follows_return->fetch_assoc()["follows"]; |  | ||||||
|   if ($follows != -1){ |  | ||||||
|     $follows_username = $conn->query("select * from users where user_id = $follows;")->fetch_assoc()['username']; |  | ||||||
|   } |  | ||||||
|   $followed_by_return = $conn->query("select * from users where follows = $user_id;"); |  | ||||||
|   if ($followed_by_return->num_rows > 0) { |  | ||||||
|     if ($follows = -1) { |  | ||||||
|       $text = "$username left. They had no username in his bio. The following user(s)  pointed to they:\n"; |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       $text = "$username left. They had <pre>$follows_username</pre> username in his bio. The following user(s)  pointed to they:\n"; |  | ||||||
|     } |  | ||||||
|     while ($row = $followed_by_return->fetch_assoc()){ |  | ||||||
|       $text .= $row["username"] . "\n"; |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   else { |  | ||||||
|     if ($follows = -1) { |  | ||||||
|       $text = "$username left. They had no username in his bio. No user pointed to they."; |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|       $text = "$username left. They had <pre>$follows_username</pre> username in his bio. No user pointed to they."; |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   send_html($text); |   send_html($text); | ||||||
|   $conn->query("delete from users where user_id = $user_id;"); |   $conn->query("delete from users where user_id = $user_id;"); | ||||||
|   $conn->close(); |   $conn->close(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user