mirror of
				https://gitlab.com/ceda_ei/Zeeth-Naaw-Bot
				synced 2025-11-04 12:20:06 +01:00 
			
		
		
		
	Add pin_message and pins message
This commit is contained in:
		@@ -22,6 +22,25 @@ function send_text($post_message) {
 | 
			
		||||
  );
 | 
			
		||||
  $context = stream_context_create($options);
 | 
			
		||||
  $result = file_get_contents($url, false, $context);
 | 
			
		||||
  return $result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Pin Message
 | 
			
		||||
function pin_message($message_id) {
 | 
			
		||||
  global $bot_api;
 | 
			
		||||
  global $chat_id;
 | 
			
		||||
  $url = 'https://api.telegram.org/bot' . $bot_api . '/pinChatMessage';
 | 
			
		||||
  $post_msg = array('chat_id' => $chat_id, 'message_id' => $message_id );
 | 
			
		||||
  $options = array(
 | 
			
		||||
    'http' => array(
 | 
			
		||||
      'header' => "Content-type: application/x-www-form-urlencoded\r\n",
 | 
			
		||||
      'method' => 'POST',
 | 
			
		||||
      'content' => http_build_query($post_msg)
 | 
			
		||||
    )
 | 
			
		||||
  );
 | 
			
		||||
  $context = stream_context_create($options);
 | 
			
		||||
  $result = file_get_contents($url, false, $context);
 | 
			
		||||
  return $result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Takes a user array as input. Checks who follows him/her and adds
 | 
			
		||||
@@ -128,7 +147,9 @@ $chain_string = chain_to_string($chain);
 | 
			
		||||
$saved_chain = include('chain.php');
 | 
			
		||||
if ($saved_chain != $chain_string) {
 | 
			
		||||
  $send_message = "Chain Length: " . count($chain) . "\n\n" . $chain_string;
 | 
			
		||||
  send_text($send_message);
 | 
			
		||||
  $reply = send_text($send_message);
 | 
			
		||||
  $json = json_decode($reply);
 | 
			
		||||
  pin_message($reply->{"message_id"});
 | 
			
		||||
  $file = fopen('chain.php', 'w');
 | 
			
		||||
  $contents = "<?php return '". $chain_string . "'; ?>";
 | 
			
		||||
  fwrite($file, $contents);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user