Bugfixes
This commit is contained in:
parent
e1865b8b53
commit
74acdc8810
@ -13,6 +13,7 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require '../vendor/autoload.php';
|
||||
$settings = [];
|
||||
$settings = ["app_info"=>["api_id"=>6,"api_hash"=>"eb06d4abfb49dc3eeb1aeb98ae0f581e"]];
|
||||
$MadelineProto = false;
|
||||
try {
|
||||
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('MadelineProto_bot.madeline');
|
||||
@ -66,11 +67,11 @@ while (true) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
if (preg_match('|/start|', $update['update']['message']['message'])) {
|
||||
if (isset($update['update']['message']['message']) &&preg_match('|/start|', $update['update']['message']['message'])) {
|
||||
$MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => $start, 'reply_to_msg_id' => $update['update']['message']['id'], 'parse_mode' => 'markdown', 'reply_markup' => $reply_markup]);
|
||||
}
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
|
||||
//$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
|
||||
}
|
||||
break;
|
||||
case 'updateNewChannelMessage':
|
||||
@ -82,9 +83,9 @@ while (true) {
|
||||
$MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['to_id'], 'message' => $start, 'reply_to_msg_id' => $update['update']['message']['id'], 'parse_mode' => 'markdown', 'reply_markup' => $reply_markup]);
|
||||
}
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
|
||||
//$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
|
||||
//$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
|
||||
}
|
||||
break;
|
||||
case 'updateBotInlineQuery':
|
||||
|
@ -12,13 +12,19 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require '../vendor/autoload.php';
|
||||
$settings = [];
|
||||
$settings = ["app_info"=>["api_id"=>6,"api_hash"=>"eb06d4abfb49dc3eeb1aeb98ae0f581e"]];
|
||||
$MadelineProto = false;
|
||||
$uMadelineProto = false;
|
||||
try {
|
||||
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('pipesbot.madeline');
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
try {
|
||||
$uMadelineProto = \danog\MadelineProto\Serialization::deserialize('pwr.madeline');
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
$uMadelineProto = \danog\MadelineProto\Serialization::deserialize('pwr.madeline');
|
||||
if (file_exists('token.php') && $MadelineProto === false) {
|
||||
include_once 'token.php';
|
||||
$MadelineProto = new \danog\MadelineProto\API($settings);
|
||||
@ -27,7 +33,7 @@ if (file_exists('token.php') && $MadelineProto === false) {
|
||||
}
|
||||
if ($uMadelineProto === false) {
|
||||
echo 'Loading MadelineProto...'.PHP_EOL;
|
||||
$uMadelineProto = new \danog\MadelineProto\API(['updates' => ['handle_updates' => false]]);
|
||||
$uMadelineProto = new \danog\MadelineProto\API(array_merge($settings, ['updates' => ['handle_updates' => false]]));
|
||||
$sentCode = $uMadelineProto->phone_login(readline());
|
||||
\danog\MadelineProto\Logger::log([$sentCode], \danog\MadelineProto\Logger::NOTICE);
|
||||
echo 'Enter the code you received: ';
|
||||
@ -145,7 +151,7 @@ var_dump($update);
|
||||
$query = array_shift($exploded);
|
||||
foreach ($exploded as $current => $botq) {
|
||||
$bot = preg_replace('|:.*|', '', $botq);
|
||||
if ($bot === '' || $uMadelineProto->get_info($bot)['bot_api_id'] === $MadelineProto->API->datacenter->authorization['user']['id']) {
|
||||
if ($bot === '' || $uMadelineProto->get_info($bot)['bot_api_id'] === $MadelineProto->API->authorization['user']['id']) {
|
||||
$toset['switch_pm'] = $sswitch;
|
||||
break;
|
||||
}
|
||||
@ -213,6 +219,6 @@ var_dump($update);
|
||||
}
|
||||
}
|
||||
}
|
||||
\danog\MadelineProto\Serialization::serialize('bot.madeline', $MadelineProto);
|
||||
\danog\MadelineProto\Serialization::serialize('pipesbot.madeline', $MadelineProto);
|
||||
\danog\MadelineProto\Serialization::serialize('pwr.madeline', $uMadelineProto);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
"erusev/parsedown": "^1.6",
|
||||
"rollbar/rollbar": "dev-master",
|
||||
"ext-mbstring": "*",
|
||||
"ext-curl"
|
||||
"ext-curl": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpdocumentor/reflection-docblock": "^3.1"
|
||||
|
Loading…
Reference in New Issue
Block a user