Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function sendTgUsers($text,$type){
- $text = urlencode($text);
- $res = $this->db->query("SELECT `id`,`chat_id`,`subscribeCount` FROM `users` WHERE `subscribeCount`>'0' and `active`='1';");
- if($res->num_rows > 0){
- while ($row = $res->fetch_assoc()) {
- $url = "https://api.telegram.org/bot".$this->botToken."/sendMessage?chat_id=".$row['chat_id']."&parse_mode=MarkDown&text=".$text;
- $this->db->("INSERT INTO `messages` (`user_id`,`message`,`created_at`,`type`) VALUES('".$row['id']."','".$url."',NOW(),'".$type."');");
- if($type == "prognoz"){
- $this->db->query("UPDATE `users` SET `subscribeCount`=`subscribeCount`-'1' WHERE `id`='".$row['id']."';");
- $row['subscribeCount']--;
- if($row['subscribeCount'] == 0){
- $url = "https://api.telegram.org/bot".$this->botToken."/sendMessage?chat_id=".$row['chat_id']."&parse_mode=MarkDown&text=".textEndPodpiska."&reply_markup=".$keyboardBuySuscribe;
- $this->db->query("INSERT INTO `messages` (`user_id`,`message`,`created_at`,`type`) VALUES('".$row['id']."','".$url."',NOW(),'info');");
- $res = $this->file_get_contents_proxy($url,true,true);
- }
- elseif($row['subscribeCount'] == 5){
- $url = "https://api.telegram.org/bot".$this->botToken."/sendMessage?chat_id=".$row['chat_id']."&parse_mode=MarkDown&text=".textNearlyPodpiska."&reply_markup=".$keyboardBuySuscribe;
- $this->db->query("INSERT INTO `messages` (`user_id`,`message`,`created_at`,`type`) VALUES('".$row['id']."','".$url."',NOW(),'info');");
- }
- }
- }
- }
- }
- public function sendTgChanel($text){
- $text = urlencode($text);
- $url = "https://api.telegram.org/bot".$this->botToken."/sendMessage?chat_id=@jetstavka&parse_mode=MarkDown&text=".$text;
- $res = $this->file_get_contents_proxy($url,true,true);
- return $res['result']['message_id'];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement