@@ -9,39 +9,39 @@ |
||
| 9 | 9 | * examples). |
| 10 | 10 | */ |
| 11 | 11 | class replyKeyboardMarkup extends types { |
| 12 | - /** Keep all of properties which has sub properties */ |
|
| 13 | - private const subs = []; |
|
| 14 | - |
|
| 15 | - /** Array of button rows, each represented by an Array of KeyboardButton objects */ |
|
| 16 | - public array $keyboard; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller |
|
| 20 | - * if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the |
|
| 21 | - * same height as the app's standard keyboard. |
|
| 22 | - */ |
|
| 23 | - public bool $resize_keyboard; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be |
|
| 27 | - * available, but clients will automatically display the usual letter-keyboard in the chat – the user can press |
|
| 28 | - * a special button in the input field to see the custom keyboard again. Defaults to false. |
|
| 29 | - */ |
|
| 30 | - public bool $one_time_keyboard; |
|
| 31 | - |
|
| 32 | - /** Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */ |
|
| 33 | - public string $input_field_placeholder; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that |
|
| 37 | - * are mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), |
|
| 38 | - * sender of the original message.Example: A user requests to change the bot's language, bot replies to the |
|
| 39 | - * request with a keyboard to select the new language. Other users in the group don't see the keyboard. |
|
| 40 | - */ |
|
| 41 | - public bool $selective; |
|
| 42 | - |
|
| 43 | - |
|
| 44 | - public function __construct(stdClass $update) { |
|
| 45 | - parent::__construct($update, self::subs); |
|
| 46 | - } |
|
| 12 | + /** Keep all of properties which has sub properties */ |
|
| 13 | + private const subs = []; |
|
| 14 | + |
|
| 15 | + /** Array of button rows, each represented by an Array of KeyboardButton objects */ |
|
| 16 | + public array $keyboard; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller |
|
| 20 | + * if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the |
|
| 21 | + * same height as the app's standard keyboard. |
|
| 22 | + */ |
|
| 23 | + public bool $resize_keyboard; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be |
|
| 27 | + * available, but clients will automatically display the usual letter-keyboard in the chat – the user can press |
|
| 28 | + * a special button in the input field to see the custom keyboard again. Defaults to false. |
|
| 29 | + */ |
|
| 30 | + public bool $one_time_keyboard; |
|
| 31 | + |
|
| 32 | + /** Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */ |
|
| 33 | + public string $input_field_placeholder; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that |
|
| 37 | + * are mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), |
|
| 38 | + * sender of the original message.Example: A user requests to change the bot's language, bot replies to the |
|
| 39 | + * request with a keyboard to select the new language. Other users in the group don't see the keyboard. |
|
| 40 | + */ |
|
| 41 | + public bool $selective; |
|
| 42 | + |
|
| 43 | + |
|
| 44 | + public function __construct(stdClass $update) { |
|
| 45 | + parent::__construct($update, self::subs); |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -8,56 +8,56 @@ |
||
| 8 | 8 | * This object contains information about a poll. |
| 9 | 9 | */ |
| 10 | 10 | class poll extends types { |
| 11 | - /** Keep all of properties which has sub properties */ |
|
| 12 | - private const subs = []; |
|
| 11 | + /** Keep all of properties which has sub properties */ |
|
| 12 | + private const subs = []; |
|
| 13 | 13 | |
| 14 | - /** Unique poll identifier */ |
|
| 15 | - public string $id; |
|
| 14 | + /** Unique poll identifier */ |
|
| 15 | + public string $id; |
|
| 16 | 16 | |
| 17 | - /** Poll question, 1-300 characters */ |
|
| 18 | - public string $question; |
|
| 17 | + /** Poll question, 1-300 characters */ |
|
| 18 | + public string $question; |
|
| 19 | 19 | |
| 20 | - /** List of poll options */ |
|
| 21 | - public array $options; |
|
| 20 | + /** List of poll options */ |
|
| 21 | + public array $options; |
|
| 22 | 22 | |
| 23 | - /** Total number of users that voted in the poll */ |
|
| 24 | - public int $total_voter_count; |
|
| 23 | + /** Total number of users that voted in the poll */ |
|
| 24 | + public int $total_voter_count; |
|
| 25 | 25 | |
| 26 | - /** True, if the poll is closed */ |
|
| 27 | - public bool $is_closed; |
|
| 26 | + /** True, if the poll is closed */ |
|
| 27 | + public bool $is_closed; |
|
| 28 | 28 | |
| 29 | - /** True, if the poll is anonymous */ |
|
| 30 | - public bool $is_anonymous; |
|
| 29 | + /** True, if the poll is anonymous */ |
|
| 30 | + public bool $is_anonymous; |
|
| 31 | 31 | |
| 32 | - /** Poll type, currently can be “regular” or “quiz” */ |
|
| 33 | - public string $type; |
|
| 32 | + /** Poll type, currently can be “regular” or “quiz” */ |
|
| 33 | + public string $type; |
|
| 34 | 34 | |
| 35 | - /** True, if the poll allows multiple answers */ |
|
| 36 | - public bool $allows_multiple_answers; |
|
| 35 | + /** True, if the poll allows multiple answers */ |
|
| 36 | + public bool $allows_multiple_answers; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which |
|
| 40 | - * are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. |
|
| 41 | - */ |
|
| 42 | - public int $correct_option_id; |
|
| 38 | + /** |
|
| 39 | + * Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which |
|
| 40 | + * are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. |
|
| 41 | + */ |
|
| 42 | + public int $correct_option_id; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style |
|
| 46 | - * poll, 0-200 characters |
|
| 47 | - */ |
|
| 48 | - public string $explanation; |
|
| 44 | + /** |
|
| 45 | + * Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style |
|
| 46 | + * poll, 0-200 characters |
|
| 47 | + */ |
|
| 48 | + public string $explanation; |
|
| 49 | 49 | |
| 50 | - /** Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation */ |
|
| 51 | - public array $explanation_entities; |
|
| 50 | + /** Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation */ |
|
| 51 | + public array $explanation_entities; |
|
| 52 | 52 | |
| 53 | - /** Optional. Amount of time in seconds the poll will be active after creation */ |
|
| 54 | - public int $open_period; |
|
| 53 | + /** Optional. Amount of time in seconds the poll will be active after creation */ |
|
| 54 | + public int $open_period; |
|
| 55 | 55 | |
| 56 | - /** Optional. Point in time (Unix timestamp) when the poll will be automatically closed */ |
|
| 57 | - public int $close_date; |
|
| 56 | + /** Optional. Point in time (Unix timestamp) when the poll will be automatically closed */ |
|
| 57 | + public int $close_date; |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | - public function __construct(stdClass $update) { |
|
| 61 | - parent::__construct($update, self::subs); |
|
| 62 | - } |
|
| 60 | + public function __construct(stdClass $update) { |
|
| 61 | + parent::__construct($update, self::subs); |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @method static getGameHigh (int|null $user_id = null, int|null $chat_id = null, int|null $message_id = null, string|null $inline_message_id = null, string|null $token = null, bool|null $return_array = null, bool|null $forgot = null, bool|null $answer = null) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects. |
| 215 | 215 | */ |
| 216 | 216 | class telegram {
|
| 217 | - public function __call (string $name, array $arguments) {
|
|
| 217 | + public function __call(string $name, array $arguments) {
|
|
| 218 | 218 | if (!isset($arguments[1]) && is_array($arguments[0])) {
|
| 219 | 219 | request::$name(...$arguments[0]); |
| 220 | 220 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - public static function __callStatic (string $name, array $arguments) {
|
|
| 226 | + public static function __callStatic(string $name, array $arguments) {
|
|
| 227 | 227 | if (!isset($arguments[1]) && is_array($arguments[0])) {
|
| 228 | 228 | request::$name(...$arguments[0]); |
| 229 | 229 | } |
@@ -6,8 +6,7 @@ discard block |
||
| 6 | 6 | public function __call (string $name, array $arguments) {
|
| 7 | 7 | if (!isset($arguments[1]) && is_array($arguments[0])) {
|
| 8 | 8 | request::$name(...$arguments[0]); |
| 9 | - } |
|
| 10 | - else {
|
|
| 9 | + } else {
|
|
| 11 | 10 | request::$name($arguments); |
| 12 | 11 | } |
| 13 | 12 | } |
@@ -15,8 +14,7 @@ discard block |
||
| 15 | 14 | public static function __callStatic (string $name, array $arguments) {
|
| 16 | 15 | if (!isset($arguments[1]) && is_array($arguments[0])) {
|
| 17 | 16 | request::$name(...$arguments[0]); |
| 18 | - } |
|
| 19 | - else {
|
|
| 17 | + } else {
|
|
| 20 | 18 | request::$name(...$arguments); |
| 21 | 19 | } |
| 22 | 20 | } |
@@ -225,18 +225,18 @@ discard block |
||
| 225 | 225 | ]; |
| 226 | 226 | |
| 227 | 227 | |
| 228 | - public static function __callStatic (string $name, array $arguments) {
|
|
| 228 | + public static function __callStatic(string $name, array $arguments) {
|
|
| 229 | 229 | if ($action = self::methodAction($name)) {
|
| 230 | - self::keysName($action,$arguments); |
|
| 231 | - self::readyFile($action,$arguments); |
|
| 230 | + self::keysName($action, $arguments); |
|
| 231 | + self::readyFile($action, $arguments); |
|
| 232 | 232 | print_r($arguments); |
| 233 | 233 | } |
| 234 | 234 | else {
|
| 235 | - logger::write("$name method is not supported",'error');
|
|
| 235 | + logger::write("$name method is not supported", 'error');
|
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - private static function keysName (string $name, array &$arguments) {
|
|
| 239 | + private static function keysName(string $name, array &$arguments) {
|
|
| 240 | 240 | foreach ($arguments as $key => $argument) {
|
| 241 | 241 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) {
|
| 242 | 242 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - private static function methodAction(string $name): string|false {
|
|
| 248 | + private static function methodAction(string $name): string | false {
|
|
| 249 | 249 | return self::METHODS_ACTION[strtolower($name)] ?? false; |
| 250 | 250 | } |
| 251 | 251 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - private static function methodFile(string $name): array|false {
|
|
| 269 | + private static function methodFile(string $name): array | false {
|
|
| 270 | 270 | return self::METHODS_WITH_FILE[$name] ?? false; |
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | \ No newline at end of file |
@@ -230,8 +230,7 @@ discard block |
||
| 230 | 230 | self::keysName($action,$arguments); |
| 231 | 231 | self::readyFile($action,$arguments); |
| 232 | 232 | print_r($arguments); |
| 233 | - } |
|
| 234 | - else {
|
|
| 233 | + } else {
|
|
| 235 | 234 | logger::write("$name method is not supported",'error');
|
| 236 | 235 | } |
| 237 | 236 | } |
@@ -256,8 +255,7 @@ discard block |
||
| 256 | 255 | $arguments['media'][$key]['media'] = new CURLFile($media['media']); |
| 257 | 256 | } |
| 258 | 257 | } |
| 259 | - } |
|
| 260 | - elseif ($file_params = self::methodFile($name)) {
|
|
| 258 | + } elseif ($file_params = self::methodFile($name)) {
|
|
| 261 | 259 | foreach ($file_params as $param) {
|
| 262 | 260 | if (isset($arguments[$param]) && file_exists($arguments[$param])) {
|
| 263 | 261 | $arguments[$param] = new CURLFile($arguments[$param]); |
@@ -8,20 +8,20 @@ |
||
| 8 | 8 | * This object represents an animated emoji that displays a random value. |
| 9 | 9 | */ |
| 10 | 10 | class dice extends types { |
| 11 | - /** Keep all of properties which has sub properties */ |
|
| 12 | - private const subs = []; |
|
| 11 | + /** Keep all of properties which has sub properties */ |
|
| 12 | + private const subs = []; |
|
| 13 | 13 | |
| 14 | - /** Emoji on which the dice throw animation is based */ |
|
| 15 | - public string $emoji; |
|
| 14 | + /** Emoji on which the dice throw animation is based */ |
|
| 15 | + public string $emoji; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Value of the dice, 1-6 for “ |
|
@@ -6,3525 +6,3525 @@ |
||
| 6 | 6 | * Emojis class for simple emoji usage |
| 7 | 7 | */ |
| 8 | 8 | class emojis { |
| 9 | - public const GRINNING_FACE = ' |
|
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | use BPT\types\update; |
| 11 | 11 | |
| 12 | 12 | class webhook {
|
| 13 | - public static function init () {
|
|
| 13 | + public static function init() {
|
|
| 14 | 14 | if (lock::exist('BPT-HOOK')) {
|
| 15 | 15 | self::telegramVerify(); |
| 16 | 16 | BPT::$update = self::processUpdate(); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public static function telegramVerify() {
|
| 24 | 24 | if (settings::$telegram_verify) {
|
| 25 | 25 | if (!tools::isTelegram($_SERVER['REMOTE_ADDR'])) {
|
| 26 | - logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'],'error');
|
|
| 26 | + logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'], 'error');
|
|
| 27 | 27 | BPT::close(); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -14,8 +14,7 @@ discard block |
||
| 14 | 14 | if (lock::exist('BPT-HOOK')) {
|
| 15 | 15 | self::telegramVerify(); |
| 16 | 16 | BPT::$update = self::processUpdate(); |
| 17 | - } |
|
| 18 | - else {
|
|
| 17 | + } else {
|
|
| 19 | 18 | self::deleteOldLocks(); |
| 20 | 19 | } |
| 21 | 20 | } |
@@ -33,8 +32,7 @@ discard block |
||
| 33 | 32 | $update = json_decode(file_get_contents("php://input"));
|
| 34 | 33 | if ($update) {
|
| 35 | 34 | return new update($update); |
| 36 | - } |
|
| 37 | - else {
|
|
| 35 | + } else {
|
|
| 38 | 36 | BPT::close(); |
| 39 | 37 | } |
| 40 | 38 | } |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | public static function init() {
|
| 9 | 9 | if (lock::exist('BPT-MULTI')) {
|
| 10 | 10 | |
| 11 | - } |
|
| 12 | - else {
|
|
| 11 | + } else {
|
|
| 13 | 12 | |
| 14 | 13 | } |
| 15 | 14 | } |
@@ -16,11 +16,11 @@ |
||
| 16 | 16 | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public static function read(string $name): bool|string {
|
|
| 19 | + public static function read(string $name): bool | string {
|
|
| 20 | 20 | return file_get_contents("$name.lock");
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public static function mtime(string $name): bool|int {
|
|
| 23 | + public static function mtime(string $name): bool | int {
|
|
| 24 | 24 | return filemtime("$name.lock");
|
| 25 | 25 | } |
| 26 | 26 | |