|
1 | 1 | <?php declare(strict_types=1); |
2 | 2 |
|
3 | 3 | use danog\MadelineProto\API; |
| 4 | +use danog\MadelineProto\Exception; |
4 | 5 | use danog\MadelineProto\Logger; |
5 | 6 | use danog\MadelineProto\PTSException; |
6 | 7 | use danog\MadelineProto\RPCErrorException; |
@@ -62,6 +63,11 @@ function getTL(TLSchema $schema) |
62 | 63 | $settings->setSchema($schema); |
63 | 64 | $settings->getLogger()->setLevel(Logger::ULTRA_VERBOSE); |
64 | 65 |
|
| 66 | +$unauthed = new \danog\MadelineProto\API('fuzz_unauth.madeline'); |
| 67 | +$unauthed->updateSettings($settings); |
| 68 | +Assert::false($unauthed->getSelf(), "fuzz_unauth.madeline is authed!"); |
| 69 | +$unauthed->restart(); |
| 70 | + |
65 | 71 | echo "Bot login:".PHP_EOL; |
66 | 72 | $bot = new \danog\MadelineProto\API('fuzz_bot.madeline'); |
67 | 73 | $bot->start(); |
@@ -138,6 +144,17 @@ function call(API $API, string $method, array $args = []): void |
138 | 144 |
|
139 | 145 | foreach ($layer['methods']->by_id as $constructor) { |
140 | 146 | $name = $constructor['method']; |
| 147 | + if (strtolower($name) === 'account.deleteaccount' |
| 148 | + || !str_contains($name, '.')) { |
| 149 | + continue; |
| 150 | + } |
| 151 | + $methods["unauthed $name"]= async(static function () use ($unauthed, $name, &$methods): void { |
| 152 | + try { |
| 153 | + call($unauthed, $name); |
| 154 | + } catch (RPCErrorException|PTSException|Exception) { |
| 155 | + } |
| 156 | + unset($methods["unauthed $name"]); |
| 157 | + }); |
141 | 158 | if (strtolower($name) === 'account.deleteaccount' |
142 | 159 | || strtolower($name) === 'auth.logout' |
143 | 160 | || $name === 'auth.resetAuthorizations' |
|
0 commit comments