Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. <?php
  2. /**
  3. * This file is part of the TelegramBot package.
  4. *
  5. * (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. *
  10. * Written by Marco Boretto <marco.bore@gmail.com>
  11. */
  12.  
  13. namespace Longman\TelegramBot\Commands\UserCommands;
  14.  
  15. use Longman\TelegramBot\Commands\UserCommand;
  16. use Longman\TelegramBot\Entities\Keyboard;
  17. use Longman\TelegramBot\Request;
  18. use Blocktrail\SDK\BlocktrailSDK;
  19. use i18n;
  20. use Lang;
  21.  
  22. /**
  23. * User "/whoami" command
  24. *
  25. * Simple command that returns info about the current user.
  26. */
  27. class DepositCommand extends UserCommand
  28. {
  29. /**
  30. * @var string
  31. */
  32. protected $name = 'deposit';
  33.  
  34. /**
  35. * @var string
  36. */
  37. protected $description = 'Handle deposit address';
  38.  
  39. /**
  40. * @var string
  41. */
  42. protected $usage = '/deposit';
  43.  
  44. /**
  45. * @var string
  46. */
  47. protected $version = '1.0.0';
  48.  
  49. /**
  50. * @var bool
  51. */
  52. protected $private_only = true;
  53.  
  54. /**
  55. * Command execute method
  56. *
  57. * @return \Longman\TelegramBot\Entities\ServerResponse
  58. * @throws \Longman\TelegramBot\Exception\TelegramException
  59. */
  60. public function execute()
  61. {
  62. //message data
  63. $message = $this->getMessage();
  64. $from = $message->getFrom();
  65. $chat_id = $message->getChat()->getId();
  66. //user language
  67. $lang = getLanguage($chat_id);
  68. //balances
  69. $btcBalance = BlocktrailSDK::toBTC(getBtcBalance($chat_id));
  70. $payeerBalance = getPayeerBalance($chat_id);
  71. $pmBalance = getPmBalance($chat_id);
  72.  
  73. $i18n = new i18n('lang/lang_{LANGUAGE}.ini', 'langcache', 'en');
  74. $i18n->setForcedLang($lang);
  75. $i18n->init();
  76.  
  77. //emojis list
  78. $balance = json_decode('"\uD83D\uDCB0"')." ".Lang::keyboard_balance." $btcBalance BTC";
  79. $deposit = json_decode('"\uD83C\uDFDB"')." ".Lang::keyboard_deposit;
  80. $withdraw = json_decode('"\uD83D\uDCB3"')." ".Lang::keyboard_withdraw;
  81. $reinvest = json_decode('"\u267B"')." ".Lang::keyboard_reinvest;
  82. $history = json_decode('"\uD83D\uDCCA"')." ".Lang::keyboard_history;
  83. $referrals = json_decode('"\uD83C\uDFC6"')." ".Lang::keyboard_referrals;
  84. $help = json_decode('"\uD83D\uDCE7"')." ".Lang::keyboard_help;
  85. $statistics = json_decode('"\uD83D\uDCC8"')." ".Lang::keyboard_statistics;
  86.  
  87. $keyboard = new Keyboard(
  88. [$balance],
  89. [$deposit, $withdraw],
  90. [$history, $referrals],
  91. [$help, $statistics]
  92. );
  93.  
  94. $keyboard = $keyboard->setResizeKeyboard(true)->setOneTimeKeyboard(false)->setSelective(true);
  95.  
  96. //Send chat action
  97. Request::sendChatAction([
  98. 'chat_id' => $chat_id,
  99. 'action' => 'typing',
  100. ]);
  101.  
  102. sleep(0.7);
  103.  
  104. return Request::sendMessage([
  105. 'chat_id' => $chat_id,
  106. 'text' => Lang::deposit_tip. PHP_EOL . PHP_EOL .
  107. "BTC: ".Lang::deposit_btc. PHP_EOL . PHP_EOL .
  108. "PAYEER: ".Lang::deposit_payeer. PHP_EOL . PHP_EOL .
  109. "PERFECTMONEY: ".Lang::deposit_pm. PHP_EOL . PHP_EOL . PHP_EOL .str_replace('{MINIMUM_BTC}', rtrim(BlocktrailSDK::toBTC(PLAN1_BTC_MIN), 0), str_replace('{MINIMUM_USD}', number_format((PLAN1_USD_MIN/100), 2, '.', ' '), Lang::deposit_minimum)),
  110. 'parse_mode' => 'HTML',
  111. 'reply_markup' => $keyboard,
  112. ]);
  113. }
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement