bot - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of bot.php

  1. <?php
  2.  
  3. date_default_timezone_set('Asia/Tehran');
  4. error_reporting(0);
  5. #-----------------------------#
  6. $token = "توکن روبات";
  7.  
  8. $dev = "آیدی عدد ادمین";
  9.  
  10. #-----------------------------#
  11. define('API_KEY', $token);
  12. #-----------------------------#
  13. $update = json_decode(file_get_contents("php://input"));
  14. if(isset($update->message)){
  15.     $from_id    = $update->message->from->id;
  16.     $chat_id    = $update->message->chat->id;
  17.     $tc         = $update->message->chat->type;
  18.     $text       = $update->message->text;
  19.     $first_name = $update->message->from->first_name;
  20.     $message_id = $update->message->message_id;
  21. }elseif(isset($update->callback_query)){
  22.     $chat_id    = $update->callback_query->message->chat->id;
  23.     $data       = $update->callback_query->data;
  24.     $query_id   = $update->callback_query->id;
  25.     $message_id = $update->callback_query->message->message_id;
  26.     $in_text    = $update->callback_query->message->text;
  27.     $from_id    = $update->callback_query->from->id;
  28. }
  29. #-----------------------------#
  30. function bot($method,$datas=[]){
  31.     $url = "https://api.telegram.org/bot".API_KEY."/".$method;
  32.     $ch = curl_init();
  33.     curl_setopt($ch,CURLOPT_URL,$url);
  34.     curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  35.     curl_setopt($ch,CURLOPT_POSTFIELDS,$datas);
  36.     $res = curl_exec($ch);
  37.     if(curl_error($ch)){
  38.         var_dump(curl_error($ch));
  39.     }else{
  40.         return json_decode($res);
  41.     }
  42. }
  43. #-----------------------------#
  44. function sendmessage($chat_id,$text,$keyboard = null) {
  45.     bot('sendMessage',[
  46.         'chat_id' => $chat_id,
  47.         'text' => $text,
  48.         'parse_mode' => "HTML",
  49.         'disable_web_page_preview' => true,
  50.         'reply_markup' => $keyboard
  51.     ]);
  52. }
  53. #-----------------------------#
  54. function deleteDirectory($dir) {
  55.     if (!file_exists($dir)) {
  56.         return true;
  57.     }
  58.     if (!is_dir($dir)) {
  59.         return unlink($dir);
  60.     }
  61.     foreach (scandir($dir) as $item) {
  62.         if ($item == '.' || $item == '..') {
  63.             continue;
  64.         }
  65.         if (!deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
  66.             return false;
  67.         }
  68.     }
  69.     return rmdir($dir);
  70. }
  71. #-----------------------------#
  72. if(!is_dir("data")){
  73. mkdir("data");
  74. }
  75. if(!is_dir("data/user")){
  76. mkdir("data/user");
  77. }
  78. if(!is_dir("data/code")){
  79. mkdir("data/code");
  80. }
  81. if(!is_dir("data/vpn")){
  82. mkdir("data/vpn");
  83. }
  84. if(!is_dir("data/vpn/v2ray")){
  85. mkdir("data/vpn/v2ray");
  86. }
  87. if(!is_dir("data/vpn/ex")){
  88. mkdir("data/vpn/ex");
  89. }
  90. if(!is_dir("data/user/$from_id")){
  91. mkdir("data/user/$from_id");
  92. }
  93. if(!is_dir("data/user/$from_id/vpn")){
  94. mkdir("data/user/$from_id/vpn");
  95. }
  96. if(!is_dir("data/user/$from_id/vpn/v2ray")){
  97. mkdir("data/user/$from_id/vpn/v2ray");
  98. }
  99. if(!is_dir("data/user/$from_id/vpn/ex")){
  100. mkdir("data/user/$from_id/vpn/ex");
  101. }
  102. if(!file_exists("data/user/$from_id/coin.txt")){
  103. file_put_contents("data/user/$from_id/coin.txt", "10000");
  104. }
  105. if(!file_exists("data/helpcont")){
  106.     file_put_contents("data/helpcont", "????متن راهنما تنظیم نشده است !");
  107. }
  108. if(!file_exists("data/ex")){
  109.     file_put_contents("data/ex", "0");
  110. }
  111. if(!file_exists("data/v2ray")){
  112.     file_put_contents("data/v2ray", "0");
  113. }
  114. if(!file_exists("data/osm")){
  115.     file_put_contents("data/osm", "خاموش");
  116. }
  117. if(!file_exists("data/channel")){
  118.     file_put_contents("data/channel", "none");
  119. }
  120. #-----------------------------#
  121. $step = file_get_contents ("data/user/$from_id/step.txt");
  122. $coin = file_get_contents ("data/user/$from_id/coin.txt");
  123. $helpcont = file_get_contents ("data/helpcont");
  124. $cart = file_get_contents ("data/cart");
  125. $o = "???? بازگشت";
  126. $oo = "???? برگشت";
  127. $channel = file_get_contents ("data/channel");
  128. $truechannel = json_decode(file_get_contents("https://api.telegram.org/bot$token/getChatMember?chat_id=@$channel&user_id=".$from_id));
  129. $tch = $truechannel->result->status;
  130. $pooyaosm = file_get_contents ("data/osm");
  131. #-----------------------------#
  132. $ex = file_get_contents ("data/ex");
  133. $v2ray = file_get_contents ("data/v2ray");
  134. #-----------------------------#
  135. $key1 = json_encode(['keyboard'=>[
  136. [['text'=>"???? خرید فیلترشکن"]],
  137. [['text'=>"???? اطلاعات کاربری"],['text'=>"????کد هدیه"],['text'=>"⚜ وضعیت سرویس ها"]],
  138. [['text'=>"???? آموزش اتصال"],['text'=>"➕ افزایش موجودی"]],
  139. ],
  140. 'resize_keyboard' =>true]);
  141. $key2 = json_encode(['keyboard'=>[
  142. [['text'=>"???? اکسپرس وی پی ان"],['text'=>"???? کانفیگ وی پی ان"]],
  143. [['text'=>"$o"]],
  144. ],
  145. 'resize_keyboard' =>true]);
  146. $back = json_encode(['keyboard'=>[
  147. [['text'=>"$o"]],
  148. ],
  149. 'resize_keyboard' =>true]);
  150. $key3 = json_encode(['keyboard'=>[
  151. [['text'=>"➕ افزودن وی پی ان"],['text'=>"???? وضعیت ربات"]],
  152. [['text'=>"???? خدمات ارسال"],['text'=>"❌ حذف کل اکانتها"]],
  153. [['text'=>"ℹ سایر خدمات"],['text'=>"???? تنظیمات مالی"]],
  154. [['text'=>"⚙ تنظیمات مدیریتی"]],
  155. ],
  156. 'resize_keyboard' =>true]);
  157. $key4 = json_encode(['keyboard'=>[
  158. [['text'=>"افزودن اکسپرس"],['text'=>"افزودن کانفیگ"]],
  159. [['text'=>"$oo"]],
  160. ],
  161. 'resize_keyboard' =>true]);
  162. $bk = json_encode(['keyboard'=>[
  163. [['text'=>"$oo"]],
  164. ],
  165. 'resize_keyboard' =>true]);
  166. $key5 = json_encode(['keyboard'=>[
  167. [['text'=>"♧ تنظیم متن راهنمای اتصال"]],
  168. [['text'=>"???? تنظیمات کانال"],['text'=>"$oo"]],
  169. ],'resize_keyboard' =>true]);
  170. $key6 = json_encode(['keyboard'=>[
  171. [['text'=>"???? فوروارد همگانی"],['text'=>"???? ارسال همگانی"]],
  172. [['text'=>"$oo"]],
  173. ],'resize_keyboard' =>true]);
  174. $key7 = json_encode(['keyboard'=>[
  175. [['text'=>"????ثبت شماره کارت"],['text'=>"???? تعیین قیمت"]],
  176. [['text'=>"➖ کاهش پول"],['text'=>"➕ افزایش پول"]],
  177. [['text'=>"$oo"]],
  178. ],'resize_keyboard' =>true]);
  179. $key8 = json_encode(['keyboard'=>[
  180. [['text'=>"???? پول همگانی"]],
  181. [['text'=>"????ساخت کد هدیه"]],
  182. [['text'=>"$oo"]],
  183. ],'resize_keyboard' =>true]);
  184. #-----------------------------#
  185. #-----------------------------#
  186. #-----------------------------#
  187. if ($pooyaosm == "روشن"){
  188. if($tch != 'member' && $tch != 'creator' && $tch != 'administrator' && $chat_id != $dev){
  189.         bot('sendmessage', [
  190.             'chat_id' => $chat_id,
  191.             'text' => "
  192. ▫️شما در کانال اسپانسر عضو نیستید ⚜️
  193. ◼️عضو شوید و سپس /start را بفرستید",
  194.             'parse_mode' => "html",
  195.             'reply_markup' => json_encode([
  196.                 'inline_keyboard' => [
  197.                     [
  198.                         ['text' => "@$channel", 'url' => "https://telegram.me/$channel"]
  199.                     ],
  200.                     
  201.                 ]
  202.             ])
  203.         ]);
  204.             exit();
  205.         }}
  206. #-----------------------------#
  207. if($text == "/start" || $text == $o){
  208. bot('sendmessage',[
  209. 'chat_id'=> $chat_id,
  210. 'text'=> "
  211. ▪︎ سلام $first_name عزیز به ربات فروش وی پی ان ما خوش آمدی :
  212. ",
  213. 'reply_markup'=>$key1,
  214. 'parse_mode'=>"Markdown",
  215. 'reply_to_message_id'=>$message_id,
  216. ]);
  217. file_put_contents ("data/user/$from_id/step.txt","none");
  218. }
  219. #-----------------------------#
  220. if($text == "???? خرید فیلترشکن"){
  221. bot('sendmessage',[
  222. 'chat_id'=> $chat_id,
  223. 'text'=> "
  224. ✅ لطفا سرویس مورد نظرتون رو انتخاب کنید :
  225.  
  226. ???? قیمت کانفیگ وی پی ان  : $v2ray
  227. ???? قیمت اکسپرس وی پی ان : $ex
  228. ",
  229. 'reply_markup'=>$key2,
  230. 'parse_mode'=>"Markdown",
  231. 'reply_to_message_id'=>$message_id,
  232. ]);
  233. file_put_contents ("data/user/$from_id/step.txt","none");
  234. }
  235. #-----------------------------#
  236. if($text == "⚜ وضعیت سرویس ها"){
  237. $scan = scandir ("data/vpn/v2ray");
  238. $tv2ray = count ($scan) - 2;
  239. $scan1 = scandir ("data/vpn/ex");
  240. $tex = count ($scan1) - 2;
  241. $keyom = json_encode(['inline_keyboard' => [
  242. [['text' =>"تعداد سرویس های موجود",'callback_data'=>"a"],['text'=>"قیمت",'callback_data'=>"a"],['text' =>"نام سرویس",'callback_data'=>"a"]],
  243. [['text' =>"$tex",'callback_data'=>"a"],['text'=>"$ex",'callback_data'=>"a"],['text' =>"اکسپرس",'callback_data'=>"a"]],
  244. [['text' =>"$tv2ray",'callback_data'=>"a"],['text'=>"$v2ray",'callback_data'=>"a"],['text' =>"کانفیگ v2ray",'callback_data'=>"a"]],
  245. ]]);
  246. bot('sendmessage',[
  247. 'chat_id'=> $chat_id,
  248. 'text'=> "???? وضعیت سرویس های وی پی ان و همچنین قیمت های آنها به شرح ذیل می باشد :",
  249. 'reply_markup'=>$keyom,
  250. 'parse_mode'=>"Markdown",
  251. 'reply_to_message_id'=>$message_id,
  252. ]);
  253. file_put_contents ("data/user/$from_id/step.txt","none");
  254. }
  255. #-----------------------------#
  256. elseif($text == "???? کانفیگ وی پی ان"){
  257. $scan = scandir ("data/vpn/v2ray");
  258. $tv2ray = count ($scan) - 2;
  259. if($coin < $v2ray){
  260. bot('sendmessage',[
  261. 'chat_id'=> $chat_id,
  262. 'text'=> "❌ متأسفانه موجودی شما جهت خرید این سرویس کافی نیست .",
  263. 'reply_markup'=>$back,
  264. 'parse_mode'=>"Markdown",
  265. 'reply_to_message_id'=>$message_id,
  266. ]);
  267. exit();
  268. }
  269. if($tv2ray < 1){
  270. bot('sendmessage',[
  271. 'chat_id'=> $chat_id,
  272. 'text'=> "متاسفانه تعداد اکانت های این سرویس به اتمام رسیده است . لطفا بعدا مراجعه کنید .",
  273. 'reply_markup'=>$key1,
  274. 'parse_mode'=>"Markdown",
  275. 'reply_to_message_id'=>$message_id,
  276. ]);
  277. exit();
  278. }
  279. else{
  280. bot('sendmessage',[
  281. 'chat_id'=> $chat_id,
  282. 'text'=> "لطفا کمی صبر کنید ربات درحال ساخت فیلتر شکن شما می باشد ...",
  283. 'parse_mode'=>"Markdown",
  284. 'reply_to_message_id'=>$message_id,
  285. ]);
  286. sleep ('5');
  287. $a = $coin - $v2ray;
  288. file_put_contents ("data/user/$from_id/coin.txt",$a);
  289. $scan = scandir("data/vpn/v2ray");
  290. $random = $scan[rand(2, count($scan) - 1)];
  291. $a = file_get_contents ("data/vpn/v2ray/$random");
  292. bot('sendmessage',[
  293. 'chat_id'=> $chat_id,
  294. 'text'=> "
  295. ✅ کانفیگ شما ساخته شد .
  296. `$a`
  297. ",
  298. 'reply_markup'=>$key1,
  299. 'parse_mode'=>"Markdown",
  300. 'reply_to_message_id'=>$message_id,
  301. ]);
  302. file_put_contents ("data/user/$from_id/vpn/v2ray/acc.v2ray","$a");
  303. unlink ("data/vpn/v2ray/$random");
  304. file_put_contents ("data/user/$from_id/step.txt","none");
  305. }
  306. }
  307. #-----------------------------#
  308. if($text == "????کد هدیه"){
  309. bot('sendmessage',[
  310. 'chat_id'=> $chat_id,
  311. 'text'=> "???? کد هدیه را وارد کنید :",
  312. 'reply_markup'=>$back,
  313. 'parse_mode'=>"Markdown",
  314. 'reply_to_message_id'=>$message_id,
  315. ]);
  316. file_put_contents ("data/user/$from_id/step.txt","okpopoa");
  317. }
  318. elseif ($step == "okpopoa"and $text != $o){
  319.     
  320.     $a = file_exists("data/code/$text");
  321.     if($text == $a){
  322.         
  323.         $aa = file_get_contents ("data/code/$text");
  324.         $b = $coin + $aa;
  325.         file_put_contents ("data/user/$from_id/coin.txt",$b);
  326.         unlink ("data/code/$text");
  327.         sendmessage ($chat_id , "کد هدیه با موفقیت وارد شد و مبلغ $aa به حساب شما افزوده شد." , $back);
  328.         file_put_contents ("data/user/$from_id/step.txt","none");
  329.         
  330.     }else{
  331.         sendmessage ($chat_id , "کد هدیه اشتباه یا استفاده شده است.");
  332.         file_put_contents ("data/user/$from_id/step.txt","none");
  333.     }
  334.     
  335. }
  336. #-----------------------------#
  337. #-----------------------------#
  338. if($text == "???? اکسپرس وی پی ان"){
  339. bot('sendmessage',[
  340. 'chat_id'=> $chat_id,
  341. 'text'=> "???? فروش اکانت اکسپرس وی پی ان در اپدیت اینده اضافه می شود .",
  342. 'reply_markup'=>$key1,
  343. 'parse_mode'=>"Markdown",
  344. 'reply_to_message_id'=>$message_id,
  345. ]);
  346. file_put_contents ("data/user/$from_id/step.txt","none");
  347. }
  348. #-----------------------------#
  349. if($text == "???? آموزش اتصال"){
  350. bot('sendmessage',[
  351. 'chat_id'=> $chat_id,
  352. 'text'=> "$helpcont",
  353. 'reply_markup'=>$key1,
  354. 'parse_mode'=>"Markdown",
  355. 'reply_to_message_id'=>$message_id,
  356. ]);
  357. file_put_contents ("data/user/$from_id/step.txt","none");
  358. }
  359. #-----------------------------#
  360. if($text == "???? اطلاعات کاربری"){
  361. $scan = scandir ("data/user/$from_id/vpn/v2ray");
  362. $scan1 = scandir ("data/user/$from_id/vpn/ex");
  363. $v2raybuy = count ($scan) - 2;
  364. $exbuy = count ($scan1) - 2;
  365. bot('sendmessage',[
  366. 'chat_id'=> $chat_id,
  367. 'text'=> "
  368. ???? وضعیت کاربری شما در ربات ما :
  369.  
  370. ???? شناسه عددی شما : `$chat_id`
  371. ???? موجودی کل شما : *$coin تومان*
  372. ???? تعداد کانفیگ های خریداری شده : *$v2raybuy*
  373. ???? تعداد اکانت های اکسپرس خریداری شده : *$exbuy*
  374. ",
  375. 'reply_markup'=>$key1,
  376. 'parse_mode'=>"Markdown",
  377. 'reply_to_message_id'=>$message_id,
  378. ]);
  379. file_put_contents ("data/user/$from_id/step.txt","none");
  380. }
  381. #-----------------------------#
  382. if($text == "➕ افزایش موجودی"){
  383. $rand  = rand (1,9);
  384. $rand1 = rand (1,9);
  385. $a = $rand + $rand1;
  386. bot('sendmessage',[
  387. 'chat_id'=> $chat_id,
  388. 'text'=> "
  389. ♻️ لطفا جهت احراز هویت حاصل جمع زیر را وارد کنید :
  390. $rand + $rand1 = ?
  391. ",
  392. 'reply_markup'=>$back,
  393. 'parse_mode'=>"Markdown",
  394. 'reply_to_message_id'=>$message_id,
  395. ]);
  396. file_put_contents ("data/user/$from_id/rand","$a");
  397. file_put_contents ("data/user/$from_id/step.txt","rand");
  398. }
  399. elseif($step == "rand" and $text != $o){
  400. $b = file_get_contents ("data/user/$from_id/rand");
  401. if($text != $b){
  402. bot('sendmessage',[
  403. 'chat_id'=> $chat_id,
  404. 'text'=> "❌ حاصل وارد شده اشتباه است . لطفا دوباره تلاش کنید و از اعداد انگلیسی استفاده کنید .",
  405. 'reply_markup'=>$back,
  406. 'parse_mode'=>"Markdown",
  407. 'reply_to_message_id'=>$message_id,
  408. ]);
  409. file_put_contents ("data/user/$from_id/step.txt","rand");
  410. }
  411. else{
  412. $keycart = json_encode(['inline_keyboard' => [
  413. [['text' =>"ارسال رسید",'callback_data'=>"sendres"]],
  414. [['text' =>"خرید مستقیم از طریق زرین پال",'callback_data'=>"zarin"]],
  415. ]]);
  416. bot('sendmessage',[
  417. 'chat_id'=> $chat_id,
  418. 'text'=> "
  419. ✅ احراز هویت با موفقیت انجام شد.
  420.  
  421. ???? برای شارژ حساب خود ابتدا مبلغ مورد نظر خود را به کارت زیر واریز کنید سپس از طریق دکمه ارسال رسید ، رسید بانکی را ارسال کنید .
  422.  
  423. شماره کارت :
  424. `$cart`
  425.  
  426. با کلیک روی شماره کارت به صورت خودکار برای شما کپی می شود .
  427. ",
  428. 'reply_markup'=>$keycart,
  429. 'parse_mode'=>"Markdown",
  430. 'reply_to_message_id'=>$message_id,
  431. ]);
  432. file_put_contents ("data/user/$from_id/step.txt","card");
  433. }
  434. }
  435. #-----------------------------#
  436. if($data == "sendres"){
  437. bot('sendmessage',[
  438. 'chat_id'=> $chat_id,
  439. 'text'=> "✅ لطفا عکس رسید را برای من ارسال کنید :",
  440. 'reply_markup'=>$back,
  441. 'parse_mode'=>"Markdown",
  442. 'reply_to_message_id'=>$message_id,
  443. ]);
  444. file_put_contents ("data/user/$from_id/step.txt","zitactm");
  445. }
  446. elseif($step == "zitactm" and $text != $o){
  447. $photo = $update->message->photo;
  448. $file_id = $update->message->photo[count($update->message->photo) - 1]->file_id;
  449. bot ('sendphoto',[
  450. 'chat_id'=>$dev,
  451. 'photo'=>"$file_id",
  452. 'caption'=>"
  453. ✅ فرستاده شده توسط کاربر `$chat_id`
  454. ",
  455. 'parse_mode'=>"Markdown",
  456.  
  457. ]);
  458. sendmessage ($chat_id,"رسید یا موفقیت ارسال شد ."  , $key1);
  459. file_put_contents ("data/user/$from_id/step.txt","none");
  460. }
  461. #-----------------------------#
  462. if($data == "zarin"){
  463. bot('sendmessage',[
  464. 'chat_id'=> $chat_id,
  465. 'text'=> "
  466. درگاه پرداخت خاموش است .
  467. ",
  468. 'reply_markup'=>$back,
  469. 'parse_mode'=>"Markdown",
  470. 'reply_to_message_id'=>$message_id,
  471. ]);
  472. file_put_contents ("data/user/$from_id/step.txt","none");
  473. }
  474. #-----------------------------#
  475. #-----------------------------#
  476. #-----------------------------#
  477. elseif($from_id == $dev){
  478. if($text == "/panel" || $text == $oo || $text == "پنل"){
  479. bot('sendmessage',[
  480. 'chat_id'=> $chat_id,
  481. 'text'=> "???? سلام ادمین عزیز خوش آمدی :",
  482. 'reply_markup'=>$key3,
  483. 'parse_mode'=>"Markdown",
  484. 'reply_to_message_id'=>$message_id,
  485. ]);
  486. file_put_contents ("data/user/$from_id/step.txt","none");
  487. }
  488. #-----------------------------#
  489. if($text == "➕ افزودن وی پی ان"){
  490. bot('sendmessage',[
  491. 'chat_id'=> $chat_id,
  492. 'text'=> "✅ یکی از سرویس های موجود را انتخاب کنید :",
  493. 'reply_markup'=>$key4,
  494. 'parse_mode'=>"Markdown",
  495. 'reply_to_message_id'=>$message_id,
  496. ]);
  497. file_put_contents ("data/user/$from_id/step.txt","none");
  498. }
  499. #-----------------------------#
  500. if($text == "افزودن کانفیگ"){
  501. bot('sendmessage',[
  502. 'chat_id'=> $chat_id,
  503. 'text'=> "???? لطفا کد کانکشن کانفیگ v2ray را وارد کنید :",
  504. 'reply_markup'=>$bk,
  505. 'parse_mode'=>"Markdown",
  506. 'reply_to_message_id'=>$message_id,
  507. ]);
  508. file_put_contents ("data/user/$from_id/step.txt","cratev2ray");
  509. }
  510. if($step == "cratev2ray" and $text != $oo){
  511. $rand = rand (1000,100000);
  512. file_put_contents ("data/vpn/v2ray/$rand",$text);
  513. bot('sendmessage',[
  514. 'chat_id'=> $chat_id,
  515. 'text'=> "✅???? کانکشن v2ray با موفقیت ذخیره شد و برای فروش اماده شد .",
  516. 'reply_markup'=>$key3,
  517. 'parse_mode'=>"Markdown",
  518. 'reply_to_message_id'=>$message_id,
  519. ]);
  520. file_put_contents ("data/user/$from_id/step.txt","none");
  521. }
  522. #-----------------------------#
  523. if($text == "ℹ سایر خدمات"){
  524. bot('sendmessage',[
  525. 'chat_id'=> $chat_id,
  526. 'text'=> "???? لطفا یکی از دسته های موجود را انتخاب کنید :",
  527. 'reply_markup'=>$key5,
  528. 'parse_mode'=>"Markdown",
  529. 'reply_to_message_id'=>$message_id,
  530. ]);
  531. file_put_contents ("data/user/$from_id/step.txt","none");
  532. }
  533. #-----------------------------#
  534. if($text == "????ثبت شماره کارت"){
  535. bot('sendmessage',[
  536. 'chat_id'=> $chat_id,
  537. 'text'=> "
  538. ✅ شماره کارت خود را با اعداد انگلیسی وارد کنید :
  539.  
  540.  
  541. شماره کارت فعلی : $cart
  542. ",
  543. 'reply_markup'=>$bk,
  544. 'parse_mode'=>"Markdown",
  545. 'reply_to_message_id'=>$message_id,
  546. ]);
  547. file_put_contents ("data/user/$from_id/step.txt","pooya");
  548. }
  549. if($step == "pooya" and $text != $oo){
  550. file_put_contents ("data/cart",$text);
  551. bot('sendmessage',[
  552. 'chat_id'=> $chat_id,
  553. 'text'=> "???? شماره کارت با موفقیت ثبت شد .",
  554. 'reply_markup'=>$key3,
  555. 'parse_mode'=>"Markdown",
  556. 'reply_to_message_id'=>$message_id,
  557. ]);
  558. file_put_contents ("data/user/$from_id/step.txt","none");
  559. }
  560. #-----------------------------#
  561. if($text == "♧ تنظیم متن راهنمای اتصال"){
  562. bot('sendmessage',[
  563. 'chat_id'=> $chat_id,
  564. 'text'=> "
  565. ✅ متن راهنمای اتصال را وارد کنید : انگلیسی یا فارسی یا تلفیقی یا ... مشکلی ندارد .
  566.  
  567. متن فعلی : $helpcont
  568. ",
  569. 'reply_markup'=>$bk,
  570. 'parse_mode'=>"Markdown",
  571. 'reply_to_message_id'=>$message_id,
  572. ]);
  573. file_put_contents ("data/user/$from_id/step.txt","helpo");
  574. }
  575. if($step == "helpo" and $text != $oo){
  576. file_put_contents ("data/helpcont",$text);
  577. bot('sendmessage',[
  578. 'chat_id'=> $chat_id,
  579. 'text'=> "✅ با موفقیت ثبت شد",
  580. 'reply_markup'=>$key3,
  581. 'parse_mode'=>"Markdown",
  582. 'reply_to_message_id'=>$message_id,
  583. ]);
  584. file_put_contents ("data/user/$from_id/step.txt","none");
  585. }
  586. #-----------------------------#
  587. if($text == "???? تعیین قیمت"){
  588. $moni = json_encode(['inline_keyboard' => [
  589. [['text' =>"سرویس v2ray",'callback_data'=>"d1"]],
  590. [['text' =>"سرویس اکسپرس",'callback_data'=>"d2"]],
  591. ]]);
  592. bot('sendmessage',[
  593. 'chat_id'=> $chat_id,
  594. 'text'=> "???? قصد تغییر دادن قیمت کدام سرویس را دارید ؟",
  595. 'reply_markup'=>$moni,
  596. 'parse_mode'=>"Markdown",
  597. 'reply_to_message_id'=>$message_id,
  598. ]);
  599. file_put_contents ("data/user/$from_id/step.txt","none");
  600. }
  601. #-----------------------------#
  602. if($text == "???? وضعیت ربات"){
  603. $scan = scandir ("data/user");
  604. $alluser = count ($scan) - 2;
  605. bot('sendmessage',[
  606. 'chat_id'=> $chat_id,
  607. 'text'=> "
  608. • نوع ربات : اختصاصی ????
  609. • وضعیت ربات : روشن ✅
  610. • تعداد کاربران : $alluser کاربر
  611. ",
  612. 'parse_mode'=>"Markdown",
  613. 'reply_to_message_id'=>$message_id,
  614. ]);
  615. file_put_contents ("data/user/$from_id/step.txt","none");
  616. }
  617. #-----------------------------#
  618. if($text == "➕ افزایش پول"){
  619. bot('sendmessage',[
  620. 'chat_id'=> $chat_id,
  621. 'text'=> "???? لطفا مبلغ مورد نظرتون رو با اعداد انگلیسی و به تومان وارد کنید :",
  622. 'reply_markup'=>$bk,
  623. 'parse_mode'=>"Markdown",
  624. 'reply_to_message_id'=>$message_id,
  625. ]);
  626. file_put_contents ("data/user/$from_id/step.txt","plus");
  627. }
  628. if($step == "plus" and $text != $oo){
  629. file_put_contents ("data/plus",$text);
  630. sendmessage ($chat_id , "???? اکنون ایدی عددی کاربر مورد نظر را وارد کنید ." , $bk);
  631. file_put_contents ("data/user/$from_id/step.txt","plus1"); 
  632. }
  633. if($step == "plus1" and $text != $o){
  634. $coink = file_get_contents ("data/user/$text/coin.txt");
  635. $a = file_get_contents ("data/plus");
  636. $b = $coink + $a;
  637. sendmessage ($chat_id , "✅ با موفقیت انجام شد .");
  638. file_put_contents ("data/user/$text/coin.txt",$b);
  639. sendmessage ($text , "
  640. ???? از طرف مدیریت مبلغ $a تومان برای ما فرستاده شد .
  641. ");
  642. file_put_contents ("data/user/$from_id/step.txt","none"); 
  643. }
  644. #-----------------------------#
  645. if($text == "➖ کاهش پول"){
  646. bot('sendmessage',[
  647. 'chat_id'=> $chat_id,
  648. 'text'=> "???? لطفا مبلغ مورد نظرتون رو با اعداد انگلیسی و به تومان وارد کنید :",
  649. 'reply_markup'=>$bk,
  650. 'parse_mode'=>"Markdown",
  651. 'reply_to_message_id'=>$message_id,
  652. ]);
  653. file_put_contents ("data/user/$from_id/step.txt","pluss");
  654. }
  655. if($step == "pluss" and $text != $oo){
  656. file_put_contents ("data/plus",$text);
  657. sendmessage ($chat_id , "???? اکنون ایدی عددی کاربر مورد نظر را وارد کنید ." , $bk);
  658. file_put_contents ("data/user/$from_id/step.txt","pluss1"); 
  659. }
  660. if($step == "pluss1" and $text != $o){
  661. $coink = file_get_contents ("data/user/$text/coin.txt");
  662. $a = file_get_contents ("data/plus");
  663. $b = $coink - $a;
  664. sendmessage ($chat_id , "✅ با موفقیت انجام شد .");
  665. file_put_contents ("data/user/$text/coin.txt",$b);
  666. sendmessage ($text , "
  667. ???? از طرف مدیریت مبلغ $a تومان از ما کم شد .
  668. ");
  669. file_put_contents ("data/user/$from_id/step.txt","none"); 
  670. }
  671. #-----------------------------#
  672. if($data == "d1"){
  673. bot('sendmessage',[
  674. 'chat_id'=> $chat_id,
  675. 'text'=> "
  676. ???? قیمت مد نظرتون رو برای این سرویس با یک عدد انگلیسی و به تومان وارد کنید .
  677. مثال : 5000
  678.  
  679. قیمت فعلی این سرویس : $v2ray
  680. ",
  681. 'reply_markup'=>$bk,
  682. 'parse_mode'=>"Markdown",
  683. 'reply_to_message_id'=>$message_id,
  684. ]);
  685. file_put_contents ("data/user/$from_id/step.txt","hala");
  686. }
  687. if($step == "hala" and $text != $oo){
  688. file_put_contents ("data/v2ray",$text);
  689. bot('sendmessage',[
  690. 'chat_id'=> $chat_id,
  691. 'text'=> "قیمت سرویس با موفقیت عوض شد .",
  692. 'reply_markup'=>$key3,
  693. 'parse_mode'=>"Markdown",
  694. 'reply_to_message_id'=>$message_id,
  695. ]);
  696. file_put_contents ("data/user/$from_id/step.txt","none");
  697. }
  698. #-----------------------------#
  699. if($data == "d2"){
  700. bot('sendmessage',[
  701. 'chat_id'=> $chat_id,
  702. 'text'=> "
  703. ???? قیمت مد نظرتون رو برای این سرویس با یک عدد انگلیسی و به تومان وارد کنید .
  704. مثال : 5000
  705.  
  706. قیمت فعلی این سرویس : $ex
  707. ",
  708. 'reply_markup'=>$bk,
  709. 'parse_mode'=>"Markdown",
  710. 'reply_to_message_id'=>$message_id,
  711. ]);
  712. file_put_contents ("data/user/$from_id/step.txt","halaa");
  713. }
  714. if($step == "halaa" and $text != $oo){
  715. file_put_contents ("data/ex",$text);
  716. bot('sendmessage',[
  717. 'chat_id'=> $chat_id,
  718. 'text'=> "قیمت سرویس با موفقیت عوض شد .",
  719. 'reply_markup'=>$key3,
  720. 'parse_mode'=>"Markdown",
  721. 'reply_to_message_id'=>$message_id,
  722. ]);
  723. file_put_contents ("data/user/$from_id/step.txt","none");
  724. }
  725. #-----------------------------#
  726. if($text == "???? خدمات ارسال"){
  727. bot('sendmessage',[
  728. 'chat_id'=> $chat_id,
  729. 'text'=> "
  730. ???? یکی از خدمات موجود را انتخاب کنید :
  731. ",
  732. 'reply_markup'=>$key6,
  733. 'parse_mode'=>"Markdown",
  734. 'reply_to_message_id'=>$message_id,
  735. ]);
  736. file_put_contents ("data/user/$from_id/step.txt","none");
  737. }
  738. #-----------------------------#
  739. if($text == "???? تنظیمات مالی"){
  740. bot('sendmessage',[
  741. 'chat_id'=> $chat_id,
  742. 'text'=> "???? یکی از خدمات موجود را انتخاب کنید :",
  743. 'reply_markup'=>$key7,
  744. 'parse_mode'=>"Markdown",
  745. 'reply_to_message_id'=>$message_id,
  746. ]);
  747. file_put_contents ("data/user/$from_id/step.txt","none");
  748. }
  749. #-----------------------------#
  750. if($text == "???? ارسال همگانی"){
  751. bot('sendmessage',[
  752. 'chat_id'=> $chat_id,
  753. 'text'=> "???? متن مورد نظرتون رو برای من ارسال کنید :",
  754. 'reply_markup'=>$bk,
  755. 'parse_mode'=>"Markdown",
  756. 'reply_to_message_id'=>$message_id,
  757. ]);
  758. file_put_contents ("data/user/$from_id/step.txt","senall");
  759. }
  760. elseif($step == "senall" and $text != $oo){
  761. if($text){
  762. $allmmber = scandir ("data/user");
  763. foreach ($allmmber as $sendall){
  764. sendmessage ($sendall , $text);
  765. }
  766. sendmessage ($chat_id , "✅ پیام شما با موفقیت ارسال شد ‌.");
  767. file_put_contents ("data/user/$from_id/step.txt","none"); 
  768. }else{
  769. sendmessage ($chat_id , "???? شما فقط میتوانید متن ارسال کنید .");
  770. }
  771. }
  772. #-----------------------------#
  773. if($text == "???? فوروارد همگانی"){
  774. bot('sendmessage',[
  775. 'chat_id'=> $chat_id,
  776. 'text'=> "???? رسانه مورد نظرتون رو برای من ارسال کنید :",
  777. 'reply_markup'=>$bk,
  778. 'parse_mode'=>"Markdown",
  779. 'reply_to_message_id'=>$message_id,
  780. ]);
  781. file_put_contents ("data/user/$from_id/step.txt","senalll");
  782. }
  783. elseif($step == "senalll" and $text != $oo){
  784. $allmmber = scandir ("data/user");
  785. foreach ($allmmber as $sendall){
  786. bot('forwardMessage',[
  787. 'from_chat_id'=> $from_id,
  788. 'message_id'=> $message_id,
  789. 'chat_id'=> $sendall,
  790. ]);
  791. }
  792. sendmessage ($chat_id , "✅ پیام شما با موفقیت ارسال شد ‌.");
  793. file_put_contents ("data/user/$from_id/step.txt","none"); 
  794. }
  795. #-----------------------------#
  796. if($text == "???? تنظیمات کانال"){
  797. $keykhoda = json_encode(['keyboard'=>[
  798. [['text'=>"خاموش|روشن قفل"],['text'=>"ست کانال"]],
  799. [['text'=>"$oo"]],
  800. ],'resize_keyboard' =>true]);
  801. sendmessage ($chat_id , "⚙ یکی از وضعیت های موجود را انتخاب کنید :" , $keykhoda);
  802. }
  803. elseif($text == "خاموش|روشن قفل"){
  804. if ($pooyaosm == "خاموش"){
  805. file_put_contents ("data/osm","روشن");
  806. sendmessage ($chat_id , "????قفل جوین اجباری کانال فعال شد .");
  807. file_put_contents ("data/user/$from_id/step.txt","none"); 
  808. }else{
  809. file_put_contents ("data/osm","خاموش");
  810. sendmessage ($chat_id , "????قفل جوین اجباری کانال غیر فعال شد .");
  811. file_put_contents ("data/user/$from_id/step.txt","none"); 
  812. }
  813. }
  814. if($text == "افزودن اکسپرس"){
  815. sendmessage ($chat_id , "اپدیت اینده اضافه می شود .");
  816. }
  817. #-----------------------------#
  818. if($text == "❌ حذف کل اکانتها"){
  819. DeleteDirectory ("data/vpn");
  820. bot('sendmessage',[
  821. 'chat_id'=> $chat_id,
  822. 'text'=> "✅ تمام اکانت های ثبت شده برای فروش از سرور ربات پاک شدند ‌.",
  823. 'parse_mode'=>"Markdown",
  824. 'reply_to_message_id'=>$message_id,
  825. ]);
  826. file_put_contents ("data/user/$from_id/step.txt","none");
  827. }
  828. #-----------------------------#
  829.  
  830.  
  831.  
  832.  
  833. #-----------------------------#
  834.  
  835. if($text == "⚙ تنظیمات مدیریتی"){
  836. sendmessage ($chat_id , "???? یکی از تنظیمات موجود را انتخاب کنید :" , $key8);
  837. file_put_contents ("data/user/$from_id/step.txt","none"); 
  838. }
  839.  
  840. if($text == "???? پول همگانی"){
  841. sendmessage ($chat_id , "???? لطفا مبلغ را به تومان و با اعداد انگلیسی وارد کنید :" , $bk);
  842. file_put_contents ("data/user/$from_id/step.txt","cow"); 
  843. }
  844. if($step == "cow" and $text != $oo){
  845. $allmmber = scandir ("data/user");
  846. foreach ($allmmber as $alluser){
  847. $a = file_get_contents ("data/user/$alluser/coin.txt");
  848. $b = $a + $text;
  849. file_put_contents ("data/user/$alluser/coin.txt",$b);
  850. sendmessage ($alluser , "???? از طرف مدیریت مبلغ $text تومان به صورت #همگانی به ما تعلق گرفت .");
  851. }
  852. sendmessage ($chat_id , "???? مبلغ $text تومان به همه ی کاربران ربات ارسال شد ." );
  853. file_put_contents ("data/user/$from_id/step.txt","none");
  854. }
  855.  
  856. #-----------------------------#
  857. if($text == "????ساخت کد هدیه"){
  858. sendmessage ($chat_id , "????مبلغ کد هدیه را وارد کنید .
  859.  
  860. عدد انگلیسی و به تومان
  861. "  , $bk);
  862. file_put_contents ("data/user/$from_id/step.txt","okpooya"); 
  863. }
  864. if($step == "okpooya" and $text != $oo){
  865.     $rand = rand (10000,100000);
  866.     file_put_contents ("data/code/$rand",$text);
  867.     sendmessage ($chat_id , "کد هدیه با موفقیت ساخته شد و به کانال مورد نظر ارسال گردید . /n کد هدیه : $rand");
  868. file_put_contents ("data/user/$from_id/step.txt","none"); 
  869. }
  870. #-----------------------------#
  871.  
  872. if ($text == "ست کانال"){
  873.     
  874.     bot ('sendmessage',[
  875.     'chat_id'=>$chat_id,
  876.     'text'=>"آیدی کانال خود را بدون @ ارسال کنید .",
  877.     'reply_markup'=>$bk,
  878.     ]);
  879.     
  880.     file_put_contents ("data/user/$from_id/step.txt","setidok");
  881.  
  882. }
  883.  
  884. if ($step == "setidok" and $text != $oo){
  885.     bot ('sendmessage',[
  886.     'chat_id'=>$chat_id,
  887.     'text'=>"کانال @$text با موفقیت ذخیره شد",
  888.     'reply_markup'=>$bk,
  889.     ]);
  890.     file_put_contents ("data/channel","$text");
  891.     file_put_contents ("data/user/$from_id/step.txt","none");
  892. }
  893.  
  894. } //
  895. #-----------------------------#
  896. #-----------------------------#
  897. #-----------------------------#
  898. ?>
File Description
  • bot
  • PHP Code
  • 29 May-2023
  • 29 Kb
You can Share it: