Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sm($chatID, $text, $rmf = false, $pm = 'pred', $dis = false, $replyto = false, $inline = 'pred')
- {
- global $api;
- global $userID;
- global $update;
- global $config;
- if($pm=='pred') $pm = $config["formattazione_predefinita"];
- if($inline=='pred')
- {
- if($config["tastiera_predefinita"] == "inline") $inline = true;
- elseif($config["tastiera_predefinita"] == "normale")
- $inline = false;
- }
- if($rmf == "nascondi") $inline = false;
- $dal = $config["nascondi_anteprima_link"];
- if(!$inline)
- {
- if($rmf == 'nascondi')
- {
- $rm = array('hide_keyboard' => true
- );
- }else{
- $rm = array('keyboard' => $rmf,
- 'resize_keyboard' => true
- );
- }
- }else{
- $rm = array('inline_keyboard' => $rmf,
- );
- }
- $rm = json_encode($rm);
- $args = array(
- 'chat_id' => $chat_id,
- "text" => "Seleziona lingua\nChoose language",
- 'reply_markup' => array(
- 'inline_keyboard' => array(
- array(
- array(
- 'text' => 'Italiano',
- 'callback_data' => 'italian'
- ),
- array(
- 'text' => 'English',
- 'callback_data' => 'english'
- )
- )
- )
- )
- );
- if($dal) $args['disable_web_page_preview'] = $dal;
- if($replyto) $args['reply_to_message_id'] = $replyto;
- if($rmf) $args['reply_markup'] = $rm;
- if($text)
- {
- $r = new HttpRequest("post", "https://api.telegram.org/$api/sendmessage", $args);
- $rr = $r->getResponse();
- $ar = json_decode($rr, true);
- $ok = $ar["ok"]; //false
- $e403 = $ar["error_code"];
- if($e403 == "403")
- {
- return false;
- }elseif($e403){
- return false;
- }else{
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement