Advertisement
GigilinE

Untitled

Mar 27th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. function sm($chatID, $text, $rmf = false, $pm = 'pred', $dis = false, $replyto = false, $inline = 'pred')
  2. {
  3. global $api;
  4. global $userID;
  5. global $update;
  6. global $config;
  7.  
  8.  
  9. if($pm=='pred') $pm = $config["formattazione_predefinita"];
  10.  
  11. if($inline=='pred')
  12. {
  13. if($config["tastiera_predefinita"] == "inline") $inline = true;
  14. elseif($config["tastiera_predefinita"] == "normale")
  15. $inline = false;
  16. }
  17. if($rmf == "nascondi") $inline = false;
  18.  
  19.  
  20. $dal = $config["nascondi_anteprima_link"];
  21.  
  22. if(!$inline)
  23. {
  24. if($rmf == 'nascondi')
  25. {
  26. $rm = array('hide_keyboard' => true
  27. );
  28. }else{
  29. $rm = array('keyboard' => $rmf,
  30. 'resize_keyboard' => true
  31. );
  32. }
  33. }else{
  34. $rm = array('inline_keyboard' => $rmf,
  35. );
  36. }
  37. $rm = json_encode($rm);
  38.  
  39. $args = array(
  40. 'chat_id' => $chat_id,
  41. "text" => "Seleziona lingua\nChoose language",
  42. 'reply_markup' => array(
  43. 'inline_keyboard' => array(
  44. array(
  45. array(
  46. 'text' => 'Italiano',
  47. 'callback_data' => 'italian'
  48. ),
  49. array(
  50. 'text' => 'English',
  51. 'callback_data' => 'english'
  52. )
  53. )
  54. )
  55. )
  56. );
  57. if($dal) $args['disable_web_page_preview'] = $dal;
  58. if($replyto) $args['reply_to_message_id'] = $replyto;
  59. if($rmf) $args['reply_markup'] = $rm;
  60. if($text)
  61. {
  62. $r = new HttpRequest("post", "https://api.telegram.org/$api/sendmessage", $args);
  63. $rr = $r->getResponse();
  64. $ar = json_decode($rr, true);
  65. $ok = $ar["ok"]; //false
  66. $e403 = $ar["error_code"];
  67. if($e403 == "403")
  68. {
  69. return false;
  70. }elseif($e403){
  71. return false;
  72. }else{
  73. return true;
  74. }
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement