Some fixes

This commit is contained in:
Daniil Gentili 2019-07-23 13:07:54 +02:00
parent c31f4493a1
commit 9bf529b483
3 changed files with 26 additions and 6 deletions

View File

@ -59,7 +59,7 @@ class EventHandler extends \danog\MadelineProto\EventHandler
} }
$settings = ['logger' => ['logger_level' => 5]]; $settings = ['logger' => ['logger_level' => 5]];
$MadelineProto = new \danog\MadelineProto\API('testing.madeline', $settings); $MadelineProto = new \danog\MadelineProto\API('bot.madeline', $settings);
$MadelineProto->async(true); $MadelineProto->async(true);
$MadelineProto->loop(function () use ($MadelineProto) { $MadelineProto->loop(function () use ($MadelineProto) {
yield $MadelineProto->start(); yield $MadelineProto->start();

2
docs

@ -1 +1 @@
Subproject commit 8f6784adf5bca1dbab98ba1ec69ab52050633ca1 Subproject commit ddb2e4f76938b69ceac6e4615901c642accae1ef

View File

@ -576,7 +576,7 @@ trait TL
$serialized .= pack('@4'); $serialized .= pack('@4');
continue; continue;
} }
if (in_array($current_argument['type'], ['bytes', 'string', 'Vector t'])) { if (in_array($current_argument['type'], ['bytes', 'string'])) {
$serialized .= pack('@4'); $serialized .= pack('@4');
continue; continue;
} }
@ -588,10 +588,30 @@ trait TL
$serialized .= $id['id']; $serialized .= $id['id'];
continue; continue;
} }
switch ($current_argument['type']) {
throw new Exception(\danog\MadelineProto\Lang::$current_lang['params_missing'], $current_argument['name']); case 'Vector t':
case 'vector':
$arguments[$current_argument['name']] = [];
break;
/*
case 'long':
$serialized .= $this->random(8);
continue 2;
case 'int':
$serialized .= $this->random(4);
continue 2;
case 'string':
case 'bytes':
$arguments[$current_argument['name']] = '';
break;
case 'Bool':
$arguments[$current_argument['name']] = false;
break;
default:
$arguments[$current_argument['name']] = ['_' => $this->constructors->find_by_type($current_argument['type'])['predicate']];
break;*/
}
} }
if (in_array($current_argument['type'], ['DataJSON', '%DataJSON'])) { if (in_array($current_argument['type'], ['DataJSON', '%DataJSON'])) {
$arguments[$current_argument['name']] = ['_' => 'dataJSON', 'data' => json_encode($arguments[$current_argument['name']])]; $arguments[$current_argument['name']] = ['_' => 'dataJSON', 'data' => json_encode($arguments[$current_argument['name']])];
} }