Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * This file is part of the TelegramBot package.
- *
- * (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * Written by Marco Boretto <marco.bore@gmail.com>
- */
- namespace Longman\TelegramBot\Commands\UserCommands;
- use Longman\TelegramBot\Commands\UserCommand;
- use Longman\TelegramBot\Entities\Keyboard;
- use Longman\TelegramBot\Request;
- use Blocktrail\SDK\BlocktrailSDK;
- use i18n;
- use Lang;
- /**
- * User "/whoami" command
- *
- * Simple command that returns info about the current user.
- */
- class DepositCommand extends UserCommand
- {
- /**
- * @var string
- */
- protected $name = 'deposit';
- /**
- * @var string
- */
- protected $description = 'Handle deposit address';
- /**
- * @var string
- */
- protected $usage = '/deposit';
- /**
- * @var string
- */
- protected $version = '1.0.0';
- /**
- * @var bool
- */
- protected $private_only = true;
- /**
- * Command execute method
- *
- * @return \Longman\TelegramBot\Entities\ServerResponse
- * @throws \Longman\TelegramBot\Exception\TelegramException
- */
- public function execute()
- {
- //message data
- $message = $this->getMessage();
- $from = $message->getFrom();
- $chat_id = $message->getChat()->getId();
- //user language
- $lang = getLanguage($chat_id);
- //balances
- $btcBalance = BlocktrailSDK::toBTC(getBtcBalance($chat_id));
- $payeerBalance = getPayeerBalance($chat_id);
- $pmBalance = getPmBalance($chat_id);
- $i18n = new i18n('lang/lang_{LANGUAGE}.ini', 'langcache', 'en');
- $i18n->setForcedLang($lang);
- $i18n->init();
- //emojis list
- $balance = json_decode('"\uD83D\uDCB0"')." ".Lang::keyboard_balance." $btcBalance BTC";
- $deposit = json_decode('"\uD83C\uDFDB"')." ".Lang::keyboard_deposit;
- $withdraw = json_decode('"\uD83D\uDCB3"')." ".Lang::keyboard_withdraw;
- $reinvest = json_decode('"\u267B"')." ".Lang::keyboard_reinvest;
- $history = json_decode('"\uD83D\uDCCA"')." ".Lang::keyboard_history;
- $referrals = json_decode('"\uD83C\uDFC6"')." ".Lang::keyboard_referrals;
- $help = json_decode('"\uD83D\uDCE7"')." ".Lang::keyboard_help;
- $statistics = json_decode('"\uD83D\uDCC8"')." ".Lang::keyboard_statistics;
- $keyboard = new Keyboard(
- [$balance],
- [$deposit, $withdraw],
- [$history, $referrals],
- [$help, $statistics]
- );
- $keyboard = $keyboard->setResizeKeyboard(true)->setOneTimeKeyboard(false)->setSelective(true);
- //Send chat action
- Request::sendChatAction([
- 'chat_id' => $chat_id,
- 'action' => 'typing',
- ]);
- sleep(0.7);
- return Request::sendMessage([
- 'chat_id' => $chat_id,
- 'text' => Lang::deposit_tip. PHP_EOL . PHP_EOL .
- "BTC: ".Lang::deposit_btc. PHP_EOL . PHP_EOL .
- "PAYEER: ".Lang::deposit_payeer. PHP_EOL . PHP_EOL .
- "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)),
- 'parse_mode' => 'HTML',
- 'reply_markup' => $keyboard,
- ]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement