diff --git a/.gitignore b/.gitignore index fffd2d6e4..d261e994c 100644 --- a/.gitignore +++ b/.gitignore @@ -101,7 +101,7 @@ madeline.php composer.lock b.php telegram-cli* -src/danog/MadelineProto/Fuzzer.php +src/Fuzzer.php fuzzer.php tests/500mb *.save diff --git a/composer.json b/composer.json index f6efdf446..6a5139357 100644 --- a/composer.json +++ b/composer.json @@ -86,7 +86,7 @@ ], "autoload": { "psr-4": { - "danog\\MadelineProto\\": "src/danog/MadelineProto" + "danog\\MadelineProto\\": "src" }, "files": [ "src/polyfill.php", diff --git a/examples/bot.php b/examples/bot.php index 228e73e61..479862a03 100755 --- a/examples/bot.php +++ b/examples/bot.php @@ -113,7 +113,8 @@ class MyEventHandler extends EventHandler // Chat id $id = $this->getId($update); - // You can also use the built-in MadelineProto MySQL async driver! + // In this example code, send the "This userbot is powered by MadelineProto!" message only once per chat. + // Ignore all further messages coming from this chat. if (!isset($this->notifiedChats[$id])) { $this->notifiedChats[$id] = true; @@ -139,17 +140,19 @@ class MyEventHandler extends EventHandler } } + // Test MadelineProto's built-in database driver, which automatically maps to MySQL/PostgreSQL/Redis + // properties mentioned in the MyEventHandler::$dbProperties property! + // Can be anything serializable: an array, an int, an object, ... $myData = []; - if (isset($this->dataStoredOnDb['yourKey'])) { - // Always when fetching data - $myData = $this->dataStoredOnDb['yourKey']; + if (isset($this->dataStoredOnDb['k1'])) { + $myData = $this->dataStoredOnDb['k1']; } - $this->dataStoredOnDb['yourKey'] = $myData + ['moreStuff' => 'yay']; + $this->dataStoredOnDb['k1'] = $myData + ['moreStuff' => 'yay']; - $this->dataStoredOnDb['otherKey'] = 0; - unset($this->dataStoredOnDb['otherKey']); + $this->dataStoredOnDb['k2'] = 0; + unset($this->dataStoredOnDb['k2']); $this->logger("Count: ".count($this->dataStoredOnDb)); diff --git a/examples/secret_bot.php b/examples/secret_bot.php index 3e1eedfed..95437443a 100755 --- a/examples/secret_bot.php +++ b/examples/secret_bot.php @@ -308,7 +308,7 @@ class SecretHandler extends EventHandler while ($i < 10) { $this->logger("SENDING MESSAGE $i TO ".$update['message']['chat_id']); // You can also use the sendEncrypted parameter for more options in secret chats - $this->messages->sendMessage(['peer' => $update, 'message' => (string) ($i++)]); + $this->messages->sendMessage(peer: $update, message: (string) ($i++)); } $this->sent[$update['message']['chat_id']] = true; } diff --git a/psalm-baseline.xml b/psalm-baseline.xml index a8a264a85..0cbda793a 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,22 +1,22 @@ - + $MadelineProto->help->getConfig() - + getName - + MemoryArray MemoryArray - + $ctx->getStream($header) diff --git a/psalm.xml b/psalm.xml index d2b3a3f3d..3e4fb3f63 100644 --- a/psalm.xml +++ b/psalm.xml @@ -11,7 +11,6 @@ - diff --git a/src/danog/MadelineProto/API.php b/src/API.php similarity index 99% rename from src/danog/MadelineProto/API.php rename to src/API.php index 73f550fdf..bacddc317 100644 --- a/src/danog/MadelineProto/API.php +++ b/src/API.php @@ -45,7 +45,7 @@ use function Amp\Future\await; /** * Main API wrapper for MadelineProto. */ -final class API extends InternalDoc +final class API extends AbstractAPI { /** * Release version. @@ -176,7 +176,7 @@ final class API extends InternalDoc /** * Reconnect to full instance. */ - protected function reconnectFull() + protected function reconnectFull(): bool { if ($this->wrapper->getAPI() instanceof Client) { $this->wrapper->logger('Restarting to full instance...'); diff --git a/src/danog/MadelineProto/APIWrapper.php b/src/APIWrapper.php similarity index 100% rename from src/danog/MadelineProto/APIWrapper.php rename to src/APIWrapper.php diff --git a/src/danog/MadelineProto/AbstractAPIFactory.php b/src/AbstractAPI.php similarity index 67% rename from src/danog/MadelineProto/AbstractAPIFactory.php rename to src/AbstractAPI.php index e70f8f5b1..174d95b36 100644 --- a/src/danog/MadelineProto/AbstractAPIFactory.php +++ b/src/AbstractAPI.php @@ -22,40 +22,10 @@ namespace danog\MadelineProto; use Amp\Future\UnhandledFutureError; use Amp\SignalException; -use InvalidArgumentException; use Revolt\EventLoop; -abstract class AbstractAPIFactory +abstract class AbstractAPI extends InternalDoc { - /** - * Namespace. - * - * @internal - */ - private string $namespace = ''; - - /** - * API wrapper (to avoid circular references). - */ - protected APIWrapper $wrapper; - - /** - * Export APIFactory instance with the specified namespace. - */ - protected function exportNamespaces(): void - { - $class = \array_reverse(\array_values(\class_parents(static::class)))[1]; - - foreach (\get_class_vars(APIFactory::class) as $key => $var) { - if (\in_array($key, ['namespace', 'methods', 'wrapper'])) { - continue; - } - $instance = new $class; - $instance->namespace = $key.'.'; - $instance->wrapper = $this->wrapper; - $this->{$key} = $instance; - } - } /** * Enable or disable async. * @@ -64,29 +34,6 @@ abstract class AbstractAPIFactory public function async(bool $async): void { } - /** - * Call async wrapper function. - * - * @param string $name Method name - * @param array $arguments Arguments - * @internal - */ - public function __call(string $name, array $arguments) - { - if ($arguments && !isset($arguments[0])) { - $arguments = [$arguments]; - } - - $name = $this->namespace.$name; - $aargs = isset($arguments[1]) && \is_array($arguments[1]) ? $arguments[1] : []; - $aargs['apifactory'] = true; - $args = isset($arguments[0]) && \is_array($arguments[0]) ? $arguments[0] : []; - if (isset($args[0]) && !isset($args['multiple'])) { - throw new InvalidArgumentException('Parameter names must be provided!'); - } - return $this->wrapper->getAPI()->methodCallAsyncRead($name, $args, $aargs); - } - /** * Start MadelineProto and the event handler (enables async). * @@ -130,6 +77,9 @@ abstract class AbstractAPIFactory } } } + + abstract protected function reconnectFull(): bool; + private function startAndLoopLogic(string $eventHandler, bool &$started): void { $this->start(); diff --git a/src/danog/MadelineProto/AnnotationsBuilder.php b/src/AnnotationsBuilder.php similarity index 69% rename from src/danog/MadelineProto/AnnotationsBuilder.php rename to src/AnnotationsBuilder.php index 4db5a5fbd..68efcb7b5 100644 --- a/src/danog/MadelineProto/AnnotationsBuilder.php +++ b/src/AnnotationsBuilder.php @@ -22,24 +22,20 @@ namespace danog\MadelineProto; use danog\MadelineProto\Settings\TLSchema; use danog\MadelineProto\TL\TL; -use danog\MadelineProto\TL\TLCallback; -use phpDocumentor\Reflection\DocBlockFactory; use ReflectionClass; use ReflectionMethod; use ReflectionNamedType; use ReflectionType; use ReflectionUnionType; +use function Amp\File\read; + final class AnnotationsBuilder { /** * Reflection classes. */ private array $reflectionClasses = []; - /** - * Logger. - */ - private Logger $logger; /** * Namespace. */ @@ -48,56 +44,71 @@ final class AnnotationsBuilder * TL instance. */ private TL $TL; - /** - * Settings. - */ - private array $settings; - /** - * Output file. - */ - private string $output; - public function __construct(Logger $logger, array $settings, string $output, array $reflectionClasses, string $namespace) + private array $blacklist; + private array $blacklistHard; + public function __construct(Logger $logger, array $settings, array $reflectionClasses, string $namespace) { $this->reflectionClasses = $reflectionClasses; - $this->logger = $logger; $this->namespace = $namespace; /** @psalm-suppress InvalidArgument */ $this->TL = new TL(); $tlSchema = new TLSchema; $tlSchema->mergeArray($settings); $this->TL->init($tlSchema); - $this->settings = $settings; - $this->output = $output; + $this->blacklist = json_decode(read(__DIR__.'/../../../docs/template/disallow.json'), true); + $this->blacklistHard = $this->blacklist; + unset($this->blacklistHard['messages.getHistory']); + unset($this->blacklistHard['channels.getMessages']); + unset($this->blacklistHard['updates.getDifference']); + unset($this->blacklistHard['updates.getChannelDifference']); + unset($this->blacklistHard['updates.getState']); } public function mkAnnotations(): void { Logger::log('Generating annotations...', Logger::NOTICE); - $this->setProperties(); $this->createInternalClasses(); } - /** - * Open file of class APIFactory - * Insert properties - * save the file with new content. - */ - private function setProperties(): void + private function prepareTLType(string $type): string { - Logger::log('Generating properties...', Logger::NOTICE); - $fixture = DocBlockFactory::createInstance(); - $class = new ReflectionClass($this->reflectionClasses['APIFactory']); - $content = \file_get_contents($filename = $class->getFileName()); - foreach ($class->getProperties() as $property) { - if ($raw_docblock = $property->getDocComment()) { - $docblock = $fixture->create($raw_docblock); - if ($docblock->hasTag('internal')) { - $content = \str_replace("\n ".$raw_docblock."\n public \$".$property->getName().';', '', $content); - } - } - } - foreach ($this->TL->getMethodNamespaces() as $namespace) { - $content = \preg_replace('/(class( \\w+[,]?){0,}\\n{\\n)/', '${1}'." /**\n"." * @internal this is a internal property generated by build_docs.php, don't change manually\n"." *\n"." * @var {$namespace}\n"." */\n"." public \${$namespace};\n", $content); - } - \file_put_contents($filename, $content); + return match ($type) { + 'string' => 'string', + 'bytes' => 'string', + 'int' => 'int', + 'long' => 'int', + 'double' => 'float', + 'float' => 'float', + 'Bool' => 'bool', + 'bool' => 'bool', + default => 'array' + }; + } + private function prepareTLDefault(string $type): string + { + return match ($type) { + 'string' => "''", + 'bytes' => "''", + 'int' => '0', + 'long' => '0', + 'double' => '0.0', + 'float' => '0.0', + 'Bool' => 'false', + 'bool' => 'false', + default => '[]' + }; + } + private function prepareTLTypeDescription(string $type): string + { + return match ($type) { + 'string' => '', + 'bytes' => '', + 'int' => '', + 'long' => '', + 'double' => '', + 'float' => '', + 'Bool' => '', + 'bool' => '', + default => " @see https://docs.madelineproto.xyz/API_docs/types/$type.html" + }; } /** * Create internalDoc. @@ -105,21 +116,6 @@ final class AnnotationsBuilder private function createInternalClasses(): void { Logger::log('Creating internal classes...', Logger::NOTICE); - $handle = \fopen($this->output, 'w'); - \fwrite($handle, "namespace}; class InternalDoc extends APIFactory {}"); - $class = new ReflectionClass($this->reflectionClasses['API']); - $methods = $class->getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_PUBLIC); - $ignoreMethods = ['fetchserializableobject']; - foreach ($methods as $method) { - $ignoreMethods[$method->getName()] = $method->getName(); - } - $class = new ReflectionClass(TLCallback::class); - $methods = $class->getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_PUBLIC); - foreach ($methods as $method) { - $ignoreMethods[$method->getName()] = $method->getName(); - } - \fclose($handle); - $handle = \fopen($this->output, 'w'); $internalDoc = []; foreach ($this->TL->getMethods()->by_id as $id => $data) { if (!\strpos($data['method'], '.')) { @@ -129,6 +125,9 @@ final class AnnotationsBuilder if (!\in_array($namespace, $this->TL->getMethodNamespaces())) { continue; } + if (isset($this->blacklist[$data['method']])) { + continue; + } $internalDoc[$namespace][$method]['title'] = \str_replace(['](../', '.md'], ['](https://docs.madelineproto.xyz/API_docs/', '.html'], Lang::$lang['en']["method_{$data['method']}"] ?? ''); $type = \str_ireplace(['vector<', '>'], [' of ', '[]'], $data['type']); foreach ($data['params'] as $param) { @@ -142,11 +141,14 @@ final class AnnotationsBuilder if ($param['name'] === 'chat_id' && $data['method'] !== 'messages.discardEncryption') { $param['type'] = 'InputPeer'; } - if ($param['name'] === 'hash' && $param['type'] === 'int') { + if ($param['name'] === 'hash' && $param['type'] === 'long') { $param['pow'] = 'hi'; $param['type'] = 'Vector t'; $param['subtype'] = 'int'; } + if ($param['type'] === 'bool') { + $param['pow'] = 'hi'; + } $stype = 'type'; if (isset($param['subtype'])) { $stype = 'subtype'; @@ -158,8 +160,7 @@ final class AnnotationsBuilder $ptype = 'boolean'; } $ptype = $stype === 'type' ? $ptype : "[{$ptype}]"; - $opt = $param['pow'] ?? false ? 'Optional: ' : ''; - $internalDoc[$namespace][$method]['attr'][$param['name']] = ['type' => $ptype, 'description' => \str_replace(['](../', '.md'], ['](https://docs.madelineproto.xyz/API_docs/', '.html'], $opt.(Lang::$lang['en']["method_{$data['method']}_param_{$param['name']}_type_{$param['type']}"] ?? ''))]; + $internalDoc[$namespace][$method]['attr'][$param['name']] = ['optional' => isset($param['pow']), 'type' => $ptype, 'description' => \str_replace(['](../', '.md'], ['](https://docs.madelineproto.xyz/API_docs/', '.html'], Lang::$lang['en']["method_{$data['method']}_param_{$param['name']}_type_{$param['type']}"] ?? '')]; } if ($type === 'Bool') { $type = \strtolower($type); @@ -252,7 +253,6 @@ final class AnnotationsBuilder } $doc .= ', '; if ($param->isVariadic()) { - $hasVariadic = true; $paramList .= '...'; } $paramList .= '$'.$param->getName().', '; @@ -274,7 +274,10 @@ final class AnnotationsBuilder if ($method->getDeclaringClass()->getName() == StrTools::class) { $async = false; } - $ret = $type && $type instanceof ReflectionNamedType && \in_array($type->getName(), ['self', 'void']) ? '' : 'return'; + if ($method->getDeclaringClass()->getName() == AsyncTools::class) { + $async = false; + } + $ret = $type && $type instanceof ReflectionNamedType && $type->getName() === 'void' ? '' : 'return'; $doc .= "\n{\n"; if ($async) { $doc .= " {$ret} \$this->wrapper->getAPI()->{__FUNCTION__}({$paramList});\n"; @@ -283,9 +286,6 @@ final class AnnotationsBuilder } else { $doc .= " {$ret} \\".$method->getDeclaringClass()->getName().'::'.$name."({$paramList});\n"; } - if (!$ret && $type->getName() === 'self') { - $doc .= " return \$this;\n"; - } $doc .= "}\n"; if (!$method->getDocComment()) { Logger::log("{$name} has no PHPDOC!", Logger::FATAL_ERROR); @@ -325,17 +325,46 @@ final class AnnotationsBuilder $internalDoc['InternalDoc'][$name]['method'] = $phpdoc; $internalDoc['InternalDoc'][$name]['method'] .= "\n ".\implode("\n ", \explode("\n", $doc)); } - \fwrite($handle, "namespace};\n"); foreach ($internalDoc as $namespace => $methods) { if ($namespace === 'InternalDoc') { - \fwrite($handle, "\nclass {$namespace} extends APIFactory\n{\n"); + $handle = \fopen(__DIR__.'/InternalDoc.php', 'w'); + \fwrite($handle, "namespace};\n"); + + \fwrite($handle, "\nabstract class {$namespace}\n{\nprotected APIWrapper \$wrapper;\n"); + foreach ($this->TL->getMethodNamespaces() as $namespace) { + $namespaceInterface = '\\danog\\MadelineProto\\Namespace\\'.\ucfirst($namespace); + \fwrite($handle, '/** @var \\danog\\MadelineProto\\Namespace\\AbstractAPI&'.$namespaceInterface.' $'.$namespace." */\n"); + \fwrite($handle, 'public readonly \\danog\\MadelineProto\\Namespace\\AbstractAPI $'.$namespace.";\n"); + } + \fwrite($handle, ' + /** + * Export APIFactory instance with the specified namespace. + */ + protected function exportNamespaces(): void + { + '); + foreach ($this->TL->getMethodNamespaces() as $namespace) { + \fwrite($handle, "\$this->$namespace ??= new \\danog\\MadelineProto\\Namespace\\AbstractAPI('$namespace');\n"); + \fwrite($handle, "\$this->{$namespace}->setWrapper(\$this->wrapper);\n"); + } + \fwrite($handle, "}\n"); } else { + $namespace = \ucfirst($namespace); + $handle = \fopen(__DIR__."/Namespace/$namespace.php", 'w'); + \fwrite($handle, "namespace}\\Namespace;\n"); + \fwrite($handle, "\ninterface {$namespace}\n{"); } foreach ($methods as $method => $properties) { @@ -347,29 +376,29 @@ final class AnnotationsBuilder \fwrite($handle, "\n /**\n"); \fwrite($handle, " * {$title}\n"); \fwrite($handle, " *\n"); + $params = []; if (isset($properties['attr'])) { - \fwrite($handle, " * Parameters: \n"); - $longest = [0, 0, 0]; + \uasort($properties['attr'], fn (array $arr1, array $arr2) => $arr1['optional'] <=> $arr2['optional']); foreach ($properties['attr'] as $name => $param) { - $longest[0] = \max($longest[0], \strlen($param['type'])); - $longest[1] = \max($longest[1], \strlen($name)); - $longest[2] = \max($longest[2], \strlen($param['description'])); - } - foreach ($properties['attr'] as $name => $param) { - $param['type'] = \str_pad('`'.$param['type'].'`', $longest[0] + 2); - $name = \str_pad('**'.$name.'**', $longest[1] + 4); - $param['description'] = \str_pad($param['description'], $longest[2]); - \fwrite($handle, " * * {$param['type']} {$name} - {$param['description']}\n"); + $param['type'] = $this->prepareTLType($param['type']); + $param_var = $param['type'].' $'.$name; + if ($param['optional']) { + $param_var .= ' = '.$this->prepareTLDefault($param['type']); + } + $params []= $param_var; + $param['description'] .= $this->prepareTLTypeDescription($param['type']); + \fwrite($handle, " * @param {$param['type']} \${$name} {$param['description']}\n"); } \fwrite($handle, " * \n"); - \fwrite($handle, " * @param array \$params Parameters\n"); \fwrite($handle, " *\n"); } - \fwrite($handle, " * @return {$properties['return']}\n"); + $properties['return'] = $this->prepareTLType($properties['return']); + $properties['return'] .= $this->prepareTLTypeDescription($properties['return']); + \fwrite($handle, " * @return array\n"); \fwrite($handle, " */\n"); \fwrite($handle, " public function {$method}("); if (isset($properties['attr'])) { - \fwrite($handle, '$params'); + \fwrite($handle, \implode(', ', $params)); } \fwrite($handle, ");\n"); } diff --git a/src/danog/MadelineProto/ApiWrappers/Start.php b/src/ApiWrappers/Start.php similarity index 100% rename from src/danog/MadelineProto/ApiWrappers/Start.php rename to src/ApiWrappers/Start.php diff --git a/src/danog/MadelineProto/ApiWrappers/Templates.php b/src/ApiWrappers/Templates.php similarity index 100% rename from src/danog/MadelineProto/ApiWrappers/Templates.php rename to src/ApiWrappers/Templates.php diff --git a/src/danog/MadelineProto/AsyncTools.php b/src/AsyncTools.php similarity index 100% rename from src/danog/MadelineProto/AsyncTools.php rename to src/AsyncTools.php diff --git a/src/danog/MadelineProto/Bug74586Exception.php b/src/Bug74586Exception.php similarity index 100% rename from src/danog/MadelineProto/Bug74586Exception.php rename to src/Bug74586Exception.php diff --git a/src/danog/MadelineProto/Connection.php b/src/Connection.php similarity index 100% rename from src/danog/MadelineProto/Connection.php rename to src/Connection.php diff --git a/src/danog/MadelineProto/ContextConnector.php b/src/ContextConnector.php similarity index 100% rename from src/danog/MadelineProto/ContextConnector.php rename to src/ContextConnector.php diff --git a/src/danog/MadelineProto/Conversion.php b/src/Conversion.php similarity index 100% rename from src/danog/MadelineProto/Conversion.php rename to src/Conversion.php diff --git a/src/danog/MadelineProto/DataCenter.php b/src/DataCenter.php similarity index 100% rename from src/danog/MadelineProto/DataCenter.php rename to src/DataCenter.php diff --git a/src/danog/MadelineProto/DataCenterConnection.php b/src/DataCenterConnection.php similarity index 100% rename from src/danog/MadelineProto/DataCenterConnection.php rename to src/DataCenterConnection.php diff --git a/src/danog/MadelineProto/Db/ArrayCacheTrait.php b/src/Db/ArrayCacheTrait.php similarity index 100% rename from src/danog/MadelineProto/Db/ArrayCacheTrait.php rename to src/Db/ArrayCacheTrait.php diff --git a/src/danog/MadelineProto/Db/DbArray.php b/src/Db/DbArray.php similarity index 100% rename from src/danog/MadelineProto/Db/DbArray.php rename to src/Db/DbArray.php diff --git a/src/danog/MadelineProto/Db/DbPropertiesFactory.php b/src/Db/DbPropertiesFactory.php similarity index 100% rename from src/danog/MadelineProto/Db/DbPropertiesFactory.php rename to src/Db/DbPropertiesFactory.php diff --git a/src/danog/MadelineProto/Db/DbPropertiesTrait.php b/src/Db/DbPropertiesTrait.php similarity index 100% rename from src/danog/MadelineProto/Db/DbPropertiesTrait.php rename to src/Db/DbPropertiesTrait.php diff --git a/src/danog/MadelineProto/Db/DbType.php b/src/Db/DbType.php similarity index 100% rename from src/danog/MadelineProto/Db/DbType.php rename to src/Db/DbType.php diff --git a/src/danog/MadelineProto/Db/Driver/Mysql.php b/src/Db/Driver/Mysql.php similarity index 100% rename from src/danog/MadelineProto/Db/Driver/Mysql.php rename to src/Db/Driver/Mysql.php diff --git a/src/danog/MadelineProto/Db/Driver/Postgres.php b/src/Db/Driver/Postgres.php similarity index 100% rename from src/danog/MadelineProto/Db/Driver/Postgres.php rename to src/Db/Driver/Postgres.php diff --git a/src/danog/MadelineProto/Db/Driver/Redis.php b/src/Db/Driver/Redis.php similarity index 100% rename from src/danog/MadelineProto/Db/Driver/Redis.php rename to src/Db/Driver/Redis.php diff --git a/src/danog/MadelineProto/Db/DriverArray.php b/src/Db/DriverArray.php similarity index 100% rename from src/danog/MadelineProto/Db/DriverArray.php rename to src/Db/DriverArray.php diff --git a/src/danog/MadelineProto/Db/MemoryArray.php b/src/Db/MemoryArray.php similarity index 100% rename from src/danog/MadelineProto/Db/MemoryArray.php rename to src/Db/MemoryArray.php diff --git a/src/danog/MadelineProto/Db/MysqlArray.php b/src/Db/MysqlArray.php similarity index 100% rename from src/danog/MadelineProto/Db/MysqlArray.php rename to src/Db/MysqlArray.php diff --git a/src/danog/MadelineProto/Db/NullCache/MysqlArray.php b/src/Db/NullCache/MysqlArray.php similarity index 100% rename from src/danog/MadelineProto/Db/NullCache/MysqlArray.php rename to src/Db/NullCache/MysqlArray.php diff --git a/src/danog/MadelineProto/Db/NullCache/NullCacheTrait.php b/src/Db/NullCache/NullCacheTrait.php similarity index 100% rename from src/danog/MadelineProto/Db/NullCache/NullCacheTrait.php rename to src/Db/NullCache/NullCacheTrait.php diff --git a/src/danog/MadelineProto/Db/NullCache/PostgresArray.php b/src/Db/NullCache/PostgresArray.php similarity index 100% rename from src/danog/MadelineProto/Db/NullCache/PostgresArray.php rename to src/Db/NullCache/PostgresArray.php diff --git a/src/danog/MadelineProto/Db/NullCache/RedisArray.php b/src/Db/NullCache/RedisArray.php similarity index 100% rename from src/danog/MadelineProto/Db/NullCache/RedisArray.php rename to src/Db/NullCache/RedisArray.php diff --git a/src/danog/MadelineProto/Db/PostgresArray.php b/src/Db/PostgresArray.php similarity index 100% rename from src/danog/MadelineProto/Db/PostgresArray.php rename to src/Db/PostgresArray.php diff --git a/src/danog/MadelineProto/Db/RedisArray.php b/src/Db/RedisArray.php similarity index 100% rename from src/danog/MadelineProto/Db/RedisArray.php rename to src/Db/RedisArray.php diff --git a/src/danog/MadelineProto/Db/SqlArray.php b/src/Db/SqlArray.php similarity index 100% rename from src/danog/MadelineProto/Db/SqlArray.php rename to src/Db/SqlArray.php diff --git a/src/danog/MadelineProto/DoHConnector.php b/src/DoHConnector.php similarity index 100% rename from src/danog/MadelineProto/DoHConnector.php rename to src/DoHConnector.php diff --git a/src/danog/MadelineProto/DoHWrapper.php b/src/DoHWrapper.php similarity index 100% rename from src/danog/MadelineProto/DoHWrapper.php rename to src/DoHWrapper.php diff --git a/src/danog/MadelineProto/DocsBuilder.php b/src/DocsBuilder.php similarity index 100% rename from src/danog/MadelineProto/DocsBuilder.php rename to src/DocsBuilder.php diff --git a/src/danog/MadelineProto/DocsBuilder/Constructors.php b/src/DocsBuilder/Constructors.php similarity index 100% rename from src/danog/MadelineProto/DocsBuilder/Constructors.php rename to src/DocsBuilder/Constructors.php diff --git a/src/danog/MadelineProto/DocsBuilder/Methods.php b/src/DocsBuilder/Methods.php similarity index 100% rename from src/danog/MadelineProto/DocsBuilder/Methods.php rename to src/DocsBuilder/Methods.php diff --git a/src/danog/MadelineProto/EventHandler.php b/src/EventHandler.php similarity index 97% rename from src/danog/MadelineProto/EventHandler.php rename to src/EventHandler.php index 824e1866e..8e0d09a00 100644 --- a/src/danog/MadelineProto/EventHandler.php +++ b/src/EventHandler.php @@ -29,7 +29,7 @@ use Generator; /** * Event handler. */ -abstract class EventHandler extends InternalDoc +abstract class EventHandler extends AbstractAPI { use DbPropertiesTrait { DbPropertiesTrait::initDb as private internalInitDb; @@ -76,6 +76,10 @@ abstract class EventHandler extends InternalDoc $API->botLogin($token); $API->startAndLoopInternal(static::class); } + protected function reconnectFull(): bool + { + return true; + } /** * Internal constructor. * diff --git a/src/danog/MadelineProto/Exception.php b/src/Exception.php similarity index 100% rename from src/danog/MadelineProto/Exception.php rename to src/Exception.php diff --git a/src/danog/MadelineProto/FastAPI.php b/src/FastAPI.php similarity index 100% rename from src/danog/MadelineProto/FastAPI.php rename to src/FastAPI.php diff --git a/src/danog/MadelineProto/FileCallback.php b/src/FileCallback.php similarity index 100% rename from src/danog/MadelineProto/FileCallback.php rename to src/FileCallback.php diff --git a/src/danog/MadelineProto/FileCallbackInterface.php b/src/FileCallbackInterface.php similarity index 100% rename from src/danog/MadelineProto/FileCallbackInterface.php rename to src/FileCallbackInterface.php diff --git a/src/danog/MadelineProto/Files/Server.php b/src/Files/Server.php similarity index 100% rename from src/danog/MadelineProto/Files/Server.php rename to src/Files/Server.php diff --git a/src/danog/MadelineProto/GarbageCollector.php b/src/GarbageCollector.php similarity index 100% rename from src/danog/MadelineProto/GarbageCollector.php rename to src/GarbageCollector.php diff --git a/src/InternalDoc.php b/src/InternalDoc.php new file mode 100644 index 000000000..9a0864429 --- /dev/null +++ b/src/InternalDoc.php @@ -0,0 +1,1864 @@ +auth ??= new \danog\MadelineProto\Namespace\AbstractAPI('auth'); +$this->auth->setWrapper($this->wrapper); +$this->account ??= new \danog\MadelineProto\Namespace\AbstractAPI('account'); +$this->account->setWrapper($this->wrapper); +$this->users ??= new \danog\MadelineProto\Namespace\AbstractAPI('users'); +$this->users->setWrapper($this->wrapper); +$this->contacts ??= new \danog\MadelineProto\Namespace\AbstractAPI('contacts'); +$this->contacts->setWrapper($this->wrapper); +$this->messages ??= new \danog\MadelineProto\Namespace\AbstractAPI('messages'); +$this->messages->setWrapper($this->wrapper); +$this->updates ??= new \danog\MadelineProto\Namespace\AbstractAPI('updates'); +$this->updates->setWrapper($this->wrapper); +$this->photos ??= new \danog\MadelineProto\Namespace\AbstractAPI('photos'); +$this->photos->setWrapper($this->wrapper); +$this->upload ??= new \danog\MadelineProto\Namespace\AbstractAPI('upload'); +$this->upload->setWrapper($this->wrapper); +$this->help ??= new \danog\MadelineProto\Namespace\AbstractAPI('help'); +$this->help->setWrapper($this->wrapper); +$this->channels ??= new \danog\MadelineProto\Namespace\AbstractAPI('channels'); +$this->channels->setWrapper($this->wrapper); +$this->bots ??= new \danog\MadelineProto\Namespace\AbstractAPI('bots'); +$this->bots->setWrapper($this->wrapper); +$this->payments ??= new \danog\MadelineProto\Namespace\AbstractAPI('payments'); +$this->payments->setWrapper($this->wrapper); +$this->stickers ??= new \danog\MadelineProto\Namespace\AbstractAPI('stickers'); +$this->stickers->setWrapper($this->wrapper); +$this->phone ??= new \danog\MadelineProto\Namespace\AbstractAPI('phone'); +$this->phone->setWrapper($this->wrapper); +$this->langpack ??= new \danog\MadelineProto\Namespace\AbstractAPI('langpack'); +$this->langpack->setWrapper($this->wrapper); +$this->folders ??= new \danog\MadelineProto\Namespace\AbstractAPI('folders'); +$this->folders->setWrapper($this->wrapper); +$this->stats ??= new \danog\MadelineProto\Namespace\AbstractAPI('stats'); +$this->stats->setWrapper($this->wrapper); +} +/** + * Convert MTProto parameters to bot API parameters. + * + * @param array $data Data + * @return mixed + */ + public function MTProtoToBotAPI(array $data) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($data); + } + /** + * MTProto to TD params. + * + * @param mixed $params Params + * @return + */ + public function MTProtoToTd(mixed &$params) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($params); + } + /** + * MTProto to TDCLI params. + * + * @param mixed $params Params + * @return + */ + public function MTProtoToTdcli(mixed $params) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($params); + } + /** + * Accept call. + * + * @param array $call Call + * @return mixed + */ + public function acceptCall(array $call) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($call); + } + /** + * Accept secret chat. + * + * @param array $params Secret chat ID + * @return mixed + */ + public function acceptSecretChat(array $params) + { + $this->wrapper->getAPI()->{__FUNCTION__}($params); + } + /** + * Add user info. + * + * @param array $user User info + * @return mixed + */ + public function addUser(array $user) + { + $this->wrapper->getAPI()->{__FUNCTION__}($user); + } + /** + * Call promise $b after promise $a. + * + * @deprecated Coroutines are deprecated since amp v3 + * @param Generator|Future $a Promise A + * @param Generator|Future $b Promise B + * @psalm-suppress InvalidScope + * @return Amp\Future + */ + public static function after(\Generator|\Amp\Future $a, \Generator|\Amp\Future $b): \Amp\Future + { + return \danog\MadelineProto\AsyncTools::after($a, $b); + } + /** + * Returns a promise that succeeds when all promises succeed, and fails if any promise fails. + * Returned promise succeeds with an array of values used to succeed each contained promise, with keys corresponding to the array of promises. + * + * @deprecated Coroutines are deprecated since amp v3 + * @param array<(Generator|Future)> $promises Promises + * @return + */ + public static function all(array $promises) + { + return \danog\MadelineProto\AsyncTools::all($promises); + } + /** + * Returns a promise that is resolved when all promises are resolved. The returned promise will not fail. + * + * @deprecated Coroutines are deprecated since amp v3 + * @param array<(Future|Generator)> $promises Promises + * @return + */ + public static function any(array $promises) + { + return \danog\MadelineProto\AsyncTools::any($promises); + } + /** + * Create array. + * + * @param mixed ...$params Params + * @return array + */ + public static function arr(mixed ...$params): array + { + return \danog\MadelineProto\Tools::arr(...$params); + } + /** + * base64URL decode. + * + * @param string $data Data to decode + * @return string + */ + public static function base64urlDecode(string $data): string + { + return \danog\MadelineProto\Tools::base64urlDecode($data); + } + /** + * Base64URL encode. + * + * @param string $data Data to encode + * @return string + */ + public static function base64urlEncode(string $data): string + { + return \danog\MadelineProto\Tools::base64urlEncode($data); + } + /** + * Convert bot API parameters to MTProto parameters. + * + * @param array $arguments Arguments + * @return mixed + */ + public function botAPIToMTProto(array $arguments) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($arguments); + } + /** + * Login as bot. + * + * @param string $token Bot token + * @return mixed + */ + public function botLogin(string $token) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($token); + } + /** + * Convert generator, promise or any other value to a promise. + * + * @deprecated Coroutines are deprecated since amp v3 + * @template TReturn + * @param Generator|Future|TReturn $promise + * @return Future + */ + public static function call(mixed $promise): \Amp\Future + { + return \danog\MadelineProto\AsyncTools::call($promise); + } + /** + * Call promise in background. + * + * @deprecated Coroutines are deprecated since amp v3 + * @param Generator|Future $promise Promise to resolve + * @param ?\Generator|Future $actual Promise to resolve instead of $promise + * @param string $file File + * @psalm-suppress InvalidScope + * @return mixed + */ + public static function callFork(\Generator|\Amp\Future $promise, $actual = null, string $file = ''): mixed + { + return \danog\MadelineProto\AsyncTools::callFork($promise, $actual, $file); + } + /** + * Call promise in background, deferring execution. + * + * @deprecated Coroutines are deprecated since amp v3 + * @param Generator|Future $promise Promise to resolve + * @return void + */ + public static function callForkDefer(\Generator|\Amp\Future $promise): void + { + \danog\MadelineProto\AsyncTools::callForkDefer($promise); + } + /** + * Get call status. + * + * @param int $id Call ID + * @return mixed + */ + public function callStatus(int $id) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($id); + } + /** + * Close connection with client, connected via web. + * + * @param string $message Message + * @return void + */ + public static function closeConnection(string $message): void + { + \danog\MadelineProto\Tools::closeConnection($message); + } + /** + * Complete 2FA login. + * + * @param string $password Password + * @return + */ + public function complete2faLogin(string $password) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($password); + } + /** + * Complete call handshake. + * + * @param array $params Params + * @return + */ + public function completeCall(array $params) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($params); + } + /** + * Complet user login using login code. + * + * @param string $code Login code + * @return + */ + public function completePhoneLogin(string $code) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($code); + } + /** + * Complete signup to Telegram. + * + * @param string $first_name First name + * @param string $last_name Last name + * @return + */ + public function completeSignup(string $first_name, string $last_name = '') + { + return $this->wrapper->getAPI()->{__FUNCTION__}($first_name, $last_name); + } + /** + * Confirm call. + * + * @param array $params Params + * @return + */ + public function confirmCall(array $params) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($params); + } + /** + * Connects to all datacenters and if necessary creates authorization keys, binds them and writes client info. + * + * @param boolean $reconnectAll Whether to reconnect to all DCs + * @return mixed + */ + public function connectToAllDcs(bool $reconnectAll = true) + { + $this->wrapper->getAPI()->{__FUNCTION__}($reconnectAll); + } + /** + * Discard call. + * + * @param array $call Call + * @param array $rating Rating + * @param boolean $need_debug Need debug? + * @return mixed + */ + public function discardCall(array $call, array $reason, array $rating = array ( + ), bool $need_debug = true) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($call, $reason, $rating, $need_debug); + } + /** + * Discard secret chat. + * + * @param int $chat Secret chat ID + * @return mixed + */ + public function discardSecretChat(int $chat) + { + $this->wrapper->getAPI()->{__FUNCTION__}($chat); + } + /** + * Download file to browser. + * + * Supports HEAD requests and content-ranges for parallel and resumed downloads. + * + * @param array|string|FileCallbackInterface $messageMedia File to download + * @param null|callable $cb Status callback (can also use FileCallback) + * @param null|int $size Size of file to download, required for bot API file IDs. + * @param null|string $mime MIME type of file to download, required for bot API file IDs. + * @param null|string $name Name of file to download, required for bot API file IDs. + * @return mixed + */ + public function downloadToBrowser(\danog\MadelineProto\FileCallbackInterface|array|string $messageMedia, ?callable $cb = null, ?int $size = null, ?string $name = null, ?string $mime = null) + { + $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $cb, $size, $name, $mime); + } + /** + * Download file to callable. + * The callable must accept two parameters: string $payload, int $offset + * The callable will be called (possibly out of order, depending on the value of $seekable). + * + * @param mixed $messageMedia File to download + * @param callable|FileCallbackInterface $callable Chunk callback + * @param callable $cb Status callback (DEPRECATED, use FileCallbackInterface) + * @param bool $seekable Whether the callable can be called out of order + * @param int $offset Offset where to start downloading + * @param int $end Offset where to stop downloading (inclusive) + * @param int $part_size Size of each chunk + * @return + */ + public function downloadToCallable(mixed $messageMedia, callable $callable, ?callable $cb = null, bool $seekable = true, int $offset = 0, int $end = -1, ?int $part_size = null) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $callable, $cb, $seekable, $offset, $end, $part_size); + } + /** + * Download file to directory. + * + * @param mixed $messageMedia File to download + * @param string|FileCallbackInterface $dir Directory where to download the file + * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) + * @return + */ + public function downloadToDir(mixed $messageMedia, \danog\MadelineProto\FileCallbackInterface|string $dir, ?callable $cb = null) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $dir, $cb); + } + /** + * Download file. + * + * @param mixed $messageMedia File to download + * @param string|FileCallbackInterface $file Downloaded file path + * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) + * @return mixed + */ + public function downloadToFile(mixed $messageMedia, \danog\MadelineProto\FileCallbackInterface|string $file, ?callable $cb = null) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $file, $cb); + } + /** + * Download file to amphp/http-server response. + * + * Supports HEAD requests and content-ranges for parallel and resumed downloads. + * + * @param array|string|FileCallbackInterface $messageMedia File to download + * @param ServerRequest $request Request + * @param callable $cb Status callback (can also use FileCallback) + * @param null|int $size Size of file to download, required for bot API file IDs. + * @param null|string $name Name of file to download, required for bot API file IDs. + * @param null|string $mime MIME type of file to download, required for bot API file IDs. + * @return mixed + */ + public function downloadToResponse(\danog\MadelineProto\FileCallbackInterface|array|string $messageMedia, \Amp\Http\Server\Request $request, ?callable $cb = null, ?int $size = null, ?string $mime = null, ?string $name = null) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $request, $cb, $size, $mime, $name); + } + /** + * Download file to stream. + * + * @param mixed $messageMedia File to download + * @param mixed|FileCallbackInterface|resource|WritableStream $stream Stream where to download file + * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) + * @param int $offset Offset where to start downloading + * @param int $end Offset where to end download + * @return + */ + public function downloadToStream(mixed $messageMedia, mixed $stream, ?callable $cb = null, int $offset = 0, int $end = -1) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $stream, $cb, $offset, $end); + } + /** + * Asynchronously write to stdout/browser. + * + * @param string $string Message to echo + * @return void + */ + public static function echo(string $string): void + { + \danog\MadelineProto\AsyncTools::echo($string); + } + /** + * Get final element of array. + * + * @param array $what Array + * @return + */ + public static function end(array $what) + { + return \danog\MadelineProto\Tools::end($what); + } + /** + * Export authorization. + * + * @return mixed + */ + public function exportAuthorization() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Extract file info from bot API message. + * + * @param array $info Bot API message object + * @return ?array + */ + public static function extractBotAPIFile(array $info): ?array + { + return \danog\MadelineProto\MTProto::extractBotAPIFile($info); + } + /** + * Extract a message constructor from an Updates constructor. + * @return mixed + */ + public function extractMessage(array $updates) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($updates); + } + /** + * Extract a message ID from an Updates constructor. + * @return mixed + */ + public function extractMessageId(array $updates) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($updates); + } + /** + * Extract an update message constructor from an Updates constructor. + * @return mixed + */ + public function extractMessageUpdate(array $updates) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($updates); + } + /** + * Extract Update constructors from an Updates constructor. + * + * @return mixed + */ + public function extractUpdates(array $updates) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($updates); + } + /** + * Get contents of remote file asynchronously. + * + * @param string $url URL + * @return mixed + */ + public function fileGetContents(string $url) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($url); + } + /** + * Returns a promise that succeeds when the first promise succeeds, and fails only if all promises fail. + * + * @deprecated Coroutines are deprecated since amp v3 + * @param array<(Future|Generator)> $promises Promises + * @return + */ + public static function first(array $promises) + { + return \danog\MadelineProto\AsyncTools::first($promises); + } + /** + * Asynchronously lock a file + * Resolves with a callbable that MUST eventually be called in order to release the lock. + * + * @param string $file File to lock + * @param integer $operation Locking mode + * @param float $polling Polling interval + * @param ?Cancellation $token Cancellation token + * @param ?Closure $failureCb Failure callback, called only once if the first locking attempt fails. + * @return ($token is null ? (Closure(): void) : ((Closure(): void)|null)) + */ + public static function flock(string $file, int $operation, float $polling = 0.1, ?\Amp\Cancellation $token = null, ?\Closure $failureCb = null): ?\Closure + { + return \danog\MadelineProto\AsyncTools::flock($file, $operation, $polling, $token, $failureCb); + } + /** + * Convert bot API channel ID to MTProto channel ID. + * + * @param int $id Bot API channel ID + * @return int + */ + public static function fromSupergroup(int $id): int + { + return \danog\MadelineProto\MTProto::fromSupergroup($id); + } + /** + * When were full info for this chat last cached. + * + * @param mixed $id Chat ID + * @return mixed + */ + public function fullChatLastUpdated(mixed $id) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($id); + } + /** + * Get info about the logged-in user, not cached. + * @return mixed + */ + public function fullGetSelf() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Generate MTProto vector hash. + * + * @param array $ints IDs + * @return string Vector hash + */ + public static function genVectorHash(array $ints): string + { + return \danog\MadelineProto\Tools::genVectorHash($ints); + } + /** + * Get full list of MTProto and API methods. + * @return mixed + */ + public function getAllMethods() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get authorization info. + * @return mixed + */ + public function getAuthorization() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get cached server-side config. + * @return mixed + */ + public function getCachedConfig() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get call info. + * + * @param int $call Call ID + * @return mixed + */ + public function getCall(int $call) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($call); + } + /** + * Store RSA keys for CDN datacenters. + * @return mixed + */ + public function getCdnConfig() + { + $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get cached (or eventually re-fetch) server-side config. + * + * @param array $config Current config + * @return mixed + */ + public function getConfig(array $config = array ( + )) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($config); + } + /** + * Get async DNS client. + * @return mixed + */ + public function getDNSClient() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get all datacenter connections. + * + * @return mixed + */ + public function getDataCenterConnections() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get main DC ID. + * + * @return mixed + */ + public function getDataCenterId() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get diffie-hellman configuration. + * @return mixed + */ + public function getDhConfig() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get dialog peers. + * + * @param boolean $force Whether to refetch all dialogs ignoring cache + * @return mixed + */ + public function getDialogs(bool $force = true) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($force); + } + /** + * Get download info of file + * Returns an array with the following structure:. + * + * `$info['ext']` - The file extension + * `$info['name']` - The file name, without the extension + * `$info['mime']` - The file mime type + * `$info['size']` - The file size + * + * @param mixed $messageMedia File ID + * @return mixed + */ + public function getDownloadInfo(mixed $messageMedia) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia); + } + /** + * Get event handler. + * @return mixed + */ + public function getEventHandler() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get extension from file location. + * + * @param mixed $location File location + * @param string $default Default extension + * @return string + */ + public static function getExtensionFromLocation(mixed $location, string $default): string + { + return \danog\MadelineProto\TL\Conversion\Extension::getExtensionFromLocation($location, $default); + } + /** + * Get extension from mime type. + * + * @param string $mime MIME type + * @return string + */ + public static function getExtensionFromMime(string $mime): string + { + return \danog\MadelineProto\TL\Conversion\Extension::getExtensionFromMime($mime); + } + /** + * Get info about file. + * + * @param mixed $constructor File ID + * @return mixed + */ + public function getFileInfo(mixed $constructor) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($constructor); + } + /** + * Get folder ID from object. + * + * @param mixed $id Object + * @return ?int + */ + public static function getFolderId(mixed $id): ?int + { + return \danog\MadelineProto\MTProto::getFolderId($id); + } + /** + * Get full info of all dialogs. + * + * @param boolean $force Whether to refetch all dialogs ignoring cache + * @return mixed + */ + public function getFullDialogs(bool $force = true) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($force); + } + /** + * Get full info about peer, returns an FullInfo object. + * + * @param mixed $id Peer + * @see https://docs.madelineproto.xyz/FullInfo.html + * @return mixed + */ + public function getFullInfo(mixed $id) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($id); + } + /** + * Get async HTTP client. + * @return mixed + */ + public function getHTTPClient() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get current password hint. + * @return mixed + */ + public function getHint() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get bot API ID from peer object. + * + * @param mixed $id Peer + * @return mixed + */ + public function getId(mixed $id) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($id); + } + /** + * Get info about peer, returns an Info object. + * + * @param mixed $id Peer + * @param MTProto::INFO_TYPE_* $type Whether to generate an Input*, an InputPeer or the full set of constructors + * @see https://docs.madelineproto.xyz/Info.html + * @return mixed + * InputPeer: array{_: string, user_id?: int, access_hash?: int, min?: bool, chat_id?: int, channel_id?: int}, + * Peer: array{_: string, user_id?: int, chat_id?: int, channel_id?: int}, + * DialogPeer: array{_: string, peer: array{_: string, user_id?: int, chat_id?: int, channel_id?: int}}, + * NotifyPeer: array{_: string, peer: array{_: string, user_id?: int, chat_id?: int, channel_id?: int}}, + * InputDialogPeer: array{_: string, peer: array{_: string, user_id?: int, access_hash?: int, min?: bool, chat_id?: int, channel_id?: int}}, + * InputNotifyPeer: array{_: string, peer: array{_: string, user_id?: int, access_hash?: int, min?: bool, chat_id?: int, channel_id?: int}}, + * bot_api_id: int|string, + * user_id?: int, + * chat_id?: int, + * channel_id?: int, + * InputUser?: array{_: string, user_id?: int, access_hash?: int, min?: bool}, + * InputChannel?: array{_: string, channel_id: int, access_hash: int, min: bool}, + * type: string + * } : ($type is INFO_TYPE_ID ? int : array{_: string, user_id?: int, access_hash?: int, min?: bool, chat_id?: int, channel_id?: int}|array{_: string, user_id?: int, access_hash?: int, min?: bool}|array{_: string, channel_id: int, access_hash: int, min: bool})) + */ + public function getInfo(mixed $id, int $type = \danog\MadelineProto\MTProto::INFO_TYPE_ALL) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($id, $type); + } + /** + * Get logger. + * @return mixed + */ + public function getLogger() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get TL namespaces. + * @return mixed + */ + public function getMethodNamespaces() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get namespaced methods (method => namespace). + * @return mixed + */ + public function getMethodsNamespaced() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get mime type from buffer. + * + * @param string $buffer Buffer + * @return string + */ + public static function getMimeFromBuffer(string $buffer): string + { + return \danog\MadelineProto\TL\Conversion\Extension::getMimeFromBuffer($buffer); + } + /** + * Get mime type from file extension. + * + * @param string $extension File extension + * @param string $default Default mime type + * @return string + */ + public static function getMimeFromExtension(string $extension, string $default): string + { + return \danog\MadelineProto\TL\Conversion\Extension::getMimeFromExtension($extension, $default); + } + /** + * Get mime type of file. + * + * @param string $file File + * @return string + */ + public static function getMimeFromFile(string $file): string + { + return \danog\MadelineProto\TL\Conversion\Extension::getMimeFromFile($file); + } + /** + * Get download info of the propic of a user + * Returns an array with the following structure:. + * + * `$info['ext']` - The file extension + * `$info['name']` - The file name, without the extension + * `$info['mime']` - The file mime type + * `$info['size']` - The file size + * @return mixed + */ + public function getPropicInfo($data) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($data); + } + /** + * Get PSR logger. + * @return mixed + */ + public function getPsrLogger() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get full info about peer (including full list of channel members), returns a Chat object. + * + * @param mixed $id Peer + * @see https://docs.madelineproto.xyz/Chat.html + * @return mixed + */ + public function getPwrChat(mixed $id, bool $fullfetch = true) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($id, $fullfetch); + } + /** + * Get secret chat. + * + * @param array|int $chat Secret chat ID + * @return mixed + */ + public function getSecretChat(array|int $chat) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($chat); + } + /** + * Get info about the logged-in user, cached. + * + * Use fullGetSelf to bypass the cache. + * @return mixed + */ + public function getSelf() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Return current settings. + * @return mixed + */ + public function getSettings() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get sponsored messages for channel. + * This method will return an array of [sponsored message objects](https://docs.madelineproto.xyz/API_docs/constructors/sponsoredMessage.html). + * + * See [the API documentation](https://core.telegram.org/api/sponsored-messages) for more info on how to handle sponsored messages. + * + * @param int|string|array $peer Channel ID, or Update, or Message, or Peer. + * @return mixed + */ + public function getSponsoredMessages(array|string|int $peer) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($peer); + } + /** + * Get TL serializer. + * @return mixed + */ + public function getTL() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Get updates. + * + * @param array{offset?: int, limit?: int, timeout?: float} $params Params + * @return mixed + */ + public function getUpdates(array $params = array ( + )) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($params); + } + /** + * Accesses a private variable from an object. + * + * @param object $obj Object + * @param string $var Attribute name + * @psalm-suppress InvalidScope + * @access public + * @return + */ + public static function getVar(object $obj, string $var) + { + return \danog\MadelineProto\Tools::getVar($obj, $var); + } + /** + * Get a message to show to the user when starting the bot. + * @return mixed + */ + public function getWebMessage(string $message) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($message); + } + /** + * Get web template. + * @return mixed + */ + public function getWebTemplate() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Checks whether all datacenters are authorized. + * @return mixed + */ + public function hasAllAuth() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Check if an event handler instance is present. + * @return mixed + */ + public function hasEventHandler() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Check if has report peers. + * @return mixed + */ + public function hasReportPeers() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Check whether secret chat exists. + * + * @param array|int $chat Secret chat ID + * @return mixed + */ + public function hasSecretChat(array|int $chat) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($chat); + } + /** + * Checks private property exists in an object. + * + * @param object $obj Object + * @param string $var Attribute name + * @psalm-suppress InvalidScope + * @access public + * @return bool + */ + public static function hasVar(object $obj, string $var): bool + { + return \danog\MadelineProto\Tools::hasVar($obj, $var); + } + /** + * Import authorization. + * + * @param array $authorization Authorization info + * @param int $mainDcID Main DC ID + * @return + */ + public function importAuthorization(array $authorization, int $mainDcID) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($authorization, $mainDcID); + } + /** + * Inflate stripped photosize to full JPG payload. + * + * @param string $stripped Stripped photosize + * @return string JPG payload + */ + public static function inflateStripped(string $stripped): string + { + return \danog\MadelineProto\Tools::inflateStripped($stripped); + } + /** + * Initialize self-restart hack. + * @return mixed + */ + public function initSelfRestart() + { + $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Whether this is altervista. + * @return bool + */ + public static function isAltervista(): bool + { + return \danog\MadelineProto\Tools::isAltervista(); + } + /** + * Check if is array or similar (traversable && countable && arrayAccess). + * + * @param mixed $var Value to check + * @return bool + */ + public static function isArrayOrAlike(mixed $var): bool + { + return \danog\MadelineProto\Tools::isArrayOrAlike($var); + } + /** + * Whether we're an IPC client instance. + * @return mixed + */ + public function isIpc() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Whether we're an IPC server process (as opposed to an event handler). + * @return mixed + */ + public function isIpcWorker() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Returns whether the current user is a premium user, cached. + * @return mixed + */ + public function isPremium() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Check whether provided bot API ID is a channel. + * + * @param int $id Bot API ID + * @return bool + */ + public static function isSupergroup(int $id): bool + { + return \danog\MadelineProto\MTProto::isSupergroup($id); + } + /** + * Logger. + * + * @param mixed $param Parameter + * @param int $level Logging level + * @param string $file File where the message originated + * @return mixed + */ + public function logger(mixed $param, int $level = \danog\MadelineProto\Logger::NOTICE, string $file = '') + { + $this->wrapper->getAPI()->{__FUNCTION__}($param, $level, $file); + } + /** + * Start MadelineProto's update handling loop, or run the provided async callable. + * + * @param callable|null $callback Async callable to run + * @return + */ + public function loop(?callable $callback = null) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($callback); + } + /** + * Escape string for markdown. + * + * @param string $hwat String to escape + * @return string + */ + public static function markdownEscape(string $hwat): string + { + return \danog\MadelineProto\StrTools::markdownEscape($hwat); + } + /** + * Telegram UTF-8 multibyte split. + * + * @param string $text Text + * @param integer $length Length + * @return array + */ + public static function mbStrSplit(string $text, int $length): array + { + return \danog\MadelineProto\StrTools::mbStrSplit($text, $length); + } + /** + * Get Telegram UTF-8 length of string. + * + * @param string $text Text + * @return int + */ + public static function mbStrlen(string $text): int + { + return \danog\MadelineProto\StrTools::mbStrlen($text); + } + /** + * Telegram UTF-8 multibyte substring. + * + * @param string $text Text to substring + * @param integer $offset Offset + * @param null|int $length Length + * @return string + */ + public static function mbSubstr(string $text, int $offset, ?int $length = null): string + { + return \danog\MadelineProto\StrTools::mbSubstr($text, $offset, $length); + } + /** + * Call method and wait asynchronously for response. + * + * If the $aargs['noResponse'] is true, will not wait for a response. + * + * @param string $method Method name + * @param array|(callable(): array) $args Arguments + * @param array $aargs Additional arguments + * @return + */ + public function methodCall(string $method, callable|array $args = array ( + ), array $aargs = array ( + 'msg_id' => null, + )) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($method, $args, $aargs); + } + /** + * Call method and make sure it is asynchronously sent. + * + * @param string $method Method name + * @param array|(callable(): array) $args Arguments + * @param array $aargs Additional arguments + * @return + */ + public function methodCallWrite(string $method, callable|array $args = array ( + ), array $aargs = array ( + 'msg_id' => null, + )) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($method, $args, $aargs); + } + /** + * Escape method name. + * + * @param string $method Method name + * @return string + */ + public static function methodEscape(string $method): string + { + return \danog\MadelineProto\StrTools::methodEscape($method); + } + /** + * Convert double to binary version. + * + * @param float $value Value to convert + * @return string + */ + public static function packDouble(float $value): string + { + return \danog\MadelineProto\Tools::packDouble($value); + } + /** + * Convert integer to base256 signed int. + * + * @param integer $value Value to convert + * @return string + */ + public static function packSignedInt(int $value): string + { + return \danog\MadelineProto\Tools::packSignedInt($value); + } + /** + * Convert integer to base256 long. + * + * @param int $value Value to convert + * @return string + */ + public static function packSignedLong(int $value): string + { + return \danog\MadelineProto\Tools::packSignedLong($value); + } + /** + * Convert value to unsigned base256 int. + * + * @param int $value Value + * @return string + */ + public static function packUnsignedInt(int $value): string + { + return \danog\MadelineProto\Tools::packUnsignedInt($value); + } + /** + * Check if peer is present in internal peer database. + * + * @param mixed $id Peer + * @return mixed + */ + public function peerIsset(mixed $id) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($id); + } + /** + * Login as user. + * + * @param string $number Phone number + * @param integer $sms_type SMS type + * @return + */ + public function phoneLogin(string $number, int $sms_type = 5) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($number, $sms_type); + } + /** + * Positive modulo + * Works just like the % (modulus) operator, only returns always a postive number. + * + * @param int $a A + * @param int $b B + * @return int Modulo + */ + public static function posmod(int $a, int $b): int + { + return \danog\MadelineProto\Tools::posmod($a, $b); + } + /** + * Get random string of specified length. + * + * @param integer $length Length + * @return string Random string + */ + public static function random(int $length): string + { + return \danog\MadelineProto\Tools::random($length); + } + /** + * Get random integer. + * + * @param integer $modulus Modulus + * @return int + */ + public static function randomInt(int $modulus = 0): int + { + return \danog\MadelineProto\Tools::randomInt($modulus); + } + /** + * Asynchronously read line. + * + * @param string $prompt Prompt + * @return string + */ + public static function readLine(string $prompt = ''): string + { + return \danog\MadelineProto\AsyncTools::readLine($prompt); + } + /** + * Refresh full peer cache for a certain peer. + * + * @param mixed $id The peer to refresh + * @return mixed + */ + public function refreshFullPeerCache(mixed $id) + { + $this->wrapper->getAPI()->{__FUNCTION__}($id); + } + /** + * Refresh peer cache for a certain peer. + * + * @param mixed ...$id The peer(s) to refresh + * @return mixed + */ + public function refreshPeerCache(mixed ...$ids) + { + $this->wrapper->getAPI()->{__FUNCTION__}(...$ids); + } + /** + * Rekey secret chat. + * + * @param int $chat Secret chat to rekey + * @return mixed + */ + public function rekey(int $chat) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($chat); + } + /** + * Report an error to the previously set peer. + * + * @param string $message Error to report + * @param string $parseMode Parse mode + * @return mixed + */ + public function report(string $message, string $parseMode = '') + { + $this->wrapper->getAPI()->{__FUNCTION__}($message, $parseMode); + } + /** + * Request VoIP call. + * + * @param mixed $user User + * @return + */ + public function requestCall(mixed $user) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($user); + } + /** + * Request secret chat. + * + * @param mixed $user User to start secret chat with + * @return + */ + public function requestSecretChat(mixed $user) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($user); + } + /** + * Reset the update state and fetch all updates from the beginning. + * @return mixed + */ + public function resetUpdateState() + { + $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Restart update loop. + * @return mixed + */ + public function restart() + { + $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * null-byte RLE decode. + * + * @param string $string Data to decode + * @return string + */ + public static function rleDecode(string $string): string + { + return \danog\MadelineProto\Tools::rleDecode($string); + } + /** + * null-byte RLE encode. + * + * @param string $string Data to encode + * @return string + */ + public static function rleEncode(string $string): string + { + return \danog\MadelineProto\Tools::rleEncode($string); + } + /** + * Get secret chat status. + * + * @param int $chat Chat ID + * @return mixed + */ + public function secretChatStatus(int $chat) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($chat); + } + /** + * Set NOOP update handler, ignoring all updates. + * @return mixed + */ + public function setNoop() + { + $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Set peer(s) where to send errors occurred in the event loop. + * + * @param int|string|array $userOrId Username(s) or peer ID(s) + * @return mixed + */ + public function setReportPeers(array|string|int $userOrId) + { + $this->wrapper->getAPI()->{__FUNCTION__}($userOrId); + } + /** + * Sets a private variable in an object. + * + * @param object $obj Object + * @param string $var Attribute name + * @param mixed $val Attribute value + * @psalm-suppress InvalidScope + * @access public + * @return void + */ + public static function setVar(object $obj, string $var, mixed &$val): void + { + \danog\MadelineProto\Tools::setVar($obj, $var, $val); + } + /** + * Set web template. + * + * @param string $template Template + * @return mixed + */ + public function setWebTemplate(string $template) + { + $this->wrapper->getAPI()->{__FUNCTION__}($template); + } + /** + * Set webhook update handler. + * + * @param string $webhookUrl Webhook URL + * @return mixed + */ + public function setWebhook(string $webhookUrl) + { + $this->wrapper->getAPI()->{__FUNCTION__}($webhookUrl); + } + /** + * Setup logger. + * @return mixed + */ + public function setupLogger() + { + $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Asynchronously sleep. + * + * @param float $time Number of seconds to sleep for + * @return void + */ + public static function sleep(float $time): void + { + \danog\MadelineProto\AsyncTools::sleep($time); + } + /** + * Resolves with a two-item array delineating successful and failed Promise results. + * The returned promise will only fail if the given number of required promises fail. + * + * @deprecated Coroutines are deprecated since amp v3 + * @param array<(Future|Generator)> $promises Promises + * @return + */ + public static function some(array $promises) + { + return \danog\MadelineProto\AsyncTools::some($promises); + } + /** + * Log in to telegram (via CLI or web). + * @return + */ + public function start() + { + return $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Stop update loop. + * @return mixed + */ + public function stop() + { + $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Subscribe to event handler updates for a channel/supergroup we're not a member of. + * + * @return mixed + */ + public function subscribeToUpdates(mixed $channel) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($channel); + } + /** + * Convert TD to MTProto parameters. + * + * @param array $params Parameters + * @return mixed + */ + public function tdToMTProto(array $params) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($params); + } + /** + * Convert TD parameters to tdcli. + * + * @param mixed $params Parameters + * @return + */ + public function tdToTdcli(mixed $params) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($params); + } + /** + * Convert tdcli parameters to tdcli. + * + * @param mixed $params Params + * @param array $key Key + * @return mixed + */ + public function tdcliToTd(&$params, ?array $key = null) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($params, $key); + } + /** + * Create an artificial timeout for any \Generator or Promise. + * + * @deprecated Coroutines are deprecated since amp v3 + * @param int $timeout In milliseconds + * @return mixed + */ + public static function timeout(\Generator|\Amp\Future $promise, int $timeout): mixed + { + return \danog\MadelineProto\AsyncTools::timeout($promise, $timeout); + } + /** + * Creates an artificial timeout for any `Promise`. + * + * If the promise is resolved before the timeout expires, the result is returned + * + * If the timeout expires before the promise is resolved, a default value is returned + * + * @deprecated Coroutines are deprecated since amp v3 + * @template TReturnAlt + * @template TReturn + * @template TGenerator of Generator + * @param Future|TGenerator $promise Promise to which the timeout is applied. + * @param int $timeout Timeout in milliseconds. + * @param TReturnAlt $default + * @return TReturn|TReturnAlt + */ + public static function timeoutWithDefault($promise, int $timeout, $default = null): mixed + { + return \danog\MadelineProto\AsyncTools::timeoutWithDefault($promise, $timeout, $default); + } + /** + * Convert to camelCase. + * + * @param string $input String + * @return string + */ + public static function toCamelCase(string $input): string + { + return \danog\MadelineProto\StrTools::toCamelCase($input); + } + /** + * Convert to snake_case. + * + * @param string $input String + * @return string + */ + public static function toSnakeCase(string $input): string + { + return \danog\MadelineProto\StrTools::toSnakeCase($input); + } + /** + * Convert MTProto channel ID to bot API channel ID. + * + * @param int $id MTProto channel ID + * @return int + */ + public static function toSupergroup(int $id): int + { + return \danog\MadelineProto\MTProto::toSupergroup($id); + } + /** + * Escape type name. + * + * @param string $type String to escape + * @return string + */ + public static function typeEscape(string $type): string + { + return \danog\MadelineProto\StrTools::typeEscape($type); + } + /** + * Unpack binary double. + * + * @param string $value Value to unpack + * @return float + */ + public static function unpackDouble(string $value): float + { + return \danog\MadelineProto\Tools::unpackDouble($value); + } + /** + * Unpack bot API file ID. + * + * @param string $fileId Bot API file ID + * @return mixed + */ + public function unpackFileId(string $fileId) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($fileId); + } + /** + * Unpack base256 signed int. + * + * @param string $value base256 int + * @return int + */ + public static function unpackSignedInt(string $value): int + { + return \danog\MadelineProto\Tools::unpackSignedInt($value); + } + /** + * Unpack base256 signed long. + * + * @param string $value base256 long + * @return int + */ + public static function unpackSignedLong(string $value): int + { + return \danog\MadelineProto\Tools::unpackSignedLong($value); + } + /** + * Unpack base256 signed long to string. + * + * @param string|int|array $value base256 long + * @return string + */ + public static function unpackSignedLongString(array|string|int $value): string + { + return \danog\MadelineProto\Tools::unpackSignedLongString($value); + } + /** + * Unset event handler. + * + * @return mixed + */ + public function unsetEventHandler() + { + $this->wrapper->getAPI()->{__FUNCTION__}(); + } + /** + * Update the 2FA password. + * + * The params array can contain password, new_password, email and hint params. + * + * @param array $params The params + * @return mixed + */ + public function update2fa(array $params) + { + $this->wrapper->getAPI()->{__FUNCTION__}($params); + } + /** + * Parse, update and store settings. + * + * @param SettingsAbstract $settings Settings + * @return mixed + */ + public function updateSettings(\danog\MadelineProto\SettingsAbstract $settings) + { + $this->wrapper->getAPI()->{__FUNCTION__}($settings); + } + /** + * Upload file. + * + * @param FileCallbackInterface|string|array $file File, URL or Telegram file to upload + * @param string $fileName File name + * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) + * @param boolean $encrypted Whether to encrypt file for secret chats + * @return + */ + public function upload(\danog\MadelineProto\FileCallbackInterface|array|string $file, string $fileName = '', ?callable $cb = null, bool $encrypted = false) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($file, $fileName, $cb, $encrypted); + } + /** + * Upload file to secret chat. + * + * @param FileCallbackInterface|string|array $file File, URL or Telegram file to upload + * @param string $fileName File name + * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) + * @return + */ + public function uploadEncrypted(\danog\MadelineProto\FileCallbackInterface|array|string $file, string $fileName = '', ?callable $cb = null) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($file, $fileName, $cb); + } + /** + * Upload file from callable. + * + * The callable must accept two parameters: int $offset, int $size + * The callable must return a string with the contest of the file at the specified offset and size. + * + * @param mixed $callable Callable + * @param integer $size File size + * @param string $mime Mime type + * @param string $fileName File name + * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) + * @param boolean $seekable Whether chunks can be fetched out of order + * @param boolean $encrypted Whether to encrypt file for secret chats + * @return + */ + public function uploadFromCallable(callable $callable, int $size, string $mime, string $fileName = '', ?callable $cb = null, bool $seekable = true, bool $encrypted = false) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($callable, $size, $mime, $fileName, $cb, $seekable, $encrypted); + } + /** + * Upload file from stream. + * + * @param mixed $stream PHP resource or AMPHP async stream + * @param integer $size File size + * @param string $mime Mime type + * @param string $fileName File name + * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) + * @param boolean $encrypted Whether to encrypt file for secret chats + * @return + */ + public function uploadFromStream(mixed $stream, int $size, string $mime, string $fileName = '', ?callable $cb = null, bool $encrypted = false) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($stream, $size, $mime, $fileName, $cb, $encrypted); + } + /** + * Reupload telegram file. + * + * @param mixed $media Telegram file + * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) + * @param boolean $encrypted Whether to encrypt file for secret chats + * @return + */ + public function uploadFromTgfile(mixed $media, ?callable $cb = null, bool $encrypted = false) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($media, $cb, $encrypted); + } + /** + * Upload file from URL. + * + * @param string|FileCallbackInterface $url URL of file + * @param integer $size Size of file + * @param string $fileName File name + * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) + * @param boolean $encrypted Whether to encrypt file for secret chats + * @return + */ + public function uploadFromUrl(\danog\MadelineProto\FileCallbackInterface|string $url, int $size = 0, string $fileName = '', ?callable $cb = null, bool $encrypted = false) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($url, $size, $fileName, $cb, $encrypted); + } + /** + * Mark sponsored message as read. + * + * @param int|array $peer Channel ID, or Update, or Message, or Peer. + * @param string|array{random_id: string} $message Random ID or sponsored message to mark as read. + * @return mixed + */ + public function viewSponsoredMessage(array|int $peer, array|string $message) + { + return $this->wrapper->getAPI()->{__FUNCTION__}($peer, $message); + } + /** + * Synchronously wait for a Future|generator. + * + * @deprecated Coroutines are deprecated since amp v3 + * @param Generator|Future $promise The promise to wait for + * @return + */ + public static function wait(\Generator|\Amp\Future $promise) + { + return \danog\MadelineProto\AsyncTools::wait($promise); + } + } diff --git a/src/danog/MadelineProto/Ipc/Client.php b/src/Ipc/Client.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Client.php rename to src/Ipc/Client.php diff --git a/src/danog/MadelineProto/Ipc/ClientAbstract.php b/src/Ipc/ClientAbstract.php similarity index 100% rename from src/danog/MadelineProto/Ipc/ClientAbstract.php rename to src/Ipc/ClientAbstract.php diff --git a/src/danog/MadelineProto/Ipc/ExitFailure.php b/src/Ipc/ExitFailure.php similarity index 100% rename from src/danog/MadelineProto/Ipc/ExitFailure.php rename to src/Ipc/ExitFailure.php diff --git a/src/danog/MadelineProto/Ipc/IpcState.php b/src/Ipc/IpcState.php similarity index 100% rename from src/danog/MadelineProto/Ipc/IpcState.php rename to src/Ipc/IpcState.php diff --git a/src/danog/MadelineProto/Ipc/Runner/ProcessRunner.php b/src/Ipc/Runner/ProcessRunner.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Runner/ProcessRunner.php rename to src/Ipc/Runner/ProcessRunner.php diff --git a/src/danog/MadelineProto/Ipc/Runner/RunnerAbstract.php b/src/Ipc/Runner/RunnerAbstract.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Runner/RunnerAbstract.php rename to src/Ipc/Runner/RunnerAbstract.php diff --git a/src/danog/MadelineProto/Ipc/Runner/WebRunner.php b/src/Ipc/Runner/WebRunner.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Runner/WebRunner.php rename to src/Ipc/Runner/WebRunner.php diff --git a/src/danog/MadelineProto/Ipc/Runner/entry.php b/src/Ipc/Runner/entry.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Runner/entry.php rename to src/Ipc/Runner/entry.php diff --git a/src/danog/MadelineProto/Ipc/Server.php b/src/Ipc/Server.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Server.php rename to src/Ipc/Server.php diff --git a/src/danog/MadelineProto/Ipc/ServerCallback.php b/src/Ipc/ServerCallback.php similarity index 100% rename from src/danog/MadelineProto/Ipc/ServerCallback.php rename to src/Ipc/ServerCallback.php diff --git a/src/danog/MadelineProto/Ipc/Wrapper.php b/src/Ipc/Wrapper.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Wrapper.php rename to src/Ipc/Wrapper.php diff --git a/src/danog/MadelineProto/Ipc/Wrapper/ClosableTrait.php b/src/Ipc/Wrapper/ClosableTrait.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Wrapper/ClosableTrait.php rename to src/Ipc/Wrapper/ClosableTrait.php diff --git a/src/danog/MadelineProto/Ipc/Wrapper/FileCallback.php b/src/Ipc/Wrapper/FileCallback.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Wrapper/FileCallback.php rename to src/Ipc/Wrapper/FileCallback.php diff --git a/src/danog/MadelineProto/Ipc/Wrapper/Obj.php b/src/Ipc/Wrapper/Obj.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Wrapper/Obj.php rename to src/Ipc/Wrapper/Obj.php diff --git a/src/danog/MadelineProto/Ipc/Wrapper/ReadableStream.php b/src/Ipc/Wrapper/ReadableStream.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Wrapper/ReadableStream.php rename to src/Ipc/Wrapper/ReadableStream.php diff --git a/src/danog/MadelineProto/Ipc/Wrapper/SeekableReadableStream.php b/src/Ipc/Wrapper/SeekableReadableStream.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Wrapper/SeekableReadableStream.php rename to src/Ipc/Wrapper/SeekableReadableStream.php diff --git a/src/danog/MadelineProto/Ipc/Wrapper/SeekableTrait.php b/src/Ipc/Wrapper/SeekableTrait.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Wrapper/SeekableTrait.php rename to src/Ipc/Wrapper/SeekableTrait.php diff --git a/src/danog/MadelineProto/Ipc/Wrapper/SeekableWritableStream.php b/src/Ipc/Wrapper/SeekableWritableStream.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Wrapper/SeekableWritableStream.php rename to src/Ipc/Wrapper/SeekableWritableStream.php diff --git a/src/danog/MadelineProto/Ipc/Wrapper/WrapMethodTrait.php b/src/Ipc/Wrapper/WrapMethodTrait.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Wrapper/WrapMethodTrait.php rename to src/Ipc/Wrapper/WrapMethodTrait.php diff --git a/src/danog/MadelineProto/Ipc/Wrapper/WritableStream.php b/src/Ipc/Wrapper/WritableStream.php similarity index 100% rename from src/danog/MadelineProto/Ipc/Wrapper/WritableStream.php rename to src/Ipc/Wrapper/WritableStream.php diff --git a/src/danog/MadelineProto/Lang.php b/src/Lang.php similarity index 100% rename from src/danog/MadelineProto/Lang.php rename to src/Lang.php diff --git a/src/danog/MadelineProto/LightState.php b/src/LightState.php similarity index 100% rename from src/danog/MadelineProto/LightState.php rename to src/LightState.php diff --git a/src/danog/MadelineProto/Logger.php b/src/Logger.php similarity index 100% rename from src/danog/MadelineProto/Logger.php rename to src/Logger.php diff --git a/src/danog/MadelineProto/LoggerGetter.php b/src/LoggerGetter.php similarity index 100% rename from src/danog/MadelineProto/LoggerGetter.php rename to src/LoggerGetter.php diff --git a/src/danog/MadelineProto/Loop/APILoop.php b/src/Loop/APILoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/APILoop.php rename to src/Loop/APILoop.php diff --git a/src/danog/MadelineProto/Loop/Connection/CheckLoop.php b/src/Loop/Connection/CheckLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/Connection/CheckLoop.php rename to src/Loop/Connection/CheckLoop.php diff --git a/src/danog/MadelineProto/Loop/Connection/CleanupLoop.php b/src/Loop/Connection/CleanupLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/Connection/CleanupLoop.php rename to src/Loop/Connection/CleanupLoop.php diff --git a/src/danog/MadelineProto/Loop/Connection/Common.php b/src/Loop/Connection/Common.php similarity index 100% rename from src/danog/MadelineProto/Loop/Connection/Common.php rename to src/Loop/Connection/Common.php diff --git a/src/danog/MadelineProto/Loop/Connection/HttpWaitLoop.php b/src/Loop/Connection/HttpWaitLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/Connection/HttpWaitLoop.php rename to src/Loop/Connection/HttpWaitLoop.php diff --git a/src/danog/MadelineProto/Loop/Connection/PingLoop.php b/src/Loop/Connection/PingLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/Connection/PingLoop.php rename to src/Loop/Connection/PingLoop.php diff --git a/src/danog/MadelineProto/Loop/Connection/ReadLoop.php b/src/Loop/Connection/ReadLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/Connection/ReadLoop.php rename to src/Loop/Connection/ReadLoop.php diff --git a/src/danog/MadelineProto/Loop/Connection/WriteLoop.php b/src/Loop/Connection/WriteLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/Connection/WriteLoop.php rename to src/Loop/Connection/WriteLoop.php diff --git a/src/danog/MadelineProto/Loop/Generic/PeriodicLoopInternal.php b/src/Loop/Generic/PeriodicLoopInternal.php similarity index 100% rename from src/danog/MadelineProto/Loop/Generic/PeriodicLoopInternal.php rename to src/Loop/Generic/PeriodicLoopInternal.php diff --git a/src/danog/MadelineProto/Loop/InternalLoop.php b/src/Loop/InternalLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/InternalLoop.php rename to src/Loop/InternalLoop.php diff --git a/src/danog/MadelineProto/Loop/LoggerLoop.php b/src/Loop/LoggerLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/LoggerLoop.php rename to src/Loop/LoggerLoop.php diff --git a/src/danog/MadelineProto/Loop/Update/FeedLoop.php b/src/Loop/Update/FeedLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/Update/FeedLoop.php rename to src/Loop/Update/FeedLoop.php diff --git a/src/danog/MadelineProto/Loop/Update/SecretFeedLoop.php b/src/Loop/Update/SecretFeedLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/Update/SecretFeedLoop.php rename to src/Loop/Update/SecretFeedLoop.php diff --git a/src/danog/MadelineProto/Loop/Update/SeqLoop.php b/src/Loop/Update/SeqLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/Update/SeqLoop.php rename to src/Loop/Update/SeqLoop.php diff --git a/src/danog/MadelineProto/Loop/Update/UpdateLoop.php b/src/Loop/Update/UpdateLoop.php similarity index 100% rename from src/danog/MadelineProto/Loop/Update/UpdateLoop.php rename to src/Loop/Update/UpdateLoop.php diff --git a/src/danog/MadelineProto/MTProto.php b/src/MTProto.php similarity index 99% rename from src/danog/MadelineProto/MTProto.php rename to src/MTProto.php index 55b944fcf..22065d578 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/MTProto.php @@ -1607,7 +1607,7 @@ final class MTProto implements TLCallback, LoggerGetter $this->logger->logger($e->getMessage()); return false; } - return $this->authorization['user']; + return $this->getSelf(); } /** * Get authorization info. @@ -1752,14 +1752,23 @@ final class MTProto implements TLCallback, LoggerGetter } return \array_merge($methods, \get_class_methods(InternalDoc::class)); } + /** + * @internal + */ public function getMethodAfterResponseDeserializationCallbacks(): array { return []; } + /** + * @internal + */ public function getMethodBeforeResponseDeserializationCallbacks(): array { return []; } + /** + * @internal + */ public function getConstructorAfterDeserializationCallbacks(): array { return \array_merge( @@ -1770,14 +1779,23 @@ final class MTProto implements TLCallback, LoggerGetter ['config' => [$this->addConfig(...)]], ); } + /** + * @internal + */ public function getConstructorBeforeDeserializationCallbacks(): array { return []; } + /** + * @internal + */ public function getConstructorBeforeSerializationCallbacks(): array { return []; } + /** + * @internal + */ public function getTypeMismatchCallbacks(): array { return \array_merge( @@ -1818,6 +1836,9 @@ final class MTProto implements TLCallback, LoggerGetter ), ); } + /** + * @internal + */ public function areDeserializationCallbacksMutuallyExclusive(): bool { return false; diff --git a/src/danog/MadelineProto/MTProto/AuthKey.php b/src/MTProto/AuthKey.php similarity index 100% rename from src/danog/MadelineProto/MTProto/AuthKey.php rename to src/MTProto/AuthKey.php diff --git a/src/danog/MadelineProto/MTProto/Container.php b/src/MTProto/Container.php similarity index 100% rename from src/danog/MadelineProto/MTProto/Container.php rename to src/MTProto/Container.php diff --git a/src/danog/MadelineProto/MTProto/IncomingMessage.php b/src/MTProto/IncomingMessage.php similarity index 100% rename from src/danog/MadelineProto/MTProto/IncomingMessage.php rename to src/MTProto/IncomingMessage.php diff --git a/src/danog/MadelineProto/MTProto/Message.php b/src/MTProto/Message.php similarity index 100% rename from src/danog/MadelineProto/MTProto/Message.php rename to src/MTProto/Message.php diff --git a/src/danog/MadelineProto/MTProto/OutgoingMessage.php b/src/MTProto/OutgoingMessage.php similarity index 100% rename from src/danog/MadelineProto/MTProto/OutgoingMessage.php rename to src/MTProto/OutgoingMessage.php diff --git a/src/danog/MadelineProto/MTProto/PermAuthKey.php b/src/MTProto/PermAuthKey.php similarity index 100% rename from src/danog/MadelineProto/MTProto/PermAuthKey.php rename to src/MTProto/PermAuthKey.php diff --git a/src/danog/MadelineProto/MTProto/TempAuthKey.php b/src/MTProto/TempAuthKey.php similarity index 100% rename from src/danog/MadelineProto/MTProto/TempAuthKey.php rename to src/MTProto/TempAuthKey.php diff --git a/src/danog/MadelineProto/MTProtoSession/AckHandler.php b/src/MTProtoSession/AckHandler.php similarity index 100% rename from src/danog/MadelineProto/MTProtoSession/AckHandler.php rename to src/MTProtoSession/AckHandler.php diff --git a/src/danog/MadelineProto/MTProtoSession/AuthKeyHandler.php b/src/MTProtoSession/AuthKeyHandler.php similarity index 100% rename from src/danog/MadelineProto/MTProtoSession/AuthKeyHandler.php rename to src/MTProtoSession/AuthKeyHandler.php diff --git a/src/danog/MadelineProto/MTProtoSession/CallHandler.php b/src/MTProtoSession/CallHandler.php similarity index 100% rename from src/danog/MadelineProto/MTProtoSession/CallHandler.php rename to src/MTProtoSession/CallHandler.php diff --git a/src/danog/MadelineProto/MTProtoSession/MsgIdHandler.php b/src/MTProtoSession/MsgIdHandler.php similarity index 100% rename from src/danog/MadelineProto/MTProtoSession/MsgIdHandler.php rename to src/MTProtoSession/MsgIdHandler.php diff --git a/src/danog/MadelineProto/MTProtoSession/Reliable.php b/src/MTProtoSession/Reliable.php similarity index 100% rename from src/danog/MadelineProto/MTProtoSession/Reliable.php rename to src/MTProtoSession/Reliable.php diff --git a/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php b/src/MTProtoSession/ResponseHandler.php similarity index 100% rename from src/danog/MadelineProto/MTProtoSession/ResponseHandler.php rename to src/MTProtoSession/ResponseHandler.php diff --git a/src/danog/MadelineProto/MTProtoSession/SeqNoHandler.php b/src/MTProtoSession/SeqNoHandler.php similarity index 100% rename from src/danog/MadelineProto/MTProtoSession/SeqNoHandler.php rename to src/MTProtoSession/SeqNoHandler.php diff --git a/src/danog/MadelineProto/MTProtoSession/Session.php b/src/MTProtoSession/Session.php similarity index 100% rename from src/danog/MadelineProto/MTProtoSession/Session.php rename to src/MTProtoSession/Session.php diff --git a/src/danog/MadelineProto/MTProtoTools/AuthKeyHandler.php b/src/MTProtoTools/AuthKeyHandler.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/AuthKeyHandler.php rename to src/MTProtoTools/AuthKeyHandler.php diff --git a/src/danog/MadelineProto/MTProtoTools/CallHandler.php b/src/MTProtoTools/CallHandler.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/CallHandler.php rename to src/MTProtoTools/CallHandler.php diff --git a/src/danog/MadelineProto/MTProtoTools/CombinedUpdatesState.php b/src/MTProtoTools/CombinedUpdatesState.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/CombinedUpdatesState.php rename to src/MTProtoTools/CombinedUpdatesState.php diff --git a/src/danog/MadelineProto/MTProtoTools/Crypt.php b/src/MTProtoTools/Crypt.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/Crypt.php rename to src/MTProtoTools/Crypt.php diff --git a/src/danog/MadelineProto/MTProtoTools/Crypt/IGE.php b/src/MTProtoTools/Crypt/IGE.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/Crypt/IGE.php rename to src/MTProtoTools/Crypt/IGE.php diff --git a/src/danog/MadelineProto/MTProtoTools/Crypt/IGEOpenssl.php b/src/MTProtoTools/Crypt/IGEOpenssl.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/Crypt/IGEOpenssl.php rename to src/MTProtoTools/Crypt/IGEOpenssl.php diff --git a/src/danog/MadelineProto/MTProtoTools/Crypt/IGEPhpseclib.php b/src/MTProtoTools/Crypt/IGEPhpseclib.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/Crypt/IGEPhpseclib.php rename to src/MTProtoTools/Crypt/IGEPhpseclib.php diff --git a/src/danog/MadelineProto/MTProtoTools/Files.php b/src/MTProtoTools/Files.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/Files.php rename to src/MTProtoTools/Files.php diff --git a/src/danog/MadelineProto/MTProtoTools/FilesLogic.php b/src/MTProtoTools/FilesLogic.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/FilesLogic.php rename to src/MTProtoTools/FilesLogic.php diff --git a/src/danog/MadelineProto/MTProtoTools/MinDatabase.php b/src/MTProtoTools/MinDatabase.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/MinDatabase.php rename to src/MTProtoTools/MinDatabase.php diff --git a/src/danog/MadelineProto/MTProtoTools/PasswordCalculator.php b/src/MTProtoTools/PasswordCalculator.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/PasswordCalculator.php rename to src/MTProtoTools/PasswordCalculator.php diff --git a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php b/src/MTProtoTools/PeerHandler.php similarity index 98% rename from src/danog/MadelineProto/MTProtoTools/PeerHandler.php rename to src/MTProtoTools/PeerHandler.php index 7fc50609e..81aee9c75 100644 --- a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php +++ b/src/MTProtoTools/PeerHandler.php @@ -773,17 +773,22 @@ trait PeerHandler /** * Refresh peer cache for a certain peer. * - * @param mixed $id The peer to refresh + * @param mixed ...$id The peer(s) to refresh */ - public function refreshPeerCache(mixed $id): void + public function refreshPeerCache(mixed ...$ids): void { - $id = $this->getInfo($id, MTProto::INFO_TYPE_ID); - if ($this->isSupergroup($id)) { - $this->methodCallAsyncRead('channels.getChannels', ['id' => [$this->genAll($this->chats[$id], 0, MTProto::INFO_TYPE_CONSTRUCTOR)]]); - } elseif ($id < 0) { - $this->methodCallAsyncRead('messages.getChats', ['id' => [$id]]); - } else { - $this->methodCallAsyncRead('users.getUsers', ['id' => [$this->genAll($this->chats[$id], 0, MTProto::INFO_TYPE_CONSTRUCTOR)]]); + $ids = array_map(fn ($id) => $this->getInfo($id, MTProto::INFO_TYPE_ID), $ids); + $supergroups = array_filter($ids, self::isSupergroup(...)); + $chats = array_filter($ids, fn (int $id): bool => $id < 0); + $users = array_filter($ids, fn (int $id): bool => $id > 0); + if ($supergroups) { + $this->methodCallAsyncRead('channels.getChannels', ['id' => $supergroups]); + } + if ($chats) { + $this->methodCallAsyncRead('messages.getChats', ['id' => $chats]); + } + if ($users) { + $this->methodCallAsyncRead('users.getUsers', ['id' => $users]); } } /** diff --git a/src/danog/MadelineProto/MTProtoTools/ReferenceDatabase.php b/src/MTProtoTools/ReferenceDatabase.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/ReferenceDatabase.php rename to src/MTProtoTools/ReferenceDatabase.php diff --git a/src/danog/MadelineProto/MTProtoTools/ResponseInfo.php b/src/MTProtoTools/ResponseInfo.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/ResponseInfo.php rename to src/MTProtoTools/ResponseInfo.php diff --git a/src/danog/MadelineProto/MTProtoTools/UpdateHandler.php b/src/MTProtoTools/UpdateHandler.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/UpdateHandler.php rename to src/MTProtoTools/UpdateHandler.php diff --git a/src/danog/MadelineProto/MTProtoTools/UpdatesState.php b/src/MTProtoTools/UpdatesState.php similarity index 100% rename from src/danog/MadelineProto/MTProtoTools/UpdatesState.php rename to src/MTProtoTools/UpdatesState.php diff --git a/src/danog/MadelineProto/Magic.php b/src/Magic.php similarity index 100% rename from src/danog/MadelineProto/Magic.php rename to src/Magic.php diff --git a/src/danog/MadelineProto/MyTelegramOrgWrapper.php b/src/MyTelegramOrgWrapper.php similarity index 100% rename from src/danog/MadelineProto/MyTelegramOrgWrapper.php rename to src/MyTelegramOrgWrapper.php diff --git a/src/Namespace/AbstractAPI.php b/src/Namespace/AbstractAPI.php new file mode 100644 index 000000000..c68dc3459 --- /dev/null +++ b/src/Namespace/AbstractAPI.php @@ -0,0 +1,57 @@ +. + * + * @author Daniil Gentili + * @copyright 2016-2023 Daniil Gentili + * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 + * @link https://docs.madelineproto.xyz MadelineProto documentation + */ + +namespace danog\MadelineProto\Namespace; + +use danog\MadelineProto\APIWrapper; +use InvalidArgumentException; + +/** + * @internal + */ +final class AbstractAPI +{ + private APIWrapper $wrapper; + public function __construct(private string $namespace) + { + } + public function setWrapper(APIWrapper $wrapper): void + { + $this->wrapper = $wrapper; + } + /** + * Call async wrapper function. + * + * @param string $name Method name + * @param array $arguments Arguments + */ + public function __call(string $name, array $arguments) + { + if ($arguments && !isset($arguments[0])) { + $arguments = [$arguments]; + } + + $name = $this->namespace.'.'.$name; + $aargs = isset($arguments[1]) && \is_array($arguments[1]) ? $arguments[1] : []; + $args = isset($arguments[0]) && \is_array($arguments[0]) ? $arguments[0] : []; + if (isset($args[0]) && !isset($args['multiple'])) { + throw new InvalidArgumentException('Parameter names must be provided!'); + } + return $this->wrapper->getAPI()->methodCallAsyncRead($name, $args, $aargs); + } +} diff --git a/src/Namespace/Account.php b/src/Namespace/Account.php new file mode 100644 index 000000000..6a73c1821 --- /dev/null +++ b/src/Namespace/Account.php @@ -0,0 +1,837 @@ +**Possible values**:
`1` \- APNS (device token for apple push)
`2` \- FCM (firebase token for google firebase)
`3` \- MPNS (channel URI for microsoft push)
`4` \- Simple push (endpoint for firefox's simple push API)
`5` \- Ubuntu phone (token for ubuntu push)
`6` \- Blackberry (token for blackberry push)
`7` \- Unused
`8` \- WNS (windows push)
`9` \- APNS VoIP (token for apple push VoIP)
`10` \- Web push (web push, see below)
`11` \- MPNS VoIP (token for microsoft push VoIP)
`12` \- Tizen (token for tizen push)

For `10` web push, the token must be a JSON-encoded object containing the keys described in [PUSH updates](https://core.telegram.org/api/push-updates) + * @param string $token Device token + * @param bool $app_sandbox If [(boolTrue)](https://docs.madelineproto.xyz/API_docs/constructors/boolTrue.html) is transmitted, a sandbox-certificate will be used during transmission. + * @param string $secret For FCM and APNS VoIP, optional encryption key used to encrypt push notifications + * @param array $other_uids List of user identifiers of other users currently using the client @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $no_muted Avoid receiving (silent and invisible background) notifications. Useful to save battery. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function registerDevice(int $token_type, string $token, bool $app_sandbox, string $secret, array $other_uids, array $no_muted = []); + + /** + * Deletes a device by its token, stops sending PUSH-notifications to it. + * + * @param int $token_type Device token type.
**Possible values**:
`1` \- APNS (device token for apple push)
`2` \- FCM (firebase token for google firebase)
`3` \- MPNS (channel URI for microsoft push)
`4` \- Simple push (endpoint for firefox's simple push API)
`5` \- Ubuntu phone (token for ubuntu push)
`6` \- Blackberry (token for blackberry push)
`7` \- Unused
`8` \- WNS (windows push)
`9` \- APNS VoIP (token for apple push VoIP)
`10` \- Web push (web push, see below)
`11` \- MPNS VoIP (token for microsoft push VoIP)
`12` \- Tizen (token for tizen push)

For `10` web push, the token must be a JSON-encoded object containing the keys described in [PUSH updates](https://core.telegram.org/api/push-updates) + * @param string $token Device token + * @param array $other_uids List of user identifiers of other users currently using the client @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function unregisterDevice(int $token_type, string $token, array $other_uids); + + /** + * Edits notification settings from a given user/group, from all users/all groups. + * + * @param array $peer Notification source @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $settings Notification settings @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function updateNotifySettings(array $peer, array $settings); + + /** + * Gets current notification settings for a given user/group, from all users/all groups. + * + * @param array $peer Notification source @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getNotifySettings(array $peer); + + /** + * Resets all notification settings from users and groups. + * + * @return array + */ + public function resetNotifySettings(); + + /** + * Updates user profile. + * + * @param string $first_name New user first name + * @param string $last_name New user last name + * @param string $about New bio + * + * + * @return array + */ + public function updateProfile(string $first_name = '', string $last_name = '', string $about = ''); + + /** + * Updates online user status. + * + * @param bool $offline If [(boolTrue)](https://docs.madelineproto.xyz/API_docs/constructors/boolTrue.html) is transmitted, user status will change to [(userStatusOffline)](https://docs.madelineproto.xyz/API_docs/constructors/userStatusOffline.html). + * + * + * @return array + */ + public function updateStatus(bool $offline); + + /** + * Returns a list of available [wallpapers](https://core.telegram.org/api/wallpapers). + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getWallPapers(array $hash = []); + + /** + * Report a peer for violation of telegram's Terms of Service + * + * @param array $peer The peer to report @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $reason The reason why this peer is being reported @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $message Comment for report moderation + * + * + * @return array + */ + public function reportPeer(array $peer, array $reason, string $message); + + /** + * Validates a username and checks availability. + * + * @param string $username username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. + * + * + * @return array + */ + public function checkUsername(string $username); + + /** + * Changes username for the current user. + * + * @param string $username username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. + * + * + * @return array + */ + public function updateUsername(string $username); + + /** + * Get privacy settings of current account + * + * @param array $key Peer category whose privacy settings should be fetched @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getPrivacy(array $key); + + /** + * Change privacy settings of current account + * + * @param array $key Peers to which the privacy rules apply @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $rules New privacy rules @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setPrivacy(array $key, array $rules); + + /** + * Delete the user's account from the telegram servers. + * + * Can also be used to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured, see [here »](https://core.telegram.org/api/srp#password-recovery) for more info on password recovery, and [here »](https://core.telegram.org/api/account-deletion) for more info on account deletion. + * + * @param string $reason Why is the account being deleted, can be empty + * @param array $password [2FA password](https://core.telegram.org/api/srp): this field can be omitted even for accounts with 2FA enabled: in this case account account deletion will be delayed by 7 days [as specified in the docs »](https://core.telegram.org/api/account-deletion) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function deleteAccount(string $reason, array $password = []); + + /** + * Get days to live of account + * + * @return array + */ + public function getAccountTTL(); + + /** + * Set account self-destruction period + * + * @param array $ttl Time to live in days @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setAccountTTL(array $ttl); + + /** + * Verify a new phone number to associate to the current account + * + * @param string $phone_number New phone number + * @param array $settings Phone code settings @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendChangePhoneCode(string $phone_number, array $settings); + + /** + * Change the phone number of the current account + * + * @param string $phone_number New phone number + * @param string $phone_code_hash Phone code hash received when calling [account.sendChangePhoneCode](https://docs.madelineproto.xyz/API_docs/methods/account.sendChangePhoneCode.html) + * @param string $phone_code Phone code received when calling [account.sendChangePhoneCode](https://docs.madelineproto.xyz/API_docs/methods/account.sendChangePhoneCode.html) + * + * + * @return array + */ + public function changePhone(string $phone_number, string $phone_code_hash, string $phone_code); + + /** + * When client-side passcode lock feature is enabled, will not show message texts in incoming [PUSH notifications](https://core.telegram.org/api/push-updates). + * + * @param int $period Inactivity period after which to start hiding message texts in [PUSH notifications](https://core.telegram.org/api/push-updates). + * + * + * @return array + */ + public function updateDeviceLocked(int $period); + + /** + * Get logged-in sessions + * + * @return array + */ + public function getAuthorizations(); + + /** + * Log out an active [authorized session](https://core.telegram.org/api/auth) by its hash + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function resetAuthorization(array $hash = []); + + /** + * Obtain configuration for two-factor authorization with password + * + * @return array + */ + public function getPassword(); + + /** + * Send confirmation code to cancel account deletion, for more info [click here »](https://core.telegram.org/api/account-deletion) + * + * @param string $hash The hash from the service notification, for more info [click here »](https://core.telegram.org/api/account-deletion) + * @param array $settings Phone code settings @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendConfirmPhoneCode(string $hash, array $settings); + + /** + * Confirm a phone number to cancel account deletion, for more info [click here »](https://core.telegram.org/api/account-deletion) + * + * @param string $phone_code_hash Phone code hash, for more info [click here »](https://core.telegram.org/api/account-deletion) + * @param string $phone_code SMS code, for more info [click here »](https://core.telegram.org/api/account-deletion) + * + * + * @return array + */ + public function confirmPhone(string $phone_code_hash, string $phone_code); + + /** + * Get temporary payment password + * + * @param array $password SRP password parameters @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $period Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 + * + * + * @return array + */ + public function getTmpPassword(array $password, int $period); + + /** + * Get web [login widget](https://core.telegram.org/widgets/login) authorizations + * + * @return array + */ + public function getWebAuthorizations(); + + /** + * Log out an active web [telegram login](https://core.telegram.org/widgets/login) session + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function resetWebAuthorization(array $hash = []); + + /** + * Reset all active web [telegram login](https://core.telegram.org/widgets/login) sessions + * + * @return array + */ + public function resetWebAuthorizations(); + + /** + * Get all saved [Telegram Passport](https://core.telegram.org/passport) documents, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption) + * + * @return array + */ + public function getAllSecureValues(); + + /** + * Get saved [Telegram Passport](https://core.telegram.org/passport) document, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption) + * + * @param array $types Requested value types @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getSecureValue(array $types); + + /** + * Securely save [Telegram Passport](https://core.telegram.org/passport) document, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption) + * + * @param array $value Secure value, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $secure_secret_id Passport secret hash, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption) + * + * + * @return array + */ + public function saveSecureValue(array $value, int $secure_secret_id); + + /** + * Delete stored [Telegram Passport](https://core.telegram.org/passport) documents, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption) + * + * @param array $types Document types to delete @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function deleteSecureValue(array $types); + + /** + * Returns a Telegram Passport authorization form for sharing data with a service + * + * @param int $bot_id User identifier of the service's bot + * @param string $scope Telegram Passport element types requested by the service + * @param string $public_key Service's public key + * + * + * @return array + */ + public function getAuthorizationForm(int $bot_id, string $scope, string $public_key); + + /** + * Sends a Telegram Passport authorization form, effectively sharing data with the service + * + * @param int $bot_id Bot ID + * @param string $scope Telegram Passport element types requested by the service + * @param string $public_key Service's public key + * @param array $value_hashes Types of values sent and their hashes @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $credentials Encrypted values @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function acceptAuthorization(int $bot_id, string $scope, string $public_key, array $value_hashes, array $credentials); + + /** + * Send the verification phone code for telegram [passport](https://core.telegram.org/passport). + * + * @param string $phone_number The phone number to verify + * @param array $settings Phone code settings @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendVerifyPhoneCode(string $phone_number, array $settings); + + /** + * Verify a phone number for telegram [passport](https://core.telegram.org/passport). + * + * @param string $phone_number Phone number + * @param string $phone_code_hash Phone code hash received from the call to [account.sendVerifyPhoneCode](https://docs.madelineproto.xyz/API_docs/methods/account.sendVerifyPhoneCode.html) + * @param string $phone_code Code received after the call to [account.sendVerifyPhoneCode](https://docs.madelineproto.xyz/API_docs/methods/account.sendVerifyPhoneCode.html) + * + * + * @return array + */ + public function verifyPhone(string $phone_number, string $phone_code_hash, string $phone_code); + + /** + * Send an email verification code. + * + * @param array $purpose @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $email The email where to send the code. + * + * + * @return array + */ + public function sendVerifyEmailCode(array $purpose, string $email); + + /** + * Verify an email address. + * + * @param array $purpose @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $verification @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function verifyEmail(array $purpose, array $verification); + + /** + * Initialize account takeout session + * + * @param array $contacts Whether to export contacts @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $message_users Whether to export messages in private chats @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $message_chats Whether to export messages in [basic groups](https://core.telegram.org/api/channel#basic-groups) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $message_megagroups Whether to export messages in [supergroups](https://core.telegram.org/api/channel#supergroups) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $message_channels Whether to export messages in [channels](https://core.telegram.org/api/channel#channels) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $files Whether to export files @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $file_max_size Maximum size of files to export + * + * + * @return array + */ + public function initTakeoutSession(array $contacts = [], array $message_users = [], array $message_chats = [], array $message_megagroups = [], array $message_channels = [], array $files = [], int $file_max_size = 0); + + /** + * Finish account takeout session + * + * @param array $success Data exported successfully @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function finishTakeoutSession(array $success = []); + + /** + * Verify an email to use as [2FA recovery method](https://core.telegram.org/api/srp). + * + * @param string $code The phone code that was received after [setting a recovery email](https://core.telegram.org/api/srp#email-verification) + * + * + * @return array + */ + public function confirmPasswordEmail(string $code); + + /** + * Resend the code to verify an email to use as [2FA recovery method](https://core.telegram.org/api/srp). + * + * @return array + */ + public function resendPasswordEmail(); + + /** + * Cancel the code that was sent to verify an email to use as [2FA recovery method](https://core.telegram.org/api/srp). + * + * @return array + */ + public function cancelPasswordEmail(); + + /** + * Whether the user will receive notifications when contacts sign up + * + * @return array + */ + public function getContactSignUpNotification(); + + /** + * Toggle contact sign up notifications + * + * @param bool $silent Whether to disable contact sign up notifications + * + * + * @return array + */ + public function setContactSignUpNotification(bool $silent); + + /** + * Returns list of chats with non-default notification settings + * + * @param array $compare_sound If true, chats with non-default sound will also be returned @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $peer If specified, only chats of the specified category will be returned @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getNotifyExceptions(array $compare_sound = [], array $peer = []); + + /** + * Get info about a certain [wallpaper](https://core.telegram.org/api/wallpapers) + * + * @param array $wallpaper The [wallpaper](https://core.telegram.org/api/wallpapers) to get info about @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getWallPaper(array $wallpaper); + + /** + * Create and upload a new [wallpaper](https://core.telegram.org/api/wallpapers) + * + * @param array $file The JPG/PNG wallpaper @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $mime_type MIME type of uploaded wallpaper + * @param array $settings Wallpaper settings @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function uploadWallPaper(array $file, string $mime_type, array $settings); + + /** + * Install/uninstall [wallpaper](https://core.telegram.org/api/wallpapers) + * + * @param array $wallpaper [Wallpaper](https://core.telegram.org/api/wallpapers) to install or uninstall @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $unsave Uninstall wallpaper? + * @param array $settings Wallpaper settings @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function saveWallPaper(array $wallpaper, bool $unsave, array $settings); + + /** + * Install [wallpaper](https://core.telegram.org/api/wallpapers) + * + * @param array $wallpaper [Wallpaper](https://core.telegram.org/api/wallpapers) to install @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $settings [Wallpaper](https://core.telegram.org/api/wallpapers) settings @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function installWallPaper(array $wallpaper, array $settings); + + /** + * Delete all installed [wallpapers](https://core.telegram.org/api/wallpapers), reverting to the default wallpaper set. + * + * @return array + */ + public function resetWallPapers(); + + /** + * Get media autodownload settings + * + * @return array + */ + public function getAutoDownloadSettings(); + + /** + * Change media autodownload settings + * + * @param array $settings Media autodownload settings @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $low Whether to save media in the low data usage preset @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $high Whether to save media in the high data usage preset @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function saveAutoDownloadSettings(array $settings, array $low = [], array $high = []); + + /** + * Upload theme + * + * @param array $file [Previously uploaded](https://core.telegram.org/api/themes#uploading-theme-files) theme file with platform-specific colors for UI components, can be left unset when creating themes that only modify the wallpaper or accent colors. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $file_name File name + * @param string $mime_type MIME type, must be `application/x-tgtheme-{format}`, where `format` depends on the client + * @param array $thumb Thumbnail @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function uploadTheme(array $file, string $file_name, string $mime_type, array $thumb = []); + + /** + * Create a theme + * + * @param string $slug Unique theme ID used to generate [theme deep links](https://core.telegram.org/api/links#theme-links), can be empty to autogenerate a random ID. + * @param string $title Theme name + * @param array $document Theme file @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $settings Theme settings, multiple values can be provided for the different base themes (day/night mode, etc). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function createTheme(string $slug, string $title, array $document = [], array $settings = []); + + /** + * Update theme + * + * @param string $format Theme format, a string that identifies the theming engines supported by the client + * @param array $theme Theme to update @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $slug Unique theme ID + * @param string $title Theme name + * @param array $document Theme file @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $settings Theme settings @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function updateTheme(string $format, array $theme, string $slug = '', string $title = '', array $document = [], array $settings = []); + + /** + * Save a theme + * + * @param array $theme Theme to save @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $unsave Unsave + * + * + * @return array + */ + public function saveTheme(array $theme, bool $unsave); + + /** + * Install a theme + * + * @param array $dark Whether to install the dark version @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $theme Theme to install @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $format Theme format, a string that identifies the theming engines supported by the client + * @param array $base_theme Indicates a basic theme provided by all clients @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function installTheme(array $dark = [], array $theme = [], string $format = '', array $base_theme = []); + + /** + * Get theme information + * + * @param string $format Theme format, a string that identifies the theming engines supported by the client + * @param array $theme Theme @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getTheme(string $format, array $theme); + + /** + * Get installed themes + * + * @param string $format Theme format, a string that identifies the theming engines supported by the client + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getThemes(string $format, array $hash = []); + + /** + * Set sensitive content settings (for viewing or hiding NSFW content) + * + * @param array $sensitive_enabled Enable NSFW content @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setContentSettings(array $sensitive_enabled = []); + + /** + * Get sensitive content settings + * + * @return array + */ + public function getContentSettings(); + + /** + * Get info about multiple [wallpapers](https://core.telegram.org/api/wallpapers) + * + * @param array $wallpapers [Wallpapers](https://core.telegram.org/api/wallpapers) to fetch info about @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getMultiWallPapers(array $wallpapers); + + /** + * Get global privacy settings + * + * @return array + */ + public function getGlobalPrivacySettings(); + + /** + * Set global privacy settings + * + * @param array $settings Global privacy settings @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setGlobalPrivacySettings(array $settings); + + /** + * Report a profile photo of a dialog + * + * @param array $peer The dialog @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $photo_id Dialog photo ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $reason Report reason @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $message Comment for report moderation + * + * + * @return array + */ + public function reportProfilePhoto(array $peer, array $photo_id, array $reason, string $message); + + /** + * Initiate a 2FA password reset: can only be used if the user is already logged-in, [see here for more info »](https://core.telegram.org/api/srp#password-reset) + * + * @return array + */ + public function resetPassword(); + + /** + * Abort a pending 2FA password reset, [see here for more info »](https://core.telegram.org/api/srp#password-reset) + * + * @return array + */ + public function declinePasswordReset(); + + /** + * Get all available chat themes + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getChatThemes(array $hash = []); + + /** + * Set time-to-live of current session + * + * @param int $authorization_ttl_days Time-to-live of current session in days + * + * + * @return array + */ + public function setAuthorizationTTL(int $authorization_ttl_days); + + /** + * Change authorization settings + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $encrypted_requests_disabled Whether to enable or disable receiving encrypted chats: if the flag is not set, the previous setting is not changed + * @param bool $call_requests_disabled Whether to enable or disable receiving calls: if the flag is not set, the previous setting is not changed + * + * + * @return array + */ + public function changeAuthorizationSettings(array $hash = [], bool $encrypted_requests_disabled = false, bool $call_requests_disabled = false); + + /** + * Fetch saved notification sounds + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getSavedRingtones(array $hash = []); + + /** + * Save or remove saved notification sound. + * + * If the notification sound is already in MP3 format, [account.savedRingtone](https://docs.madelineproto.xyz/API_docs/constructors/account.savedRingtone.html) will be returned. + * Otherwise, it will be automatically converted and a [account.savedRingtoneConverted](https://docs.madelineproto.xyz/API_docs/constructors/account.savedRingtoneConverted.html) will be returned, containing a new [document](https://docs.madelineproto.xyz/API_docs/constructors/document.html) object that should be used to refer to the ringtone from now on (ie when deleting it using the `unsave` parameter, or when downloading it). + * + * @param array $id Notification sound uploaded using [account.uploadRingtone](https://docs.madelineproto.xyz/API_docs/methods/account.uploadRingtone.html) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $unsave Whether to add or delete the notification sound + * + * + * @return array + */ + public function saveRingtone(array $id, bool $unsave); + + /** + * Upload notification sound, use [account.saveRingtone](https://docs.madelineproto.xyz/API_docs/methods/account.saveRingtone.html) to convert it and add it to the list of saved notification sounds. + * + * @param array $file Notification sound @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $file_name File name + * @param string $mime_type MIME type of file + * + * + * @return array + */ + public function uploadRingtone(array $file, string $file_name, string $mime_type); + + /** + * + * + * @param array $emoji_status @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function updateEmojiStatus(array $emoji_status); + + /** + * + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getDefaultEmojiStatuses(array $hash = []); + + /** + * + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getRecentEmojiStatuses(array $hash = []); + + /** + * + * + * @return array + */ + public function clearRecentEmojiStatuses(); + + /** + * + * + * @param array $order @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function reorderUsernames(array $order); + + /** + * + * + * @param string $username + * @param bool $active + * + * + * @return array + */ + public function toggleUsername(string $username, bool $active); +} diff --git a/src/Namespace/Auth.php b/src/Namespace/Auth.php new file mode 100644 index 000000000..02a8a685b --- /dev/null +++ b/src/Namespace/Auth.php @@ -0,0 +1,133 @@ +Useful to check if a new public channel can indeed be created, even before asking the user to enter a channel username to use in [channels.checkUsername](https://docs.madelineproto.xyz/API_docs/methods/channels.checkUsername.html)/[channels.updateUsername](https://docs.madelineproto.xyz/API_docs/methods/channels.updateUsername.html). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getAdminedPublicChannels(array $by_location = [], array $check_limit = []); + + /** + * Ban/unban/kick a user in a [supergroup/channel](https://core.telegram.org/api/channel). + * + * @param array $channel The [supergroup/channel](https://core.telegram.org/api/channel). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $participant Participant to ban @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $banned_rights The banned rights @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function editBanned(array $channel, array $participant, array $banned_rights); + + /** + * Get the admin log of a [channel/supergroup](https://core.telegram.org/api/channel) + * + * @param array $channel Channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $q Search query, can be empty + * @param int $max_id Maximum ID of message to return (see [pagination](https://core.telegram.org/api/offsets)) + * @param int $min_id Minimum ID of message to return (see [pagination](https://core.telegram.org/api/offsets)) + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * @param array $events_filter Event filter @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $admins Only show events from these admins @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getAdminLog(array $channel, string $q, int $max_id, int $min_id, int $limit, array $events_filter = [], array $admins = []); + + /** + * Associate a stickerset to the supergroup + * + * @param array $channel Supergroup @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $stickerset The stickerset to associate @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setStickers(array $channel, array $stickerset); + + /** + * Mark [channel/supergroup](https://core.telegram.org/api/channel) message contents as read + * + * @param array $channel [Channel/supergroup](https://core.telegram.org/api/channel) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $id IDs of messages whose contents should be marked as read @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function readMessageContents(array $channel, array $id); + + /** + * Delete the history of a [supergroup](https://core.telegram.org/api/channel) + * + * @param array $channel [Supergroup](https://core.telegram.org/api/channel) whose history must be deleted @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $max_id ID of message **up to which** the history must be deleted + * @param array $for_everyone Whether the history should be deleted for everyone @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function deleteHistory(array $channel, int $max_id, array $for_everyone = []); + + /** + * Hide/unhide message history for new channel/supergroup users + * + * @param array $channel Channel/supergroup @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $enabled Hide/unhide + * + * + * @return array + */ + public function togglePreHistoryHidden(array $channel, bool $enabled); + + /** + * Get a list of [channels/supergroups](https://core.telegram.org/api/channel) we left + * + * @param int $offset Offset for [pagination](https://core.telegram.org/api/offsets) + * + * + * @return array + */ + public function getLeftChannels(int $offset); + + /** + * Get all groups that can be used as [discussion groups](https://core.telegram.org/api/discussion). + * + * Returned [basic group chats](https://core.telegram.org/api/channel#basic-groups) must be first upgraded to [supergroups](https://core.telegram.org/api/channel#supergroups) before they can be set as a discussion group. + * To set a returned supergroup as a discussion group, access to its old messages must be enabled using [channels.togglePreHistoryHidden](https://docs.madelineproto.xyz/API_docs/methods/channels.togglePreHistoryHidden.html), first. + * + * @return array + */ + public function getGroupsForDiscussion(); + + /** + * Associate a group to a channel as [discussion group](https://core.telegram.org/api/discussion) for that channel + * + * @param array $broadcast Channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $group [Discussion group](https://core.telegram.org/api/discussion) to associate to the channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setDiscussionGroup(array $broadcast, array $group); + + /** + * Transfer channel ownership + * + * @param array $channel Channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $user_id New channel owner @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $password [2FA password](https://core.telegram.org/api/srp) of account @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function editCreator(array $channel, array $user_id, array $password); + + /** + * Edit location of geogroup + * + * @param array $channel [Geogroup](https://core.telegram.org/api/channel) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $geo_point New geolocation @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $address Address string + * + * + * @return array + */ + public function editLocation(array $channel, array $geo_point, string $address); + + /** + * Toggle supergroup slow mode: if enabled, users will only be able to send one message every `seconds` seconds + * + * @param array $channel The [supergroup](https://core.telegram.org/api/channel) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $seconds Users will only be able to send one message every `seconds` seconds, `0` to disable the limitation + * + * + * @return array + */ + public function toggleSlowMode(array $channel, int $seconds); + + /** + * Get inactive channels and supergroups + * + * @return array + */ + public function getInactiveChannels(); + + /** + * Convert a [supergroup](https://core.telegram.org/api/channel) to a [gigagroup](https://core.telegram.org/api/channel), when requested by [channel suggestions](https://core.telegram.org/api/config#channel-suggestions). + * + * @param array $channel The [supergroup](https://core.telegram.org/api/channel) to convert @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function convertToGigagroup(array $channel); + + /** + * Mark a specific sponsored message as read + * + * @param array $channel Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function viewSponsoredMessage(array $channel); + + /** + * Get a list of sponsored messages + * + * @param array $channel Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getSponsoredMessages(array $channel); + + /** + * Obtains a list of peers that can be used to send messages in a specific group + * + * @param array $peer The group where we intend to send messages @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getSendAs(array $peer); + + /** + * Delete all messages sent by a specific participant of a given supergroup + * + * @param array $channel Supergroup @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $participant The participant whose messages should be deleted @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function deleteParticipantHistory(array $channel, array $participant); + + /** + * Set whether all users [should join a discussion group in order to comment on a post »](https://core.telegram.org/api/discussion#requiring-users-to-join-the-group) + * + * @param array $channel Discussion group @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $enabled Toggle + * + * + * @return array + */ + public function toggleJoinToSend(array $channel, bool $enabled); + + /** + * Set whether all users should [request admin approval to join the group »](https://core.telegram.org/api/invites#join-requests). + * + * @param array $channel Group @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $enabled Toggle + * + * + * @return array + */ + public function toggleJoinRequest(array $channel, bool $enabled); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $order @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function reorderUsernames(array $channel, array $order); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $username + * @param bool $active + * + * + * @return array + */ + public function toggleUsername(array $channel, string $username, bool $active); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function deactivateAllUsernames(array $channel); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $enabled + * + * + * @return array + */ + public function toggleForum(array $channel, bool $enabled); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $title + * @param int $icon_color + * @param int $icon_emoji_id + * @param array $send_as @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function createForumTopic(array $channel, string $title, int $icon_color = 0, int $icon_emoji_id = 0, array $send_as = []); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $offset_date + * @param int $offset_id + * @param int $offset_topic + * @param int $limit + * @param string $q + * + * + * @return array + */ + public function getForumTopics(array $channel, int $offset_date, int $offset_id, int $offset_topic, int $limit, string $q = ''); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $topics @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getForumTopicsByID(array $channel, array $topics); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $topic_id + * @param string $title + * @param int $icon_emoji_id + * @param bool $closed + * @param bool $hidden + * + * + * @return array + */ + public function editForumTopic(array $channel, int $topic_id, string $title = '', int $icon_emoji_id = 0, bool $closed = false, bool $hidden = false); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $topic_id + * @param bool $pinned + * + * + * @return array + */ + public function updatePinnedForumTopic(array $channel, int $topic_id, bool $pinned); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $top_msg_id + * + * + * @return array + */ + public function deleteTopicHistory(array $channel, int $top_msg_id); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $order @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $force @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function reorderPinnedForumTopics(array $channel, array $order, array $force = []); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $enabled + * + * + * @return array + */ + public function toggleAntiSpam(array $channel, bool $enabled); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id + * + * + * @return array + */ + public function reportAntiSpamFalsePositive(array $channel, int $msg_id); + + /** + * + * + * @param array $channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $enabled + * + * + * @return array + */ + public function toggleParticipantsHidden(array $channel, bool $enabled); +} diff --git a/src/Namespace/Contacts.php b/src/Namespace/Contacts.php new file mode 100644 index 000000000..165b2ebc9 --- /dev/null +++ b/src/Namespace/Contacts.php @@ -0,0 +1,245 @@ +Do this only if the new location is more than 1 KM away from the previous one, or if the previous location is unknown. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $self_expires If set, the geolocation of the current user will be public for the specified number of seconds; pass 0x7fffffff to disable expiry, 0 to make the current geolocation private; if the flag isn't set, no changes will be applied. + * + * + * @return array + */ + public function getLocated(array $geo_point, array $background = [], int $self_expires = 0); + + /** + * Stop getting notifications about [thread replies](https://core.telegram.org/api/threads) of a certain user in `@replies` + * + * @param int $msg_id ID of the message in the [@replies](https://core.telegram.org/api/threads#replies) chat + * @param array $delete_message Whether to delete the specified message as well @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $delete_history Whether to delete all `@replies` messages from this user as well @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $report_spam Whether to also report this user for spam @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function blockFromReplies(int $msg_id, array $delete_message = [], array $delete_history = [], array $report_spam = []); + + /** + * Resolve a phone number to get user info, if their privacy settings allow it. + * + * @param string $phone Phone number in international format, possibly obtained from a [phone number deep link](https://core.telegram.org/api/links#phone-number-links). + * + * + * @return array + */ + public function resolvePhone(string $phone); + + /** + * + * + * @return array + */ + public function exportContactToken(); + + /** + * + * + * @param string $token + * + * + * @return array + */ + public function importContactToken(string $token); +} diff --git a/src/Namespace/Folders.php b/src/Namespace/Folders.php new file mode 100644 index 000000000..dfb82cc07 --- /dev/null +++ b/src/Namespace/Folders.php @@ -0,0 +1,31 @@ +**Possible values**:
[(boolTrue)](https://docs.madelineproto.xyz/API_docs/constructors/boolTrue.html), if the user started typing and more than **5 seconds** have passed since the last request
[(boolFalse)](https://docs.madelineproto.xyz/API_docs/constructors/boolFalse.html), if the user stopped typing + * + * + * @return array + */ + public function setEncryptedTyping(array $peer, bool $typing); + + /** + * Marks message history within a secret chat as read. + * + * @param array $peer Secret chat ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $max_date Maximum date value for received messages in history + * + * + * @return array + */ + public function readEncryptedHistory(array $peer, int $max_date); + + /** + * Sends a text message to a secret chat. + * + * @param array $peer Secret chat ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $message @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $silent Send encrypted message without a notification @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendEncrypted(array $peer, array $message, array $silent = []); + + /** + * Sends a message with a file attachment to a secret chat + * + * @param array $peer Secret chat ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $message @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $file File attachment for the secret chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $silent Whether to send the file without triggering a notification @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendEncryptedFile(array $peer, array $message, array $file, array $silent = []); + + /** + * Sends a service message to a secret chat. + * + * @param array $peer Secret chat ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $message @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendEncryptedService(array $peer, array $message); + + /** + * Report a secret chat for spam + * + * @param array $peer The secret chat to report @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function reportEncryptedSpam(array $peer); + + /** + * Notifies the sender about the recipient having listened a voice message or watched a video. + * + * @param array $id Message ID list @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function readMessageContents(array $id); + + /** + * Get stickers by emoji + * + * @param string $emoticon The emoji + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getStickers(string $emoticon, array $hash = []); + + /** + * Get all installed stickers + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getAllStickers(array $hash = []); + + /** + * Get preview of webpage + * + * @param string $message Message from which to extract the preview + * @param array $entities [Message entities for styled text](https://core.telegram.org/api/entities) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getWebPagePreview(string $message, array $entities = []); + + /** + * Export an invite link for a chat + * + * @param array $peer Chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $legacy_revoke_permanent Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $request_needed Whether admin confirmation is required before admitting each separate user into the chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $expire_date Expiration date + * @param int $usage_limit Maximum number of users that can join using this link + * @param string $title Description of the invite link, visible only to administrators + * + * + * @return array + */ + public function exportChatInvite(array $peer, array $legacy_revoke_permanent = [], array $request_needed = [], int $expire_date = 0, int $usage_limit = 0, string $title = ''); + + /** + * Check the validity of a chat invite link and get basic info about it + * + * @param string $hash Invite hash from [chat invite deep link »](https://core.telegram.org/api/links#chat-invite-links). + * + * + * @return array + */ + public function checkChatInvite(string $hash); + + /** + * Import a chat invite and join a private chat/supergroup/channel + * + * @param string $hash `hash` from a [chat invite deep link](https://core.telegram.org/api/links#chat-invite-links) + * + * + * @return array + */ + public function importChatInvite(string $hash); + + /** + * Get info about a stickerset + * + * @param array $stickerset Stickerset @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $hash + * + * + * @return array + */ + public function getStickerSet(array $stickerset, int $hash); + + /** + * Install a stickerset + * + * @param array $stickerset Stickerset to install @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $archived Whether to archive stickerset + * + * + * @return array + */ + public function installStickerSet(array $stickerset, bool $archived); + + /** + * Uninstall a stickerset + * + * @param array $stickerset The stickerset to uninstall @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function uninstallStickerSet(array $stickerset); + + /** + * Start a conversation with a bot using a [deep linking parameter](https://core.telegram.org/api/links#bot-links) + * + * @param array $bot The bot @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $peer The chat where to start the bot, can be the bot's private chat or a group @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $start_param [Deep linking parameter](https://core.telegram.org/api/links#bot-links) + * + * + * @return array + */ + public function startBot(array $bot, array $peer, string $start_param); + + /** + * Get and increase the view counter of a message sent or forwarded from a [channel](https://core.telegram.org/api/channel) + * + * @param array $peer Peer where the message was found @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $id ID of message @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $increment Whether to mark the message as viewed and increment the view counter + * + * + * @return array + */ + public function getMessagesViews(array $peer, array $id, bool $increment); + + /** + * Make a user admin in a [basic group](https://core.telegram.org/api/channel#basic-groups). + * + * @param array $chat_id @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $user_id The user to make admin @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $is_admin Whether to make them admin + * + * + * @return array + */ + public function editChatAdmin(array $chat_id, array $user_id, bool $is_admin); + + /** + * Turn a [basic group into a supergroup](https://core.telegram.org/api/channel#migration) + * + * @param array $chat_id @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function migrateChat(array $chat_id); + + /** + * Search for messages and peers globally + * + * @param string $q Query + * @param array $filter Global search filter @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $min_date If a positive value was specified, the method will return only messages with date bigger than min\_date + * @param int $max_date If a positive value was transferred, the method will return only messages with date smaller than max\_date + * @param int $offset_rate Initially 0, then set to the [`next_rate` parameter of messages.messagesSlice](https://docs.madelineproto.xyz/API_docs/constructors/messages.messagesSlice.html) + * @param array $offset_peer [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $offset_id [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $limit [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $folder_id [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders) + * + * + * @return array + */ + public function searchGlobal(string $q, array $filter, int $min_date, int $max_date, int $offset_rate, array $offset_peer, int $offset_id, int $limit, int $folder_id = 0); + + /** + * Reorder installed stickersets + * + * @param array $order New stickerset order by stickerset IDs @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $masks Reorder mask stickersets @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $emojis Reorder [custom emoji stickersets](https://core.telegram.org/api/custom-emoji) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function reorderStickerSets(array $order, array $masks = [], array $emojis = []); + + /** + * Get a document by its SHA256 hash, mainly used for gifs + * + * @param string $sha256 SHA256 of file + * @param int $size Size of the file in bytes + * @param string $mime_type Mime type + * + * + * @return array + */ + public function getDocumentByHash(string $sha256, int $size, string $mime_type); + + /** + * Get saved GIFs + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getSavedGifs(array $hash = []); + + /** + * Add GIF to saved gifs list + * + * @param array $id GIF to save @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $unsave Whether to remove GIF from saved gifs list + * + * + * @return array + */ + public function saveGif(array $id, bool $unsave); + + /** + * Query an inline bot + * + * @param array $bot The bot to query @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $peer The currently opened chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $query The query + * @param string $offset The offset within the results, will be passed directly as-is to the bot. + * @param array $geo_point The geolocation, if requested @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getInlineBotResults(array $bot, array $peer, string $query, string $offset, array $geo_point = []); + + /** + * Answer an inline query, for bots only + * + * @param int $query_id Unique identifier for the answered query + * @param array $results Vector of results for the inline query @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $cache_time The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. + * @param array $gallery Set this flag if the results are composed of media files @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $private Set this flag if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $next_offset Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. + * @param array $switch_pm If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setInlineBotResults(int $query_id, array $results, int $cache_time, array $gallery = [], array $private = [], string $next_offset = '', array $switch_pm = []); + + /** + * Send a result obtained using [messages.getInlineBotResults](https://docs.madelineproto.xyz/API_docs/methods/messages.getInlineBotResults.html). + * + * @param array $peer Destination @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $query_id Query ID from [messages.getInlineBotResults](https://docs.madelineproto.xyz/API_docs/methods/messages.getInlineBotResults.html) + * @param string $id Result ID from [messages.getInlineBotResults](https://docs.madelineproto.xyz/API_docs/methods/messages.getInlineBotResults.html) + * @param array $silent Whether to send the message silently (no notification will be triggered on the other client) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $background Whether to send the message in background @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $clear_draft Whether to clear the [draft](https://core.telegram.org/api/drafts) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $hide_via Whether to hide the `via @botname` in the resulting message (only for bot usernames encountered in the [config](https://docs.madelineproto.xyz/API_docs/constructors/config.html)) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $reply_to_msg_id ID of the message this message should reply to + * @param int $top_msg_id + * @param int $schedule_date Scheduled message date for scheduled messages + * @param array $send_as Send this message as the specified peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendInlineBotResult(array $peer, int $query_id, string $id, array $silent = [], array $background = [], array $clear_draft = [], array $hide_via = [], int $reply_to_msg_id = 0, int $top_msg_id = 0, int $schedule_date = 0, array $send_as = []); + + /** + * Find out if a media message's caption can be edited + * + * @param array $peer Peer where the media was sent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $id ID of message + * + * + * @return array + */ + public function getMessageEditData(array $peer, int $id); + + /** + * Edit message + * + * @param array $peer Where was the message sent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $id ID of the message to edit + * @param array $no_webpage Disable webpage preview @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $message New message + * @param array $media New attached media @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $reply_markup Reply markup for inline keyboards @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $entities [Message entities for styled text](https://core.telegram.org/api/entities) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $schedule_date Scheduled message date for [scheduled messages](https://core.telegram.org/api/scheduled-messages) + * + * + * @return array + */ + public function editMessage(array $peer, int $id, array $no_webpage = [], string $message = '', array $media = [], array $reply_markup = [], array $entities = [], int $schedule_date = 0); + + /** + * Edit an inline bot message + * + * @param array $id Sent inline message ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $no_webpage Disable webpage preview @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $message Message + * @param array $media Media @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $reply_markup Reply markup for inline keyboards @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $entities [Message entities for styled text](https://core.telegram.org/api/entities) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function editInlineBotMessage(array $id, array $no_webpage = [], string $message = '', array $media = [], array $reply_markup = [], array $entities = []); + + /** + * Press an inline callback button and get a callback answer from the bot + * + * @param array $peer Where was the inline keyboard sent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id ID of the Message with the inline keyboard + * @param array $game Whether this is a "play game" button @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $data Callback data + * @param array $password For buttons [requiring you to verify your identity with your 2FA password](https://docs.madelineproto.xyz/API_docs/constructors/keyboardButtonCallback.html), the SRP payload generated using [SRP](https://core.telegram.org/api/srp). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getBotCallbackAnswer(array $peer, int $msg_id, array $game = [], string $data = '', array $password = []); + + /** + * Set the callback answer to a user button press (bots only) + * + * @param int $query_id Query ID + * @param int $cache_time Cache validity + * @param array $alert Whether to show the message as a popup instead of a toast notification @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $message Popup to show + * @param string $url URL to open + * + * + * @return array + */ + public function setBotCallbackAnswer(int $query_id, int $cache_time, array $alert = [], string $message = '', string $url = ''); + + /** + * Get dialog info of specified peers + * + * @param array $peers Peers @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getPeerDialogs(array $peers); + + /** + * Save a message [draft](https://core.telegram.org/api/drafts) associated to a chat. + * + * @param array $peer Destination of the message that should be sent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $message The draft + * @param array $no_webpage Disable generation of the webpage preview @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $reply_to_msg_id Message ID the message should reply to + * @param int $top_msg_id + * @param array $entities Message [entities](https://core.telegram.org/api/entities) for styled text @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function saveDraft(array $peer, string $message, array $no_webpage = [], int $reply_to_msg_id = 0, int $top_msg_id = 0, array $entities = []); + + /** + * Return all message [drafts](https://core.telegram.org/api/drafts). + * Returns all the latest [updateDraftMessage](https://docs.madelineproto.xyz/API_docs/constructors/updateDraftMessage.html) updates related to all chats with drafts. + * + * @return array + */ + public function getAllDrafts(); + + /** + * Get featured stickers + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getFeaturedStickers(array $hash = []); + + /** + * Mark new featured stickers as read + * + * @param array $id IDs of stickersets to mark as read @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function readFeaturedStickers(array $id); + + /** + * Get recent stickers + * + * @param array $attached Get stickers recently attached to photo or video files @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getRecentStickers(array $attached = [], array $hash = []); + + /** + * Add/remove sticker from recent stickers list + * + * @param array $id Sticker @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $unsave Whether to save or unsave the sticker + * @param array $attached Whether to add/remove stickers recently attached to photo or video files @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function saveRecentSticker(array $id, bool $unsave, array $attached = []); + + /** + * Clear recent stickers + * + * @param array $attached Set this flag to clear the list of stickers recently attached to photo or video files @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function clearRecentStickers(array $attached = []); + + /** + * Get all archived stickers + * + * @param int $offset_id [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * @param array $masks Get [mask stickers](https://core.telegram.org/api/stickers#mask-stickers) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $emojis Get [custom emoji stickers](https://core.telegram.org/api/custom-emoji) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getArchivedStickers(int $offset_id, int $limit, array $masks = [], array $emojis = []); + + /** + * Get installed mask stickers + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getMaskStickers(array $hash = []); + + /** + * Get stickers attached to a photo or video + * + * @param array $media Stickered media @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getAttachedStickers(array $media); + + /** + * Use this method to set the score of the specified user in a game sent as a normal message (bots only). + * + * @param array $peer Unique identifier of target chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $id Identifier of the sent message + * @param array $user_id User identifier @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $score New score + * @param array $edit_message Set this flag if the game message should be automatically edited to include the current scoreboard @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $force Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setGameScore(array $peer, int $id, array $user_id, int $score, array $edit_message = [], array $force = []); + + /** + * Use this method to set the score of the specified user in a game sent as an inline message (bots only). + * + * @param array $id ID of the inline message @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $user_id User identifier @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $score New score + * @param array $edit_message Set this flag if the game message should be automatically edited to include the current scoreboard @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $force Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setInlineGameScore(array $id, array $user_id, int $score, array $edit_message = [], array $force = []); + + /** + * Get highscores of a game + * + * @param array $peer Where was the game sent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $id ID of message with game media attachment + * @param array $user_id Get high scores made by a certain user @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getGameHighScores(array $peer, int $id, array $user_id); + + /** + * Get highscores of a game sent using an inline bot + * + * @param array $id ID of inline message @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $user_id Get high scores of a certain user @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getInlineGameHighScores(array $id, array $user_id); + + /** + * Get chats in common with a user + * + * @param array $user_id User ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $max_id Maximum ID of chat to return (see [pagination](https://core.telegram.org/api/offsets)) + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * + * + * @return array + */ + public function getCommonChats(array $user_id, int $max_id, int $limit); + + /** + * Get all chats, channels and supergroups + * + * @param array $except_ids Except these chats/channels/supergroups @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getAllChats(array $except_ids); + + /** + * Get [instant view](https://instantview.telegram.org) page + * + * @param string $url URL of IV page to fetch + * @param int $hash + * + * + * @return array + */ + public function getWebPage(string $url, int $hash); + + /** + * Pin/unpin a dialog + * + * @param array $peer The dialog to pin @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $pinned Whether to pin or unpin the dialog @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function toggleDialogPin(array $peer, array $pinned = []); + + /** + * Reorder pinned dialogs + * + * @param int $folder_id [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders) + * @param array $order New dialog order @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $force If set, dialogs pinned server-side but not present in the `order` field will be unpinned. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function reorderPinnedDialogs(int $folder_id, array $order, array $force = []); + + /** + * Get pinned dialogs + * + * @param int $folder_id [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders) + * + * + * @return array + */ + public function getPinnedDialogs(int $folder_id); + + /** + * If you sent an invoice requesting a shipping address and the parameter is\_flexible was specified, the bot will receive an [updateBotShippingQuery](https://docs.madelineproto.xyz/API_docs/constructors/updateBotShippingQuery.html) update. Use this method to reply to shipping queries. + * + * @param int $query_id Unique identifier for the query to be answered + * @param string $error Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable"). Telegram will display this message to the user. + * @param array $shipping_options A vector of available shipping options. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setBotShippingResults(int $query_id, string $error = '', array $shipping_options = []); + + /** + * Once the user has confirmed their payment and shipping details, the bot receives an [updateBotPrecheckoutQuery](https://docs.madelineproto.xyz/API_docs/constructors/updateBotPrecheckoutQuery.html) update. + * Use this method to respond to such pre-checkout queries. + * **Note**: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. + * + * @param int $query_id Unique identifier for the query to be answered + * @param array $success Set this flag if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order, otherwise do not set it, and set the `error` field, instead @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $error Required if the `success` isn't set. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. + * + * + * @return array + */ + public function setBotPrecheckoutResults(int $query_id, array $success = [], string $error = ''); + + /** + * Upload a file and associate it to a chat (without actually sending it to the chat) + * + * @param array $peer The chat, can be [inputPeerEmpty](https://docs.madelineproto.xyz/API_docs/constructors/inputPeerEmpty.html) for bots and [inputPeerSelf](https://docs.madelineproto.xyz/API_docs/constructors/inputPeerSelf.html) for users. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $media File uploaded in chunks as described in [files »](https://core.telegram.org/api/files) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function uploadMedia(array $peer, array $media); + + /** + * Notify the other user in a private chat that a screenshot of the chat was taken + * + * @param array $peer Other user @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $reply_to_msg_id ID of message that was screenshotted, can be 0 + * + * + * @return array + */ + public function sendScreenshotNotification(array $peer, int $reply_to_msg_id); + + /** + * Get faved stickers + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getFavedStickers(array $hash = []); + + /** + * Mark or unmark a sticker as favorite + * + * @param array $id Sticker in question @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $unfave Whether to add or remove a sticker from favorites + * + * + * @return array + */ + public function faveSticker(array $id, bool $unfave); + + /** + * Get unread messages where we were mentioned + * + * @param array $peer Peer where to look for mentions @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $offset_id [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $add_offset [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * @param int $max_id Maximum message ID to return, [see pagination](https://core.telegram.org/api/offsets) + * @param int $min_id Minimum message ID to return, [see pagination](https://core.telegram.org/api/offsets) + * @param int $top_msg_id + * + * + * @return array + */ + public function getUnreadMentions(array $peer, int $offset_id, int $add_offset, int $limit, int $max_id, int $min_id, int $top_msg_id = 0); + + /** + * Mark mentions as read + * + * @param array $peer Dialog @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $top_msg_id + * + * + * @return array + */ + public function readMentions(array $peer, int $top_msg_id = 0); + + /** + * Get live location history of a certain user + * + * @param array $peer User @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getRecentLocations(array $peer, int $limit, array $hash = []); + + /** + * Send an [album or grouped media](https://core.telegram.org/api/files#albums-grouped-media) + * + * @param array $peer The destination chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $multi_media The medias to send @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $silent Whether to send the album silently (no notification triggered) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $background Send in background? @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $clear_draft Whether to clear [drafts](https://core.telegram.org/api/drafts) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $noforwards Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have [content protection](https://telegram.org/blog/protected-content-delete-by-date-and-more) enabled @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $update_stickersets_order @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $reply_to_msg_id The message to reply to + * @param int $top_msg_id + * @param int $schedule_date Scheduled message date for scheduled messages + * @param array $send_as Send this message as the specified peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendMultiMedia(array $peer, array $multi_media, array $silent = [], array $background = [], array $clear_draft = [], array $noforwards = [], array $update_stickersets_order = [], int $reply_to_msg_id = 0, int $top_msg_id = 0, int $schedule_date = 0, array $send_as = []); + + /** + * Upload encrypted file and associate it to a secret chat + * + * @param array $peer The secret chat to associate the file to @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $file The file @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function uploadEncryptedFile(array $peer, array $file); + + /** + * Search for stickersets + * + * @param string $q Query string + * @param array $exclude_featured Exclude featured stickersets from results @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function searchStickerSets(string $q, array $exclude_featured = [], array $hash = []); + + /** + * Get message ranges for saving the user's chat history + * + * @return array + */ + public function getSplitRanges(); + + /** + * Manually mark dialog as unread + * + * @param array $peer Dialog @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $unread Mark as unread/read @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function markDialogUnread(array $peer, array $unread = []); + + /** + * Get dialogs manually marked as unread + * + * @return array + */ + public function getDialogUnreadMarks(); + + /** + * Clear all [drafts](https://core.telegram.org/api/drafts). + * + * @return array + */ + public function clearAllDrafts(); + + /** + * Pin a message + * + * @param array $peer The peer where to pin the message @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $id The message to pin or unpin + * @param array $silent Pin the message silently, without triggering a notification @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $unpin Whether the message should unpinned or pinned @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $pm_oneside Whether the message should only be pinned on the local side of a one-to-one chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function updatePinnedMessage(array $peer, int $id, array $silent = [], array $unpin = [], array $pm_oneside = []); + + /** + * Vote in a [poll](https://docs.madelineproto.xyz/API_docs/constructors/poll.html) + * + * @param array $peer The chat where the poll was sent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id The message ID of the poll + * @param array $options The options that were chosen @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendVote(array $peer, int $msg_id, array $options); + + /** + * Get poll results + * + * @param array $peer Peer where the poll was found @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id Message ID of poll message + * + * + * @return array + */ + public function getPollResults(array $peer, int $msg_id); + + /** + * Get count of online users in a chat + * + * @param array $peer The chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getOnlines(array $peer); + + /** + * Edit the description of a [group/supergroup/channel](https://core.telegram.org/api/channel). + * + * @param array $peer The [group/supergroup/channel](https://core.telegram.org/api/channel). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $about The new description + * + * + * @return array + */ + public function editChatAbout(array $peer, string $about); + + /** + * Edit the default banned rights of a [channel/supergroup/group](https://core.telegram.org/api/channel). + * + * @param array $peer The peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $banned_rights The new global rights @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function editChatDefaultBannedRights(array $peer, array $banned_rights); + + /** + * Get localized emoji keywords + * + * @param string $lang_code Language code + * + * + * @return array + */ + public function getEmojiKeywords(string $lang_code); + + /** + * Get changed emoji keywords + * + * @param string $lang_code Language code + * @param int $from_version Previous emoji keyword localization version + * + * + * @return array + */ + public function getEmojiKeywordsDifference(string $lang_code, int $from_version); + + /** + * Get info about an emoji keyword localization + * + * @param array $lang_codes Language codes @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getEmojiKeywordsLanguages(array $lang_codes); + + /** + * Returns an HTTP URL which can be used to automatically log in into translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation + * + * @param string $lang_code Language code for which the emoji replacements will be suggested + * + * + * @return array + */ + public function getEmojiURL(string $lang_code); + + /** + * Get the number of results that would be found by a [messages.search](https://docs.madelineproto.xyz/API_docs/methods/messages.search.html) call with the same parameters + * + * @param array $peer Peer where to search @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $filters Search filters @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $top_msg_id + * + * + * @return array + */ + public function getSearchCounters(array $peer, array $filters, int $top_msg_id = 0); + + /** + * Get more info about a Seamless Telegram Login authorization request, for more info [click here »](https://core.telegram.org/api/url-authorization) + * + * @param array $peer Peer where the message is located @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id The message + * @param int $button_id The ID of the button with the authorization request + * @param string $url URL used for [link URL authorization, click here for more info »](https://core.telegram.org/api/url-authorization#link-url-authorization) + * + * + * @return array + */ + public function requestUrlAuth(array $peer = [], int $msg_id = 0, int $button_id = 0, string $url = ''); + + /** + * Use this to accept a Seamless Telegram Login authorization request, for more info [click here »](https://core.telegram.org/api/url-authorization) + * + * @param array $write_allowed Set this flag to allow the bot to send messages to you (if requested) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $peer The location of the message @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id Message ID of the message with the login button + * @param int $button_id ID of the login button + * @param string $url URL used for [link URL authorization, click here for more info »](https://core.telegram.org/api/url-authorization#link-url-authorization) + * + * + * @return array + */ + public function acceptUrlAuth(array $write_allowed = [], array $peer = [], int $msg_id = 0, int $button_id = 0, string $url = ''); + + /** + * Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the [peer's settings](https://docs.madelineproto.xyz/API_docs/constructors/peerSettings.html). + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function hidePeerSettingsBar(array $peer); + + /** + * Get scheduled messages + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getScheduledHistory(array $peer, array $hash = []); + + /** + * Get scheduled messages + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $id IDs of scheduled messages @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getScheduledMessages(array $peer, array $id); + + /** + * Send scheduled messages right away + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $id Scheduled message IDs @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendScheduledMessages(array $peer, array $id); + + /** + * Delete scheduled messages + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $id Scheduled message IDs @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function deleteScheduledMessages(array $peer, array $id); + + /** + * Get poll results for non-anonymous polls + * + * @param array $peer Chat where the poll was sent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $id Message ID + * @param int $limit Number of results to return + * @param string $option Get only results for the specified poll `option` + * @param string $offset Offset for results, taken from the `next_offset` field of [messages.votesList](https://docs.madelineproto.xyz/API_docs/constructors/messages.votesList.html), initially an empty string.
Note: if no more results are available, the method call will return an empty `next_offset`; thus, avoid providing the `next_offset` returned in [messages.votesList](https://docs.madelineproto.xyz/API_docs/constructors/messages.votesList.html) if it is empty, to avoid an infinite loop. + * + * + * @return array + */ + public function getPollVotes(array $peer, int $id, int $limit, string $option = '', string $offset = ''); + + /** + * Apply changes to multiple stickersets + * + * @param array $stickersets Stickersets to act upon @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $uninstall Uninstall the specified stickersets @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $archive Archive the specified stickersets @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $unarchive Unarchive the specified stickersets @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function toggleStickerSets(array $stickersets, array $uninstall = [], array $archive = [], array $unarchive = []); + + /** + * Get [folders](https://core.telegram.org/api/folders) + * + * @return array + */ + public function getDialogFilters(); + + /** + * Get [suggested folders](https://core.telegram.org/api/folders) + * + * @return array + */ + public function getSuggestedDialogFilters(); + + /** + * Update [folder](https://core.telegram.org/api/folders) + * + * @param int $id [Folder](https://core.telegram.org/api/folders) ID + * @param array $filter [Folder](https://core.telegram.org/api/folders) info @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function updateDialogFilter(int $id, array $filter = []); + + /** + * Reorder [folders](https://core.telegram.org/api/folders) + * + * @param array $order New [folder](https://core.telegram.org/api/folders) order @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function updateDialogFiltersOrder(array $order); + + /** + * Method for fetching previously featured stickers + * + * @param int $offset Offset + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getOldFeaturedStickers(int $offset, int $limit, array $hash = []); + + /** + * Get messages in a reply thread + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id Message ID + * @param int $offset_id [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $offset_date [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $add_offset [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * @param int $max_id If a positive value was transferred, the method will return only messages with ID smaller than max\_id + * @param int $min_id If a positive value was transferred, the method will return only messages with ID bigger than min\_id + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getReplies(array $peer, int $msg_id, int $offset_id, int $offset_date, int $add_offset, int $limit, int $max_id, int $min_id, array $hash = []); + + /** + * Get [discussion message](https://core.telegram.org/api/threads) from the [associated discussion group](https://core.telegram.org/api/discussion) of a channel to show it on top of the comment section, without actually joining the group + * + * @param array $peer [Channel ID](https://core.telegram.org/api/channel) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id Message ID + * + * + * @return array + */ + public function getDiscussionMessage(array $peer, int $msg_id); + + /** + * Mark a [thread](https://core.telegram.org/api/threads) as read + * + * @param array $peer Group ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id ID of message that started the thread + * @param int $read_max_id ID up to which thread messages were read + * + * + * @return array + */ + public function readDiscussion(array $peer, int $msg_id, int $read_max_id); + + /** + * [Unpin](https://core.telegram.org/api/pin) all pinned messages + * + * @param array $peer Chat where to unpin @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $top_msg_id + * + * + * @return array + */ + public function unpinAllMessages(array $peer, int $top_msg_id = 0); + + /** + * Delete a [chat](https://core.telegram.org/api/channel) + * + * @param array $chat_id @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function deleteChat(array $chat_id); + + /** + * Delete the entire phone call history. + * + * @param array $revoke Whether to remove phone call history for participants as well @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function deletePhoneCallHistory(array $revoke = []); + + /** + * Obtains information about a chat export file, generated by a foreign chat app, [click here for more info about imported chats »](https://core.telegram.org/api/import). + * + * @param string $import_head Beginning of the message file; up to 100 lines. + * + * + * @return array + */ + public function checkHistoryImport(string $import_head); + + /** + * Import chat history from a foreign chat app into a specific Telegram chat, [click here for more info about imported chats »](https://core.telegram.org/api/import). + * + * @param array $peer The Telegram chat where the [history should be imported](https://core.telegram.org/api/import). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $file File with messages to import. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $media_count Number of media files associated with the chat that will be uploaded using [messages.uploadImportedMedia](https://docs.madelineproto.xyz/API_docs/methods/messages.uploadImportedMedia.html). + * + * + * @return array + */ + public function initHistoryImport(array $peer, array $file, int $media_count); + + /** + * Upload a media file associated with an [imported chat, click here for more info »](https://core.telegram.org/api/import). + * + * @param array $peer The Telegram chat where the media will be imported @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $import_id Identifier of a [history import session](https://core.telegram.org/api/import), returned by [messages.initHistoryImport](https://docs.madelineproto.xyz/API_docs/methods/messages.initHistoryImport.html) + * @param string $file_name File name + * @param array $media Media metadata @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function uploadImportedMedia(array $peer, int $import_id, string $file_name, array $media); + + /** + * Complete the [history import process](https://core.telegram.org/api/import), importing all messages into the chat. + * To be called only after initializing the import with [messages.initHistoryImport](https://docs.madelineproto.xyz/API_docs/methods/messages.initHistoryImport.html) and uploading all files using [messages.uploadImportedMedia](https://docs.madelineproto.xyz/API_docs/methods/messages.uploadImportedMedia.html). + * + * @param array $peer The Telegram chat where the messages should be [imported, click here for more info »](https://core.telegram.org/api/import) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $import_id Identifier of a history import session, returned by [messages.initHistoryImport](https://docs.madelineproto.xyz/API_docs/methods/messages.initHistoryImport.html). + * + * + * @return array + */ + public function startHistoryImport(array $peer, int $import_id); + + /** + * Get info about the chat invites of a specific chat + * + * @param array $peer Chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $admin_id Whether to only fetch chat invites from this admin @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * @param array $revoked Whether to fetch revoked chat invites @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $offset_date [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param string $offset_link [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * + * + * @return array + */ + public function getExportedChatInvites(array $peer, array $admin_id, int $limit, array $revoked = [], int $offset_date = 0, string $offset_link = ''); + + /** + * Get info about a chat invite + * + * @param array $peer Chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $link Invite link + * + * + * @return array + */ + public function getExportedChatInvite(array $peer, string $link); + + /** + * Edit an exported chat invite + * + * @param array $peer Chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $link Invite link + * @param array $revoked Whether to revoke the chat invite @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $expire_date New expiration date + * @param int $usage_limit Maximum number of users that can join using this link + * @param bool $request_needed Whether admin confirmation is required before admitting each separate user into the chat + * @param string $title Description of the invite link, visible only to administrators + * + * + * @return array + */ + public function editExportedChatInvite(array $peer, string $link, array $revoked = [], int $expire_date = 0, int $usage_limit = 0, bool $request_needed = false, string $title = ''); + + /** + * Delete all revoked chat invites + * + * @param array $peer Chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $admin_id ID of the admin that originally generated the revoked chat invites @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function deleteRevokedExportedChatInvites(array $peer, array $admin_id); + + /** + * Delete a chat invite + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $link Invite link + * + * + * @return array + */ + public function deleteExportedChatInvite(array $peer, string $link); + + /** + * Get info about chat invites generated by admins. + * + * @param array $peer Chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getAdminsWithInvites(array $peer); + + /** + * Get info about the users that joined the chat using a specific chat invite + * + * @param array $peer Chat @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $offset_date [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param array $offset_user User ID for [pagination](https://core.telegram.org/api/offsets) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * @param array $requested If set, only returns info about users with pending [join requests »](https://core.telegram.org/api/invites#join-requests) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $link Invite link + * @param string $q Search for a user in the pending [join requests »](https://core.telegram.org/api/invites#join-requests) list: only available when the `requested` flag is set, cannot be used together with a specific `link`. + * + * + * @return array + */ + public function getChatInviteImporters(array $peer, int $offset_date, array $offset_user, int $limit, array $requested = [], string $link = '', string $q = ''); + + /** + * Set maximum Time-To-Live of all messages in the specified chat + * + * @param array $peer The dialog @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $period Automatically delete all messages sent in the chat after this many seconds + * + * + * @return array + */ + public function setHistoryTTL(array $peer, int $period); + + /** + * Check whether chat history exported from another chat app can be [imported into a specific Telegram chat, click here for more info »](https://core.telegram.org/api/import). + * + * If the check succeeds, and no RPC errors are returned, a [messages.CheckedHistoryImportPeer](https://docs.madelineproto.xyz/API_docs/types/messages.CheckedHistoryImportPeer.html) constructor will be returned, with a confirmation text to be shown to the user, before actually initializing the import. + * + * @param array $peer The chat where we want to [import history »](https://core.telegram.org/api/import). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function checkHistoryImportPeer(array $peer); + + /** + * Change the chat theme of a certain chat + * + * @param array $peer Private chat where to change theme @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $emoticon Emoji, identifying a specific chat theme; a list of chat themes can be fetched using [account.getChatThemes](https://docs.madelineproto.xyz/API_docs/methods/account.getChatThemes.html) + * + * + * @return array + */ + public function setChatTheme(array $peer, string $emoticon); + + /** + * Get which users read a specific message: only available for groups and supergroups with less than [`chat_read_mark_size_threshold` members](https://core.telegram.org/api/config#chat-read-mark-size-threshold), read receipts will be stored for [`chat_read_mark_expire_period` seconds after the message was sent](https://core.telegram.org/api/config#chat-read-mark-expire-period), see [client configuration for more info »](https://core.telegram.org/api/config#client-configuration). + * + * @param array $peer Dialog @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id Message ID + * + * + * @return array + */ + public function getMessageReadParticipants(array $peer, int $msg_id); + + /** + * Returns information about the next messages of the specified type in the chat split by days. + * + * Returns the results in reverse chronological order. + * Can return partial results for the last returned day. + * + * @param array $peer Peer where to search @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $filter Message filter, [inputMessagesFilterEmpty](https://docs.madelineproto.xyz/API_docs/constructors/inputMessagesFilterEmpty.html), [inputMessagesFilterMyMentions](https://docs.madelineproto.xyz/API_docs/constructors/inputMessagesFilterMyMentions.html) filters are not supported by this method. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $offset_id [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $offset_date [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * + * + * @return array + */ + public function getSearchResultsCalendar(array $peer, array $filter, int $offset_id, int $offset_date); + + /** + * Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. + * + * Returns the results in reverse chronological order (i.e., in order of decreasing message\_id). + * + * @param array $peer Peer where to search @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $filter Message filter, [inputMessagesFilterEmpty](https://docs.madelineproto.xyz/API_docs/constructors/inputMessagesFilterEmpty.html), [inputMessagesFilterMyMentions](https://docs.madelineproto.xyz/API_docs/constructors/inputMessagesFilterMyMentions.html) filters are not supported by this method. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $offset_id [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * + * + * @return array + */ + public function getSearchResultsPositions(array $peer, array $filter, int $offset_id, int $limit); + + /** + * Dismiss or approve a chat [join request](https://core.telegram.org/api/invites#join-requests) related to a specific chat or channel. + * + * @param array $peer The chat or channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $user_id The user whose [join request »](https://core.telegram.org/api/invites#join-requests) should be dismissed or approved @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $approved Whether to dismiss or approve the chat [join request »](https://core.telegram.org/api/invites#join-requests) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function hideChatJoinRequest(array $peer, array $user_id, array $approved = []); + + /** + * Dismiss or approve all [join requests](https://core.telegram.org/api/invites#join-requests) related to a specific chat or channel. + * + * @param array $peer The chat or channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $approved Whether to dismiss or approve all chat [join requests »](https://core.telegram.org/api/invites#join-requests) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $link Only dismiss or approve [join requests »](https://core.telegram.org/api/invites#join-requests) initiated using this invite link + * + * + * @return array + */ + public function hideAllChatJoinRequests(array $peer, array $approved = [], string $link = ''); + + /** + * Enable or disable [content protection](https://telegram.org/blog/protected-content-delete-by-date-and-more) on a channel or chat + * + * @param array $peer The chat or channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $enabled Enable or disable content protection + * + * + * @return array + */ + public function toggleNoForwards(array $peer, bool $enabled); + + /** + * Change the default peer that should be used when sending messages to a specific group + * + * @param array $peer Group @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $send_as The default peer that should be used when sending messages to the group @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function saveDefaultSendAs(array $peer, array $send_as); + + /** + * React to message + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id Message ID to react to + * @param array $big Whether a bigger and longer reaction should be shown @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $add_to_recent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $reaction @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendReaction(array $peer, int $msg_id, array $big = [], array $add_to_recent = [], array $reaction = []); + + /** + * Get [message reactions »](https://core.telegram.org/api/reactions) + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $id Message IDs @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getMessagesReactions(array $peer, array $id); + + /** + * Get [message reaction](https://core.telegram.org/api/reactions) list, along with the sender of each reaction. + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $id Message ID + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * @param array $reaction @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $offset Offset (typically taken from the `next_offset` field of the returned [messages.MessageReactionsList](https://docs.madelineproto.xyz/API_docs/types/messages.MessageReactionsList.html)) + * + * + * @return array + */ + public function getMessageReactionsList(array $peer, int $id, int $limit, array $reaction = [], string $offset = ''); + + /** + * Change the set of [message reactions »](https://core.telegram.org/api/reactions) that can be used in a certain group, supergroup or channel + * + * @param array $peer Group where to apply changes @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $available_reactions @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setChatAvailableReactions(array $peer, array $available_reactions); + + /** + * Obtain available [message reactions »](https://core.telegram.org/api/reactions) + * + * @param int $hash + * + * + * @return array + */ + public function getAvailableReactions(int $hash); + + /** + * Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using [help.getConfig, `reactions_default` field](https://docs.madelineproto.xyz/API_docs/methods/help.getConfig.html). + * + * @param array $reaction @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setDefaultReaction(array $reaction); + + /** + * Translate a given text + * + * @param string $to_lang Two-letter ISO 639-1 language code of the language to which the message is translated + * @param array $peer If the text is a chat message, the peer ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id If the text is a chat message, the message ID + * @param string $text The text to translate + * @param string $from_lang Two-letter ISO 639-1 language code of the language from which the message is translated, if not set will be autodetected + * + * + * @return array + */ + public function translateText(string $to_lang, array $peer = [], int $msg_id = 0, string $text = '', string $from_lang = ''); + + /** + * Get unread reactions to messages you sent + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $offset_id [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $add_offset [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * @param int $max_id Only return reactions for messages up until this message ID + * @param int $min_id Only return reactions for messages starting from this message ID + * @param int $top_msg_id + * + * + * @return array + */ + public function getUnreadReactions(array $peer, int $offset_id, int $add_offset, int $limit, int $max_id, int $min_id, int $top_msg_id = 0); + + /** + * Mark [message reactions »](https://core.telegram.org/api/reactions) as read + * + * @param array $peer Peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $top_msg_id + * + * + * @return array + */ + public function readReactions(array $peer, int $top_msg_id = 0); + + /** + * View and search recently sent media. + * This method does not support pagination. + * + * @param string $q Optional search query + * @param array $filter Message filter @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $limit Maximum number of results to return (max 100). + * + * + * @return array + */ + public function searchSentMedia(string $q, array $filter, int $limit); + + /** + * Returns installed attachment menu [bot web apps »](https://core.telegram.org/api/bots/attach) + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getAttachMenuBots(array $hash = []); + + /** + * Returns attachment menu entry for a [bot web app that can be launched from the attachment menu »](https://core.telegram.org/api/bots/attach) + * + * @param array $bot Bot ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getAttachMenuBot(array $bot); + + /** + * Enable or disable [web bot attachment menu »](https://core.telegram.org/api/bots/attach) + * + * @param array $bot Bot ID @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $enabled Toggle + * @param array $write_allowed @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function toggleBotInAttachMenu(array $bot, bool $enabled, array $write_allowed = []); + + /** + * Open a [bot web app](https://core.telegram.org/bots/webapps), sending over user information after user confirmation. + * + * After calling this method, until the user closes the webview, [messages.prolongWebView](https://docs.madelineproto.xyz/API_docs/methods/messages.prolongWebView.html) must be called every 60 seconds. + * + * @param array $peer Dialog where the web app is being opened, and where the resulting message will be sent (see the [docs for more info »](https://core.telegram.org/api/bots/webapps)). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $bot Bot that owns the [web app](https://core.telegram.org/api/bots/webapps) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $platform + * @param array $from_bot_menu Whether the webview was opened by clicking on the bot's [menu button »](https://core.telegram.org/api/bots/menu). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $silent Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is [terminated](https://docs.madelineproto.xyz/API_docs/methods/messages.sendWebViewResultMessage.html) should be sent silently (no notifications for the receivers). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $url [Web app URL](https://core.telegram.org/api/bots/webapps) + * @param string $start_param If the web app was opened from the attachment menu using a [attachment menu deep link](https://core.telegram.org/api/links#bot-attachment-menu-links), `start_param` should contain the `data` from the `startattach` parameter. + * @param array $theme_params Theme parameters for the web app @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $reply_to_msg_id Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is [terminated](https://docs.madelineproto.xyz/API_docs/methods/messages.sendWebViewResultMessage.html) should be sent in reply to this message ID. + * @param int $top_msg_id + * @param array $send_as Open the web app as the specified peer, sending the resulting the message as the specified peer. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function requestWebView(array $peer, array $bot, string $platform, array $from_bot_menu = [], array $silent = [], string $url = '', string $start_param = '', array $theme_params = [], int $reply_to_msg_id = 0, int $top_msg_id = 0, array $send_as = []); + + /** + * Indicate to the server (from the user side) that the user is still using a web app. + * + * @param array $peer Dialog where the web app was opened. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $bot Bot that owns the [web app](https://core.telegram.org/api/bots/webapps) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $query_id Web app interaction ID obtained from [messages.requestWebView](https://docs.madelineproto.xyz/API_docs/methods/messages.requestWebView.html) + * @param array $silent Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is [terminated](https://docs.madelineproto.xyz/API_docs/methods/messages.sendWebViewResultMessage.html) should be sent silently (no notifications for the receivers). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $reply_to_msg_id Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is [terminated](https://docs.madelineproto.xyz/API_docs/methods/messages.sendWebViewResultMessage.html) should be sent in reply to this message ID. + * @param int $top_msg_id + * @param array $send_as Open the web app as the specified peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function prolongWebView(array $peer, array $bot, int $query_id, array $silent = [], int $reply_to_msg_id = 0, int $top_msg_id = 0, array $send_as = []); + + /** + * Open a [bot web app](https://core.telegram.org/api/bots/webapps). + * + * @param array $bot Bot that owns the webapp @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $url Web app URL + * @param string $platform + * @param array $theme_params Theme parameters @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function requestSimpleWebView(array $bot, string $url, string $platform, array $theme_params = []); + + /** + * Terminate webview interaction started with [messages.requestWebView](https://docs.madelineproto.xyz/API_docs/methods/messages.requestWebView.html), sending the specified message to the chat on behalf of the user. + * + * @param string $bot_query_id Webview interaction ID obtained from [messages.requestWebView](https://docs.madelineproto.xyz/API_docs/methods/messages.requestWebView.html) + * @param array $result Message to send @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function sendWebViewResultMessage(string $bot_query_id, array $result); + + /** + * Used by the user to relay data from an opened [reply keyboard bot web app](https://core.telegram.org/api/bots/webapps) to the bot that owns it. + * + * @param array $bot Bot that owns the web app @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $button_text Text of the [keyboardButtonSimpleWebView](https://docs.madelineproto.xyz/API_docs/constructors/keyboardButtonSimpleWebView.html) that was pressed to open the web app. + * @param string $data Data to relay to the bot, obtained from a [`web_app_data_send` JS event](https://core.telegram.org/api/web-events#web-app-data-send). + * + * + * @return array + */ + public function sendWebViewData(array $bot, string $button_text, string $data); + + /** + * [Transcribe voice message](https://core.telegram.org/api/transcribe) + * + * @param array $peer Peer ID where the voice message was sent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id Voice message ID + * + * + * @return array + */ + public function transcribeAudio(array $peer, int $msg_id); + + /** + * Rate [transcribed voice message](https://core.telegram.org/api/transcribe) + * + * @param array $peer Peer where the voice message was sent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id Message ID + * @param int $transcription_id Transcription ID + * @param bool $good Whether the transcription was correct + * + * + * @return array + */ + public function rateTranscribedAudio(array $peer, int $msg_id, int $transcription_id, bool $good); + + /** + * Fetch [custom emoji stickers »](https://core.telegram.org/api/custom-emoji). + * + * Returns a list of [documents](https://docs.madelineproto.xyz/API_docs/constructors/document.html) with the animated custom emoji in TGS format, and a [documentAttributeCustomEmoji](https://docs.madelineproto.xyz/API_docs/constructors/documentAttributeCustomEmoji.html) attribute with the original emoji and info about the emoji stickerset this custom emoji belongs to. + * + * @param array $document_id [Custom emoji](https://core.telegram.org/api/custom-emoji) IDs from a [messageEntityCustomEmoji](https://docs.madelineproto.xyz/API_docs/constructors/messageEntityCustomEmoji.html). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getCustomEmojiDocuments(array $document_id); + + /** + * Gets the list of currently installed [custom emoji stickersets](https://core.telegram.org/api/custom-emoji). + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getEmojiStickers(array $hash = []); + + /** + * Gets featured custom emoji stickersets. + * + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getFeaturedEmojiStickers(array $hash = []); + + /** + * + * + * @param array $peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $id + * @param array $reaction_peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function reportReaction(array $peer, int $id, array $reaction_peer); + + /** + * + * + * @param int $limit + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getTopReactions(int $limit, array $hash = []); + + /** + * + * + * @param int $limit + * @param array $hash @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getRecentReactions(int $limit, array $hash = []); + + /** + * + * + * @return array + */ + public function clearRecentReactions(); + + /** + * + * + * @param array $peer @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $id @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getExtendedMedia(array $peer, array $id); + + /** + * + * + * @param int $period + * + * + * @return array + */ + public function setDefaultHistoryTTL(int $period); + + /** + * + * + * @return array + */ + public function getDefaultHistoryTTL(); +} diff --git a/src/Namespace/Payments.php b/src/Namespace/Payments.php new file mode 100644 index 000000000..0989dffd6 --- /dev/null +++ b/src/Namespace/Payments.php @@ -0,0 +1,130 @@ +`bg_color` \- Background color
`text_color` \- Text color
`hint_color` \- Hint text color
`link_color` \- Link color
`button_color` \- Button color
`button_text_color` \- Button text color @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getPaymentForm(array $invoice, array $theme_params = []); + + /** + * Get payment receipt + * + * @param array $peer The peer where the payment receipt was sent @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $msg_id Message ID of receipt + * + * + * @return array + */ + public function getPaymentReceipt(array $peer, int $msg_id); + + /** + * Submit requested order information for validation + * + * @param array $invoice Invoice @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $info Requested order information @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $save Save order information to re-use it for future orders @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function validateRequestedInfo(array $invoice, array $info, array $save = []); + + /** + * Send compiled payment form + * + * @param int $form_id Form ID + * @param array $invoice Invoice @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $credentials Payment credentials @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $requested_info_id ID of saved and validated [order info](https://docs.madelineproto.xyz/API_docs/constructors/payments.validatedRequestedInfo.html) + * @param string $shipping_option_id Chosen shipping option ID + * @param int $tip_amount Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of `US$ 1.45` pass `amount = 145`. See the exp parameter in [currencies.json](https://core.telegram.org/bots/payments/currencies.json), it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). + * + * + * @return array + */ + public function sendPaymentForm(int $form_id, array $invoice, array $credentials, string $requested_info_id = '', string $shipping_option_id = '', int $tip_amount = 0); + + /** + * Get saved payment information + * + * @return array + */ + public function getSavedInfo(); + + /** + * Clear saved payment information + * + * @param array $credentials Remove saved payment credentials @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $info Clear the last order settings saved by the user @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function clearSavedInfo(array $credentials = [], array $info = []); + + /** + * Get info about a credit card + * + * @param string $number Credit card number + * + * + * @return array + */ + public function getBankCardData(string $number); + + /** + * Generate an [invoice deep link](https://core.telegram.org/api/links#invoice-links) + * + * @param array $invoice_media Invoice @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function exportInvoice(array $invoice_media); + + /** + * Informs server about a purchase made through the App Store: for official applications only. + * + * @param string $receipt Receipt + * @param array $purpose Payment purpose @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function assignAppStoreTransaction(string $receipt, array $purpose); + + /** + * Informs server about a purchase made through the Play Store: for official applications only. + * + * @param array $receipt Receipt @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $purpose Payment purpose @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function assignPlayMarketTransaction(array $receipt, array $purpose); + + /** + * Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase, official apps only. + * + * @param array $purpose Payment purpose @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function canPurchasePremium(array $purpose); +} diff --git a/src/Namespace/Phone.php b/src/Namespace/Phone.php new file mode 100644 index 000000000..44341f5d0 --- /dev/null +++ b/src/Namespace/Phone.php @@ -0,0 +1,328 @@ +Note: if no more results are available, the method call will return an empty `next_offset`; thus, avoid providing the `next_offset` returned in [phone.groupParticipants](https://docs.madelineproto.xyz/API_docs/constructors/phone.groupParticipants.html) if it is empty, to avoid an infinite loop. + * @param int $limit Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) + * + * + * @return array + */ + public function getGroupParticipants(array $call, array $ids, array $sources, string $offset, int $limit); + + /** + * Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs. + * Returns an intersection of the source IDs specified in `sources`, and the source IDs currently being forwarded by the SFU. + * + * @param array $call Group call @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $sources Source IDs @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function checkGroupCall(array $call, array $sources); + + /** + * Start or stop recording a group call: the recorded audio and video streams will be automatically sent to `Saved messages` (the chat with ourselves). + * + * @param array $call The group call or livestream @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $start Whether to start or stop recording @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $video Whether to also record video streams @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $title Recording title + * @param bool $video_portrait If video stream recording is enabled, whether to record in portrait or landscape mode + * + * + * @return array + */ + public function toggleGroupCallRecord(array $call, array $start = [], array $video = [], string $title = '', bool $video_portrait = false); + + /** + * Edit information about a given group call participant + * + * Note: [flags](https://core.telegram.org/mtproto/TL-combinators#conditional-fields).N?[Bool](https://docs.madelineproto.xyz/API_docs/types/Bool.html) parameters can have three possible values: + * + * - If the [TL flag](https://core.telegram.org/mtproto/TL-combinators#conditional-fields) is not set, the previous value will not be changed. + * - If the [TL flag](https://core.telegram.org/mtproto/TL-combinators#conditional-fields) is set and contains a [boolTrue](https://docs.madelineproto.xyz/API_docs/constructors/boolTrue.html), the previous value will be overwritten to `true`. + * - If the [TL flag](https://core.telegram.org/mtproto/TL-combinators#conditional-fields) is set and contains a [boolFalse](https://docs.madelineproto.xyz/API_docs/constructors/boolFalse.html), the previous value will be overwritten to `false`. + * + * @param array $call The group call @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $participant The group call participant (can also be the user itself) @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $muted Whether to mute or unmute the specified participant + * @param int $volume New volume + * @param bool $raise_hand Raise or lower hand + * @param bool $video_stopped Start or stop the video stream + * @param bool $video_paused Pause or resume the video stream + * @param bool $presentation_paused Pause or resume the screen sharing stream + * + * + * @return array + */ + public function editGroupCallParticipant(array $call, array $participant, bool $muted = false, int $volume = 0, bool $raise_hand = false, bool $video_stopped = false, bool $video_paused = false, bool $presentation_paused = false); + + /** + * Edit the title of a group call or livestream + * + * @param array $call Group call @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $title New title + * + * + * @return array + */ + public function editGroupCallTitle(array $call, string $title); + + /** + * Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. + * + * @param array $peer The dialog whose group call or livestream we're trying to join @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getGroupCallJoinAs(array $peer); + + /** + * Get an [invite link](https://core.telegram.org/api/links#voice-chatvideo-chatlivestream-links) for a group call or livestream + * + * @param array $call The group call @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $can_self_unmute For livestreams or muted group chats, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function exportGroupCallInvite(array $call, array $can_self_unmute = []); + + /** + * Subscribe or unsubscribe to a scheduled group call + * + * @param array $call Scheduled group call @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $subscribed Enable or disable subscription + * + * + * @return array + */ + public function toggleGroupCallStartSubscription(array $call, bool $subscribed); + + /** + * Start a scheduled group call. + * + * @param array $call The scheduled group call @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function startScheduledGroupCall(array $call); + + /** + * Set the default peer that will be used to join a group call in a specific dialog. + * + * @param array $peer The dialog @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $join_as The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function saveDefaultGroupCallJoinAs(array $peer, array $join_as); + + /** + * Start screen sharing in a call + * + * @param array $call The group call @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $params WebRTC parameters @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function joinGroupCallPresentation(array $call, array $params); + + /** + * Stop screen sharing in a group call + * + * @param array $call The group call @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function leaveGroupCallPresentation(array $call); + + /** + * Get info about RTMP streams in a group call or livestream. + * This method should be invoked to the same group/channel-related DC used for [downloading livestream chunks](https://core.telegram.org/api/files#downloading-files). + * As usual, the media DC is preferred, if available. + * + * @param array $call Group call or livestream @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getGroupCallStreamChannels(array $call); + + /** + * Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the actual RTMP livestream with [phone.createGroupCall](https://docs.madelineproto.xyz/API_docs/methods/phone.createGroupCall.html) (the `rtmp_stream` flag must be set). + * + * @param array $peer Peer to livestream into @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param bool $revoke Whether to revoke the previous stream key or simply return the existing one + * + * + * @return array + */ + public function getGroupCallStreamRtmpUrl(array $peer, bool $revoke); + + /** + * Save phone call debug information + * + * @param array $peer Phone call @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $file Logs @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function saveCallLog(array $peer, array $file); +} diff --git a/src/Namespace/Photos.php b/src/Namespace/Photos.php new file mode 100644 index 000000000..0377ec8f9 --- /dev/null +++ b/src/Namespace/Photos.php @@ -0,0 +1,73 @@ +"`. `` is case insensitive. 1-64 characters. + * @param array $stickers Stickers @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $masks Whether this is a mask stickerset @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $animated Whether this is an animated stickerset @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $videos Whether this is a video stickerset @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $thumb Thumbnail @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param string $software Used when [importing stickers using the sticker import SDKs](https://core.telegram.org/import-stickers), specifies the name of the software that created the stickers + * + * + * @return array + */ + public function createStickerSet(array $user_id, string $title, string $short_name, array $stickers, array $masks = [], array $animated = [], array $videos = [], array $thumb = [], string $software = ''); + + /** + * Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. + * + * @param array $sticker The sticker to remove @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function removeStickerFromSet(array $sticker); + + /** + * Changes the absolute position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot + * + * @param array $sticker The sticker @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $position The new position of the sticker, zero-based + * + * + * @return array + */ + public function changeStickerPosition(array $sticker, int $position); + + /** + * Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. + * + * @param array $stickerset The stickerset @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $sticker The sticker @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function addStickerToSet(array $stickerset, array $sticker); + + /** + * Set stickerset thumbnail + * + * @param array $stickerset Stickerset @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $thumb Thumbnail @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function setStickerSetThumb(array $stickerset, array $thumb); + + /** + * Check whether the given short name is available + * + * @param string $short_name Short name + * + * + * @return array + */ + public function checkShortName(string $short_name); + + /** + * Suggests a short name for a given stickerpack name + * + * @param string $title Sticker pack name + * + * + * @return array + */ + public function suggestShortName(string $title); +} diff --git a/src/Namespace/Updates.php b/src/Namespace/Updates.php new file mode 100644 index 000000000..dec468033 --- /dev/null +++ b/src/Namespace/Updates.php @@ -0,0 +1,45 @@ +Simply tells the server to not return the difference if it is bigger than `pts_total_limit`
If the remote pts is too big (> ~4000000), this field will default to 1000000 + * + * + * @return array + */ + public function getDifference(int $pts, int $date, int $qts, int $pts_total_limit = 0); + + /** + * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates. + * + * @param array $channel The channel @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param array $filter Messsage filter @see https://docs.madelineproto.xyz/API_docs/types/array.html + * @param int $pts Persistent timestamp (see [updates](https://core.telegram.org/api/updates)) + * @param int $limit How many updates to fetch, max `100000`
Ordinary (non-bot) users are supposed to pass `10-100` + * @param array $force Set to true to skip some possibly unneeded updates and reduce server-side load @see https://docs.madelineproto.xyz/API_docs/types/array.html + * + * + * @return array + */ + public function getChannelDifference(array $channel, array $filter, int $pts, int $limit, array $force = []); +} diff --git a/src/Namespace/Upload.php b/src/Namespace/Upload.php new file mode 100644 index 000000000..59a70712b --- /dev/null +++ b/src/Namespace/Upload.php @@ -0,0 +1,25 @@ +. - * - * @author Daniil Gentili - * @copyright 2016-2023 Daniil Gentili - * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 - * @link https://docs.madelineproto.xyz MadelineProto documentation - */ - -namespace danog\MadelineProto; - -class APIFactory extends AbstractAPIFactory -{ - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var stats - */ - public $stats; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var folders - */ - public $folders; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var langpack - */ - public $langpack; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var phone - */ - public $phone; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var stickers - */ - public $stickers; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var payments - */ - public $payments; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var bots - */ - public $bots; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var channels - */ - public $channels; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var help - */ - public $help; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var upload - */ - public $upload; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var photos - */ - public $photos; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var updates - */ - public $updates; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var messages - */ - public $messages; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var contacts - */ - public $contacts; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var users - */ - public $users; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var account - */ - public $account; - /** - * @internal this is a internal property generated by build_docs.php, don't change manually - * - * @var auth - */ - public $auth; -} diff --git a/src/danog/MadelineProto/InternalDoc.php b/src/danog/MadelineProto/InternalDoc.php deleted file mode 100644 index dcfe129cc..000000000 --- a/src/danog/MadelineProto/InternalDoc.php +++ /dev/null @@ -1,7857 +0,0 @@ -exportAuthorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html. - * - * Parameters: - * * `int` **dc_id** - Number of a target data-center - * - * @param array $params Parameters - * - * @return auth.ExportedAuthorization - */ - public function exportAuthorization($params); - - /** - * You cannot use this method directly, use $MadelineProto->importAuthorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html. - * - * Parameters: - * * `long` **id** - User ID - * * `bytes` **bytes** - Authorization key - * - * @param array $params Parameters - * - * @return auth.Authorization - */ - public function importAuthorization($params); - - /** - * You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info. - * - * Parameters: - * * `long` **perm_auth_key_id** - Permanent auth\_key\_id to bind to - * * `long` **nonce** - Random long from [Binding message contents](#binding-message-contents) - * * `int` **expires_at** - Unix timestamp to invalidate temporary key, see [Binding message contents](#binding-message-contents) - * * `bytes` **encrypted_message** - See [Generating encrypted\_message](#generating-encrypted-message) - * - * @param array $params Parameters - * - * @return bool - */ - public function bindTempAuthKey($params); - - /** - * You cannot use this method directly, use the botLogin method instead (see https://docs.madelineproto.xyz for more info). - * - * Parameters: - * * `int` **api_id** - Application identifier (see. [App configuration](https://core.telegram.org/myapp)) - * * `string` **api_hash** - Application identifier hash (see. [App configuration](https://core.telegram.org/myapp)) - * * `string` **bot_auth_token** - Bot token (see [bots](https://core.telegram.org/bots)) - * - * @param array $params Parameters - * - * @return auth.Authorization - */ - public function importBotAuthorization($params); - - /** - * You cannot use this method directly, use the complete2falogin method instead (see https://docs.madelineproto.xyz for more info). - * - * Parameters: - * * `InputCheckPasswordSRP` **password** - The account's password (see [SRP](https://core.telegram.org/api/srp)) - * - * @param array $params Parameters - * - * @return auth.Authorization - */ - public function checkPassword($params); - - /** - * Request recovery code of a [2FA password](https://core.telegram.org/api/srp), only for accounts with a [recovery email configured](https://core.telegram.org/api/srp#email-verification). - * - * @return auth.PasswordRecovery - */ - public function requestPasswordRecovery(); - - /** - * Reset the [2FA password](https://core.telegram.org/api/srp) using the recovery code sent using [auth.requestPasswordRecovery](https://docs.madelineproto.xyz/API_docs/methods/auth.requestPasswordRecovery.html). - * - * Parameters: - * * `string` **code** - Code received via email - * * `account.PasswordInputSettings` **new_settings** - Optional: New password - * - * @param array $params Parameters - * - * @return auth.Authorization - */ - public function recoverPassword($params); - - /** - * Resend the login code via another medium, the phone code type is determined by the return value of the previous auth.sendCode/auth.resendCode: see [login](https://core.telegram.org/api/auth) for more info. - * - * Parameters: - * * `string` **phone_number** - The phone number - * * `string` **phone_code_hash** - The phone code hash obtained from [auth.sendCode](https://docs.madelineproto.xyz/API_docs/methods/auth.sendCode.html) - * - * @param array $params Parameters - * - * @return auth.SentCode - */ - public function resendCode($params); - - /** - * Cancel the login verification code. - * - * Parameters: - * * `string` **phone_number** - Phone number - * * `string` **phone_code_hash** - Phone code hash from [auth.sendCode](https://docs.madelineproto.xyz/API_docs/methods/auth.sendCode.html) - * - * @param array $params Parameters - * - * @return bool - */ - public function cancelCode($params); - - /** - * Delete all temporary authorization keys **except for** the ones specified. - * - * Parameters: - * * `[long]` **except_auth_keys** - The auth keys that **shouldn't** be dropped. - * - * @param array $params Parameters - * - * @return bool - */ - public function dropTempAuthKeys($params); - - /** - * Generate a login token, for [login via QR code](https://core.telegram.org/api/qr-login). - * The generated login token should be encoded using base64url, then shown as a `tg://login?token=base64encodedtoken` [deep link »](https://core.telegram.org/api/links#qr-code-login-links) in the QR code. - * - * For more info, see [login via QR code](https://core.telegram.org/api/qr-login). - * - * Parameters: - * * `int` **api_id** - Application identifier (see. [App configuration](https://core.telegram.org/myapp)) - * * `string` **api_hash** - Application identifier hash (see. [App configuration](https://core.telegram.org/myapp)) - * * `[long]` **except_ids** - List of already logged-in user IDs, to prevent logging in twice with the same user - * - * @param array $params Parameters - * - * @return auth.LoginToken - */ - public function exportLoginToken($params); - - /** - * Login using a redirected login token, generated in case of DC mismatch during [QR code login](https://core.telegram.org/api/qr-login). - * - * For more info, see [login via QR code](https://core.telegram.org/api/qr-login). - * - * Parameters: - * * `bytes` **token** - Login token - * - * @param array $params Parameters - * - * @return auth.LoginToken - */ - public function importLoginToken($params); - - /** - * Accept QR code login token, logging in the app that generated it. - * - * Returns info about the new session. - * - * For more info, see [login via QR code](https://core.telegram.org/api/qr-login). - * - * Parameters: - * * `bytes` **token** - Login token embedded in QR code, for more info, see [login via QR code](https://core.telegram.org/api/qr-login). - * - * @param array $params Parameters - * - * @return Authorization - */ - public function acceptLoginToken($params); - - /** - * Check if the [2FA recovery code](https://core.telegram.org/api/srp) sent using [auth.requestPasswordRecovery](https://docs.madelineproto.xyz/API_docs/methods/auth.requestPasswordRecovery.html) is valid, before passing it to [auth.recoverPassword](https://docs.madelineproto.xyz/API_docs/methods/auth.recoverPassword.html). - * - * Parameters: - * * `string` **code** - Code received via email - * - * @param array $params Parameters - * - * @return bool - */ - public function checkRecoveryPassword($params); - - /** - * - * - * Parameters: - * * `int` **api_id** - - * * `string` **api_hash** - - * * `string` **web_auth_token** -. - * - * @param array $params Parameters - * - * @return auth.Authorization - */ - public function importWebTokenAuthorization($params); -} - -interface account -{ - /** - * Register device to receive [PUSH notifications](https://core.telegram.org/api/push-updates). - * - * Parameters: - * * `boolean` **no_muted** - Optional: Avoid receiving (silent and invisible background) notifications. Useful to save battery. - * * `int` **token_type** - Device token type.
**Possible values**:
`1` \- APNS (device token for apple push)
`2` \- FCM (firebase token for google firebase)
`3` \- MPNS (channel URI for microsoft push)
`4` \- Simple push (endpoint for firefox's simple push API)
`5` \- Ubuntu phone (token for ubuntu push)
`6` \- Blackberry (token for blackberry push)
`7` \- Unused
`8` \- WNS (windows push)
`9` \- APNS VoIP (token for apple push VoIP)
`10` \- Web push (web push, see below)
`11` \- MPNS VoIP (token for microsoft push VoIP)
`12` \- Tizen (token for tizen push)

For `10` web push, the token must be a JSON-encoded object containing the keys described in [PUSH updates](https://core.telegram.org/api/push-updates) - * * `string` **token** - Device token - * * `Bool` **app_sandbox** - If [(boolTrue)](https://docs.madelineproto.xyz/API_docs/constructors/boolTrue.html) is transmitted, a sandbox-certificate will be used during transmission. - * * `bytes` **secret** - For FCM and APNS VoIP, optional encryption key used to encrypt push notifications - * * `[long]` **other_uids** - List of user identifiers of other users currently using the client - * - * @param array $params Parameters - * - * @return bool - */ - public function registerDevice($params); - - /** - * Deletes a device by its token, stops sending PUSH-notifications to it. - * - * Parameters: - * * `int` **token_type** - Device token type.
**Possible values**:
`1` \- APNS (device token for apple push)
`2` \- FCM (firebase token for google firebase)
`3` \- MPNS (channel URI for microsoft push)
`4` \- Simple push (endpoint for firefox's simple push API)
`5` \- Ubuntu phone (token for ubuntu push)
`6` \- Blackberry (token for blackberry push)
`7` \- Unused
`8` \- WNS (windows push)
`9` \- APNS VoIP (token for apple push VoIP)
`10` \- Web push (web push, see below)
`11` \- MPNS VoIP (token for microsoft push VoIP)
`12` \- Tizen (token for tizen push)

For `10` web push, the token must be a JSON-encoded object containing the keys described in [PUSH updates](https://core.telegram.org/api/push-updates) - * * `string` **token** - Device token - * * `[long]` **other_uids** - List of user identifiers of other users currently using the client - * - * @param array $params Parameters - * - * @return bool - */ - public function unregisterDevice($params); - - /** - * Edits notification settings from a given user/group, from all users/all groups. - * - * Parameters: - * * `InputNotifyPeer` **peer** - Notification source - * * `InputPeerNotifySettings` **settings** - Notification settings - * - * @param array $params Parameters - * - * @return bool - */ - public function updateNotifySettings($params); - - /** - * Gets current notification settings for a given user/group, from all users/all groups. - * - * Parameters: - * * `InputNotifyPeer` **peer** - Notification source - * - * @param array $params Parameters - * - * @return PeerNotifySettings - */ - public function getNotifySettings($params); - - /** - * Resets all notification settings from users and groups. - * - * @return bool - */ - public function resetNotifySettings(); - - /** - * Updates user profile. - * - * Parameters: - * * `string` **first_name** - Optional: New user first name - * * `string` **last_name** - Optional: New user last name - * * `string` **about** - Optional: New bio - * - * @param array $params Parameters - * - * @return User - */ - public function updateProfile($params); - - /** - * Updates online user status. - * - * Parameters: - * * `Bool` **offline** - If [(boolTrue)](https://docs.madelineproto.xyz/API_docs/constructors/boolTrue.html) is transmitted, user status will change to [(userStatusOffline)](https://docs.madelineproto.xyz/API_docs/constructors/userStatusOffline.html). - * - * @param array $params Parameters - * - * @return bool - */ - public function updateStatus($params); - - /** - * Returns a list of available [wallpapers](https://core.telegram.org/api/wallpapers). - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return account.WallPapers - */ - public function getWallPapers($params); - - /** - * Report a peer for violation of telegram's Terms of Service. - * - * Parameters: - * * `InputPeer` **peer** - The peer to report - * * `ReportReason` **reason** - The reason why this peer is being reported - * * `string` **message** - Comment for report moderation - * - * @param array $params Parameters - * - * @return bool - */ - public function reportPeer($params); - - /** - * Validates a username and checks availability. - * - * Parameters: - * * `string` **username** - username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. - * - * @param array $params Parameters - * - * @return bool - */ - public function checkUsername($params); - - /** - * Changes username for the current user. - * - * Parameters: - * * `string` **username** - username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. - * - * @param array $params Parameters - * - * @return User - */ - public function updateUsername($params); - - /** - * Get privacy settings of current account. - * - * Parameters: - * * `InputPrivacyKey` **key** - Peer category whose privacy settings should be fetched - * - * @param array $params Parameters - * - * @return account.PrivacyRules - */ - public function getPrivacy($params); - - /** - * Change privacy settings of current account. - * - * Parameters: - * * `InputPrivacyKey` **key** - Peers to which the privacy rules apply - * * `[InputPrivacyRule]` **rules** - New privacy rules - * - * @param array $params Parameters - * - * @return account.PrivacyRules - */ - public function setPrivacy($params); - - /** - * Delete the user's account from the telegram servers. - * - * Can also be used to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured, see [here »](https://core.telegram.org/api/srp#password-recovery) for more info on password recovery, and [here »](https://core.telegram.org/api/account-deletion) for more info on account deletion. - * - * Parameters: - * * `string` **reason** - Why is the account being deleted, can be empty - * * `InputCheckPasswordSRP` **password** - Optional: [2FA password](https://core.telegram.org/api/srp): this field can be omitted even for accounts with 2FA enabled: in this case account account deletion will be delayed by 7 days [as specified in the docs »](https://core.telegram.org/api/account-deletion) - * - * @param array $params Parameters - * - * @return bool - */ - public function deleteAccount($params); - - /** - * Get days to live of account. - * - * @return AccountDaysTTL - */ - public function getAccountTTL(); - - /** - * Set account self-destruction period. - * - * Parameters: - * * `AccountDaysTTL` **ttl** - Time to live in days - * - * @param array $params Parameters - * - * @return bool - */ - public function setAccountTTL($params); - - /** - * Verify a new phone number to associate to the current account. - * - * Parameters: - * * `string` **phone_number** - New phone number - * * `CodeSettings` **settings** - Phone code settings - * - * @param array $params Parameters - * - * @return auth.SentCode - */ - public function sendChangePhoneCode($params); - - /** - * Change the phone number of the current account. - * - * Parameters: - * * `string` **phone_number** - New phone number - * * `string` **phone_code_hash** - Phone code hash received when calling [account.sendChangePhoneCode](https://docs.madelineproto.xyz/API_docs/methods/account.sendChangePhoneCode.html) - * * `string` **phone_code** - Phone code received when calling [account.sendChangePhoneCode](https://docs.madelineproto.xyz/API_docs/methods/account.sendChangePhoneCode.html) - * - * @param array $params Parameters - * - * @return User - */ - public function changePhone($params); - - /** - * When client-side passcode lock feature is enabled, will not show message texts in incoming [PUSH notifications](https://core.telegram.org/api/push-updates). - * - * Parameters: - * * `int` **period** - Inactivity period after which to start hiding message texts in [PUSH notifications](https://core.telegram.org/api/push-updates). - * - * @param array $params Parameters - * - * @return bool - */ - public function updateDeviceLocked($params); - - /** - * Get logged-in sessions. - * - * @return account.Authorizations - */ - public function getAuthorizations(); - - /** - * Log out an active [authorized session](https://core.telegram.org/api/auth) by its hash. - * - * Parameters: - * * `long` **hash** - Session hash - * - * @param array $params Parameters - * - * @return bool - */ - public function resetAuthorization($params); - - /** - * Obtain configuration for two-factor authorization with password. - * - * @return account.Password - */ - public function getPassword(); - - /** - * You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info). - * - * Parameters: - * * `InputCheckPasswordSRP` **password** - The password (see [SRP](https://core.telegram.org/api/srp)) - * - * @param array $params Parameters - * - * @return account.PasswordSettings - */ - public function getPasswordSettings($params); - - /** - * You cannot use this method directly; use $MadelineProto->update2fa($params), instead (see https://docs.madelineproto.xyz for more info). - * - * Parameters: - * * `InputCheckPasswordSRP` **password** - The old password (see [SRP](https://core.telegram.org/api/srp)) - * * `account.PasswordInputSettings` **new_settings** - The new password (see [SRP](https://core.telegram.org/api/srp)) - * - * @param array $params Parameters - * - * @return bool - */ - public function updatePasswordSettings($params); - - /** - * Send confirmation code to cancel account deletion, for more info [click here »](https://core.telegram.org/api/account-deletion). - * - * Parameters: - * * `string` **hash** - The hash from the service notification, for more info [click here »](https://core.telegram.org/api/account-deletion) - * * `CodeSettings` **settings** - Phone code settings - * - * @param array $params Parameters - * - * @return auth.SentCode - */ - public function sendConfirmPhoneCode($params); - - /** - * Confirm a phone number to cancel account deletion, for more info [click here »](https://core.telegram.org/api/account-deletion). - * - * Parameters: - * * `string` **phone_code_hash** - Phone code hash, for more info [click here »](https://core.telegram.org/api/account-deletion) - * * `string` **phone_code** - SMS code, for more info [click here »](https://core.telegram.org/api/account-deletion) - * - * @param array $params Parameters - * - * @return bool - */ - public function confirmPhone($params); - - /** - * Get temporary payment password. - * - * Parameters: - * * `InputCheckPasswordSRP` **password** - SRP password parameters - * * `int` **period** - Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 - * - * @param array $params Parameters - * - * @return account.TmpPassword - */ - public function getTmpPassword($params); - - /** - * Get web [login widget](https://core.telegram.org/widgets/login) authorizations. - * - * @return account.WebAuthorizations - */ - public function getWebAuthorizations(); - - /** - * Log out an active web [telegram login](https://core.telegram.org/widgets/login) session. - * - * Parameters: - * * `long` **hash** - [Session](https://docs.madelineproto.xyz/API_docs/constructors/webAuthorization.html) hash - * - * @param array $params Parameters - * - * @return bool - */ - public function resetWebAuthorization($params); - - /** - * Reset all active web [telegram login](https://core.telegram.org/widgets/login) sessions. - * - * @return bool - */ - public function resetWebAuthorizations(); - - /** - * Get all saved [Telegram Passport](https://core.telegram.org/passport) documents, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption). - * - * @return of SecureValue[] - */ - public function getAllSecureValues(); - - /** - * Get saved [Telegram Passport](https://core.telegram.org/passport) document, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption). - * - * Parameters: - * * `[SecureValueType]` **types** - Requested value types - * - * @param array $params Parameters - * - * @return of SecureValue[] - */ - public function getSecureValue($params); - - /** - * Securely save [Telegram Passport](https://core.telegram.org/passport) document, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption). - * - * Parameters: - * * `InputSecureValue` **value** - Secure value, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption) - * * `long` **secure_secret_id** - Passport secret hash, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption) - * - * @param array $params Parameters - * - * @return SecureValue - */ - public function saveSecureValue($params); - - /** - * Delete stored [Telegram Passport](https://core.telegram.org/passport) documents, [for more info see the passport docs »](https://core.telegram.org/passport/encryption#encryption). - * - * Parameters: - * * `[SecureValueType]` **types** - Document types to delete - * - * @param array $params Parameters - * - * @return bool - */ - public function deleteSecureValue($params); - - /** - * Returns a Telegram Passport authorization form for sharing data with a service. - * - * Parameters: - * * `long` **bot_id** - User identifier of the service's bot - * * `string` **scope** - Telegram Passport element types requested by the service - * * `string` **public_key** - Service's public key - * - * @param array $params Parameters - * - * @return account.AuthorizationForm - */ - public function getAuthorizationForm($params); - - /** - * Sends a Telegram Passport authorization form, effectively sharing data with the service. - * - * Parameters: - * * `long` **bot_id** - Bot ID - * * `string` **scope** - Telegram Passport element types requested by the service - * * `string` **public_key** - Service's public key - * * `[SecureValueHash]` **value_hashes** - Types of values sent and their hashes - * * `SecureCredentialsEncrypted` **credentials** - Encrypted values - * - * @param array $params Parameters - * - * @return bool - */ - public function acceptAuthorization($params); - - /** - * Send the verification phone code for telegram [passport](https://core.telegram.org/passport). - * - * Parameters: - * * `string` **phone_number** - The phone number to verify - * * `CodeSettings` **settings** - Phone code settings - * - * @param array $params Parameters - * - * @return auth.SentCode - */ - public function sendVerifyPhoneCode($params); - - /** - * Verify a phone number for telegram [passport](https://core.telegram.org/passport). - * - * Parameters: - * * `string` **phone_number** - Phone number - * * `string` **phone_code_hash** - Phone code hash received from the call to [account.sendVerifyPhoneCode](https://docs.madelineproto.xyz/API_docs/methods/account.sendVerifyPhoneCode.html) - * * `string` **phone_code** - Code received after the call to [account.sendVerifyPhoneCode](https://docs.madelineproto.xyz/API_docs/methods/account.sendVerifyPhoneCode.html) - * - * @param array $params Parameters - * - * @return bool - */ - public function verifyPhone($params); - - /** - * Send an email verification code. - * - * Parameters: - * * `EmailVerifyPurpose` **purpose** - - * * `string` **email** - The email where to send the code. - * - * @param array $params Parameters - * - * @return account.SentEmailCode - */ - public function sendVerifyEmailCode($params); - - /** - * Verify an email address. - * - * Parameters: - * * `EmailVerifyPurpose` **purpose** - - * * `EmailVerification` **verification** - - * - * @param array $params Parameters - * - * @return account.EmailVerified - */ - public function verifyEmail($params); - - /** - * Initialize account takeout session. - * - * Parameters: - * * `boolean` **contacts** - Optional: Whether to export contacts - * * `boolean` **message_users** - Optional: Whether to export messages in private chats - * * `boolean` **message_chats** - Optional: Whether to export messages in [basic groups](https://core.telegram.org/api/channel#basic-groups) - * * `boolean` **message_megagroups** - Optional: Whether to export messages in [supergroups](https://core.telegram.org/api/channel#supergroups) - * * `boolean` **message_channels** - Optional: Whether to export messages in [channels](https://core.telegram.org/api/channel#channels) - * * `boolean` **files** - Optional: Whether to export files - * * `long` **file_max_size** - Optional: Maximum size of files to export - * - * @param array $params Parameters - * - * @return account.Takeout - */ - public function initTakeoutSession($params); - - /** - * Finish account takeout session. - * - * Parameters: - * * `boolean` **success** - Optional: Data exported successfully - * - * @param array $params Parameters - * - * @return bool - */ - public function finishTakeoutSession($params); - - /** - * Verify an email to use as [2FA recovery method](https://core.telegram.org/api/srp). - * - * Parameters: - * * `string` **code** - The phone code that was received after [setting a recovery email](https://core.telegram.org/api/srp#email-verification) - * - * @param array $params Parameters - * - * @return bool - */ - public function confirmPasswordEmail($params); - - /** - * Resend the code to verify an email to use as [2FA recovery method](https://core.telegram.org/api/srp). - * - * @return bool - */ - public function resendPasswordEmail(); - - /** - * Cancel the code that was sent to verify an email to use as [2FA recovery method](https://core.telegram.org/api/srp). - * - * @return bool - */ - public function cancelPasswordEmail(); - - /** - * Whether the user will receive notifications when contacts sign up. - * - * @return bool - */ - public function getContactSignUpNotification(); - - /** - * Toggle contact sign up notifications. - * - * Parameters: - * * `Bool` **silent** - Whether to disable contact sign up notifications - * - * @param array $params Parameters - * - * @return bool - */ - public function setContactSignUpNotification($params); - - /** - * Returns list of chats with non-default notification settings. - * - * Parameters: - * * `boolean` **compare_sound** - Optional: If true, chats with non-default sound will also be returned - * * `InputNotifyPeer` **peer** - Optional: If specified, only chats of the specified category will be returned - * - * @param array $params Parameters - * - * @return Updates - */ - public function getNotifyExceptions($params); - - /** - * Get info about a certain [wallpaper](https://core.telegram.org/api/wallpapers). - * - * Parameters: - * * `InputWallPaper` **wallpaper** - The [wallpaper](https://core.telegram.org/api/wallpapers) to get info about - * - * @param array $params Parameters - * - * @return WallPaper - */ - public function getWallPaper($params); - - /** - * Create and upload a new [wallpaper](https://core.telegram.org/api/wallpapers). - * - * Parameters: - * * `InputFile` **file** - The JPG/PNG wallpaper - * * `string` **mime_type** - MIME type of uploaded wallpaper - * * `WallPaperSettings` **settings** - Wallpaper settings - * - * @param array $params Parameters - * - * @return WallPaper - */ - public function uploadWallPaper($params); - - /** - * Install/uninstall [wallpaper](https://core.telegram.org/api/wallpapers). - * - * Parameters: - * * `InputWallPaper` **wallpaper** - [Wallpaper](https://core.telegram.org/api/wallpapers) to install or uninstall - * * `Bool` **unsave** - Uninstall wallpaper? - * * `WallPaperSettings` **settings** - Wallpaper settings - * - * @param array $params Parameters - * - * @return bool - */ - public function saveWallPaper($params); - - /** - * Install [wallpaper](https://core.telegram.org/api/wallpapers). - * - * Parameters: - * * `InputWallPaper` **wallpaper** - [Wallpaper](https://core.telegram.org/api/wallpapers) to install - * * `WallPaperSettings` **settings** - [Wallpaper](https://core.telegram.org/api/wallpapers) settings - * - * @param array $params Parameters - * - * @return bool - */ - public function installWallPaper($params); - - /** - * Delete all installed [wallpapers](https://core.telegram.org/api/wallpapers), reverting to the default wallpaper set. - * - * @return bool - */ - public function resetWallPapers(); - - /** - * Get media autodownload settings. - * - * @return account.AutoDownloadSettings - */ - public function getAutoDownloadSettings(); - - /** - * Change media autodownload settings. - * - * Parameters: - * * `boolean` **low** - Optional: Whether to save media in the low data usage preset - * * `boolean` **high** - Optional: Whether to save media in the high data usage preset - * * `AutoDownloadSettings` **settings** - Media autodownload settings - * - * @param array $params Parameters - * - * @return bool - */ - public function saveAutoDownloadSettings($params); - - /** - * Upload theme. - * - * Parameters: - * * `InputFile` **file** - [Previously uploaded](https://core.telegram.org/api/themes#uploading-theme-files) theme file with platform-specific colors for UI components, can be left unset when creating themes that only modify the wallpaper or accent colors. - * * `InputFile` **thumb** - Optional: Thumbnail - * * `string` **file_name** - File name - * * `string` **mime_type** - MIME type, must be `application/x-tgtheme-{format}`, where `format` depends on the client - * - * @param array $params Parameters - * - * @return Document - */ - public function uploadTheme($params); - - /** - * Create a theme. - * - * Parameters: - * * `string` **slug** - Unique theme ID used to generate [theme deep links](https://core.telegram.org/api/links#theme-links), can be empty to autogenerate a random ID. - * * `string` **title** - Theme name - * * `InputDocument` **document** - Optional: Theme file - * * `[InputThemeSettings]` **settings** - Optional: Theme settings, multiple values can be provided for the different base themes (day/night mode, etc). - * - * @param array $params Parameters - * - * @return Theme - */ - public function createTheme($params); - - /** - * Update theme. - * - * Parameters: - * * `string` **format** - Theme format, a string that identifies the theming engines supported by the client - * * `InputTheme` **theme** - Theme to update - * * `string` **slug** - Optional: Unique theme ID - * * `string` **title** - Optional: Theme name - * * `InputDocument` **document** - Optional: Theme file - * * `[InputThemeSettings]` **settings** - Optional: Theme settings - * - * @param array $params Parameters - * - * @return Theme - */ - public function updateTheme($params); - - /** - * Save a theme. - * - * Parameters: - * * `InputTheme` **theme** - Theme to save - * * `Bool` **unsave** - Unsave - * - * @param array $params Parameters - * - * @return bool - */ - public function saveTheme($params); - - /** - * Install a theme. - * - * Parameters: - * * `boolean` **dark** - Optional: Whether to install the dark version - * * `InputTheme` **theme** - Optional: Theme to install - * * `string` **format** - Optional: Theme format, a string that identifies the theming engines supported by the client - * * `BaseTheme` **base_theme** - Optional: Indicates a basic theme provided by all clients - * - * @param array $params Parameters - * - * @return bool - */ - public function installTheme($params); - - /** - * Get theme information. - * - * Parameters: - * * `string` **format** - Theme format, a string that identifies the theming engines supported by the client - * * `InputTheme` **theme** - Theme - * - * @param array $params Parameters - * - * @return Theme - */ - public function getTheme($params); - - /** - * Get installed themes. - * - * Parameters: - * * `string` **format** - Theme format, a string that identifies the theming engines supported by the client - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return account.Themes - */ - public function getThemes($params); - - /** - * Set sensitive content settings (for viewing or hiding NSFW content). - * - * Parameters: - * * `boolean` **sensitive_enabled** - Optional: Enable NSFW content - * - * @param array $params Parameters - * - * @return bool - */ - public function setContentSettings($params); - - /** - * Get sensitive content settings. - * - * @return account.ContentSettings - */ - public function getContentSettings(); - - /** - * Get info about multiple [wallpapers](https://core.telegram.org/api/wallpapers). - * - * Parameters: - * * `[InputWallPaper]` **wallpapers** - [Wallpapers](https://core.telegram.org/api/wallpapers) to fetch info about - * - * @param array $params Parameters - * - * @return of WallPaper[] - */ - public function getMultiWallPapers($params); - - /** - * Get global privacy settings. - * - * @return GlobalPrivacySettings - */ - public function getGlobalPrivacySettings(); - - /** - * Set global privacy settings. - * - * Parameters: - * * `GlobalPrivacySettings` **settings** - Global privacy settings - * - * @param array $params Parameters - * - * @return GlobalPrivacySettings - */ - public function setGlobalPrivacySettings($params); - - /** - * Report a profile photo of a dialog. - * - * Parameters: - * * `InputPeer` **peer** - The dialog - * * `InputPhoto` **photo_id** - Dialog photo ID - * * `ReportReason` **reason** - Report reason - * * `string` **message** - Comment for report moderation - * - * @param array $params Parameters - * - * @return bool - */ - public function reportProfilePhoto($params); - - /** - * Initiate a 2FA password reset: can only be used if the user is already logged-in, [see here for more info »](https://core.telegram.org/api/srp#password-reset). - * - * @return account.ResetPasswordResult - */ - public function resetPassword(); - - /** - * Abort a pending 2FA password reset, [see here for more info »](https://core.telegram.org/api/srp#password-reset). - * - * @return bool - */ - public function declinePasswordReset(); - - /** - * Get all available chat themes. - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return account.Themes - */ - public function getChatThemes($params); - - /** - * Set time-to-live of current session. - * - * Parameters: - * * `int` **authorization_ttl_days** - Time-to-live of current session in days - * - * @param array $params Parameters - * - * @return bool - */ - public function setAuthorizationTTL($params); - - /** - * Change authorization settings. - * - * Parameters: - * * `long` **hash** - Session ID from the [authorization](https://docs.madelineproto.xyz/API_docs/constructors/authorization.html) constructor, fetchable using [account.getAuthorizations](https://docs.madelineproto.xyz/API_docs/methods/account.getAuthorizations.html) - * * `Bool` **encrypted_requests_disabled** - Optional: Whether to enable or disable receiving encrypted chats: if the flag is not set, the previous setting is not changed - * * `Bool` **call_requests_disabled** - Optional: Whether to enable or disable receiving calls: if the flag is not set, the previous setting is not changed - * - * @param array $params Parameters - * - * @return bool - */ - public function changeAuthorizationSettings($params); - - /** - * Fetch saved notification sounds. - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return account.SavedRingtones - */ - public function getSavedRingtones($params); - - /** - * Save or remove saved notification sound. - * - * If the notification sound is already in MP3 format, [account.savedRingtone](https://docs.madelineproto.xyz/API_docs/constructors/account.savedRingtone.html) will be returned. - * Otherwise, it will be automatically converted and a [account.savedRingtoneConverted](https://docs.madelineproto.xyz/API_docs/constructors/account.savedRingtoneConverted.html) will be returned, containing a new [document](https://docs.madelineproto.xyz/API_docs/constructors/document.html) object that should be used to refer to the ringtone from now on (ie when deleting it using the `unsave` parameter, or when downloading it). - * - * Parameters: - * * `InputDocument` **id** - Notification sound uploaded using [account.uploadRingtone](https://docs.madelineproto.xyz/API_docs/methods/account.uploadRingtone.html) - * * `Bool` **unsave** - Whether to add or delete the notification sound - * - * @param array $params Parameters - * - * @return account.SavedRingtone - */ - public function saveRingtone($params); - - /** - * Upload notification sound, use [account.saveRingtone](https://docs.madelineproto.xyz/API_docs/methods/account.saveRingtone.html) to convert it and add it to the list of saved notification sounds. - * - * Parameters: - * * `InputFile` **file** - Notification sound - * * `string` **file_name** - File name - * * `string` **mime_type** - MIME type of file - * - * @param array $params Parameters - * - * @return Document - */ - public function uploadRingtone($params); - - /** - * - * - * Parameters: - * * `EmojiStatus` **emoji_status** -. - * - * @param array $params Parameters - * - * @return bool - */ - public function updateEmojiStatus($params); - - /** - * - * - * Parameters: - * * `long` **hash** -. - * - * @param array $params Parameters - * - * @return account.EmojiStatuses - */ - public function getDefaultEmojiStatuses($params); - - /** - * - * - * Parameters: - * * `long` **hash** -. - * - * @param array $params Parameters - * - * @return account.EmojiStatuses - */ - public function getRecentEmojiStatuses($params); - - /** - * - * - * @return bool - */ - public function clearRecentEmojiStatuses(); - - /** - * - * - * Parameters: - * * `[string]` **order** -. - * - * @param array $params Parameters - * - * @return bool - */ - public function reorderUsernames($params); - - /** - * - * - * Parameters: - * * `string` **username** - - * * `Bool` **active** -. - * - * @param array $params Parameters - * - * @return bool - */ - public function toggleUsername($params); -} - -interface users -{ - /** - * You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info). - * - * Parameters: - * * `[InputUser]` **id** - List of user identifiers - * - * @param array $params Parameters - * - * @return of User[] - */ - public function getUsers($params); - - /** - * You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info). - * - * Parameters: - * * `InputUser` **id** - User ID - * - * @param array $params Parameters - * - * @return users.UserFull - */ - public function getFullUser($params); - - /** - * Notify the user that the sent [passport](https://core.telegram.org/passport) data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). - * - * Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues. - * - * Parameters: - * * `InputUser` **id** - The user - * * `[SecureValueError]` **errors** - Errors - * - * @param array $params Parameters - * - * @return bool - */ - public function setSecureValueErrors($params); -} - -interface contacts -{ - /** - * Get contact by telegram IDs. - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return of int[] - */ - public function getContactIDs($params); - - /** - * Returns the list of contact statuses. - * - * @return of ContactStatus[] - */ - public function getStatuses(); - - /** - * Returns the current user's contact list. - * - * Parameters: - * * `long` **hash** - If there already is a full contact list on the client, a [hash](https://core.telegram.org/api/offsets#hash-generation) of a the list of contact IDs in ascending order may be passed in this parameter. If the contact set was not changed, [(contacts.contactsNotModified)](https://docs.madelineproto.xyz/API_docs/constructors/contacts.contactsNotModified.html) will be returned. - * - * @param array $params Parameters - * - * @return contacts.Contacts - */ - public function getContacts($params); - - /** - * Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. - * - * Use [contacts.addContact](https://docs.madelineproto.xyz/API_docs/methods/contacts.addContact.html) to add Telegram contacts without actually using their phone number. - * - * Parameters: - * * `[InputContact]` **contacts** - List of contacts to import - * - * @param array $params Parameters - * - * @return contacts.ImportedContacts - */ - public function importContacts($params); - - /** - * Deletes several contacts from the list. - * - * Parameters: - * * `[InputUser]` **id** - User ID list - * - * @param array $params Parameters - * - * @return Updates - */ - public function deleteContacts($params); - - /** - * Delete contacts by phone number. - * - * Parameters: - * * `[string]` **phones** - Phone numbers - * - * @param array $params Parameters - * - * @return bool - */ - public function deleteByPhones($params); - - /** - * Adds the user to the blacklist. - * - * Parameters: - * * `InputPeer` **id** - User ID - * - * @param array $params Parameters - * - * @return bool - */ - public function block($params); - - /** - * Deletes the user from the blacklist. - * - * Parameters: - * * `InputPeer` **id** - User ID - * - * @param array $params Parameters - * - * @return bool - */ - public function unblock($params); - - /** - * Returns the list of blocked users. - * - * Parameters: - * * `int` **offset** - The number of list elements to be skipped - * * `int` **limit** - The number of list elements to be returned - * - * @param array $params Parameters - * - * @return contacts.Blocked - */ - public function getBlocked($params); - - /** - * Returns users found by username substring. - * - * Parameters: - * * `string` **q** - Target substring - * * `int` **limit** - Maximum number of users to be returned - * - * @param array $params Parameters - * - * @return contacts.Found - */ - public function search($params); - - /** - * You cannot use this method directly, use the resolveUsername, getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info). - * - * Parameters: - * * `string` **username** - @username to resolve - * - * @param array $params Parameters - * - * @return contacts.ResolvedPeer - */ - public function resolveUsername($params); - - /** - * Get most used peers. - * - * Parameters: - * * `boolean` **correspondents** - Optional: Users we've chatted most frequently with - * * `boolean` **bots_pm** - Optional: Most used bots - * * `boolean` **bots_inline** - Optional: Most used inline bots - * * `boolean` **phone_calls** - Optional: Most frequently called users - * * `boolean` **forward_users** - Optional: Users to which the users often forwards messages to - * * `boolean` **forward_chats** - Optional: Chats to which the users often forwards messages to - * * `boolean` **groups** - Optional: Often-opened groups and supergroups - * * `boolean` **channels** - Optional: Most frequently visited channels - * * `int` **offset** - Offset for [pagination](https://core.telegram.org/api/offsets) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return contacts.TopPeers - */ - public function getTopPeers($params); - - /** - * Reset [rating](https://core.telegram.org/api/top-rating) of top peer. - * - * Parameters: - * * `TopPeerCategory` **category** - Top peer category - * * `InputPeer` **peer** - Peer whose rating should be reset - * - * @param array $params Parameters - * - * @return bool - */ - public function resetTopPeerRating($params); - - /** - * Delete saved contacts. - * - * @return bool - */ - public function resetSaved(); - - /** - * Get all contacts. - * - * @return of SavedContact[] - */ - public function getSaved(); - - /** - * Enable/disable [top peers](https://core.telegram.org/api/top-rating). - * - * Parameters: - * * `Bool` **enabled** - Enable/disable - * - * @param array $params Parameters - * - * @return bool - */ - public function toggleTopPeers($params); - - /** - * Add an existing telegram user as contact. - * - * Use [contacts.importContacts](https://docs.madelineproto.xyz/API_docs/methods/contacts.importContacts.html) to add contacts by phone number, without knowing their Telegram ID. - * - * Parameters: - * * `boolean` **add_phone_privacy_exception** - Optional: Allow the other user to see our phone number? - * * `InputUser` **id** - Telegram ID of the other user - * * `string` **first_name** - First name - * * `string` **last_name** - Last name - * * `string` **phone** - User's phone number - * - * @param array $params Parameters - * - * @return Updates - */ - public function addContact($params); - - /** - * If the [peer settings](https://docs.madelineproto.xyz/API_docs/constructors/peerSettings.html) of a new user allow us to add them as contact, add that user as contact. - * - * Parameters: - * * `InputUser` **id** - The user to add as contact - * - * @param array $params Parameters - * - * @return Updates - */ - public function acceptContact($params); - - /** - * Get contacts near you. - * - * Parameters: - * * `boolean` **background** - Optional: While the geolocation of the current user is public, clients should update it in the background every half-an-hour or so, while setting this flag.
Do this only if the new location is more than 1 KM away from the previous one, or if the previous location is unknown. - * * `InputGeoPoint` **geo_point** - Geolocation - * * `int` **self_expires** - Optional: If set, the geolocation of the current user will be public for the specified number of seconds; pass 0x7fffffff to disable expiry, 0 to make the current geolocation private; if the flag isn't set, no changes will be applied. - * - * @param array $params Parameters - * - * @return Updates - */ - public function getLocated($params); - - /** - * Stop getting notifications about [thread replies](https://core.telegram.org/api/threads) of a certain user in `@replies`. - * - * Parameters: - * * `boolean` **delete_message** - Optional: Whether to delete the specified message as well - * * `boolean` **delete_history** - Optional: Whether to delete all `@replies` messages from this user as well - * * `boolean` **report_spam** - Optional: Whether to also report this user for spam - * * `int` **msg_id** - ID of the message in the [@replies](https://core.telegram.org/api/threads#replies) chat - * - * @param array $params Parameters - * - * @return Updates - */ - public function blockFromReplies($params); - - /** - * Resolve a phone number to get user info, if their privacy settings allow it. - * - * Parameters: - * * `string` **phone** - Phone number in international format, possibly obtained from a [phone number deep link](https://core.telegram.org/api/links#phone-number-links). - * - * @param array $params Parameters - * - * @return contacts.ResolvedPeer - */ - public function resolvePhone($params); - - /** - * - * - * @return ExportedContactToken - */ - public function exportContactToken(); - - /** - * - * - * Parameters: - * * `string` **token** -. - * - * @param array $params Parameters - * - * @return User - */ - public function importContactToken($params); -} - -interface messages -{ - /** - * Please use the [event handler](https://docs.madelineproto.xyz/docs/UPDATES.html). - * - * Parameters: - * * `[InputMessage]` **id** - Message ID list - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function getMessages($params); - - /** - * Returns the current user dialog list. - * - * Parameters: - * * `boolean` **exclude_pinned** - Optional: Exclude pinned dialogs - * * `int` **folder_id** - Optional: [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders) - * * `int` **offset_date** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `InputPeer` **offset_peer** - [Offset peer for pagination](https://core.telegram.org/api/offsets) - * * `int` **limit** - Number of list elements to be returned - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.Dialogs - */ - public function getDialogs($params); - - /** - * Please use the [event handler](https://docs.madelineproto.xyz/docs/UPDATES.html). - * - * Parameters: - * * `InputPeer` **peer** - Target peer - * * `int` **offset_id** - Only return messages starting from the specified message ID - * * `int` **offset_date** - Only return messages sent before the specified date - * * `int` **add_offset** - Number of list elements to be skipped, negative values are also accepted. - * * `int` **limit** - Number of results to return - * * `int` **max_id** - If a positive value was transferred, the method will return only messages with IDs less than **max\_id** - * * `int` **min_id** - If a positive value was transferred, the method will return only messages with IDs more than **min\_id** - * * `long` **hash** - [Result hash](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function getHistory($params); - - /** - * Returns found messages. - * - * Parameters: - * * `InputPeer` **peer** - User or chat, histories with which are searched, or [(inputPeerEmpty)](https://docs.madelineproto.xyz/API_docs/constructors/inputPeerEmpty.html) constructor for global search - * * `string` **q** - Text search request - * * `InputPeer` **from_id** - Optional: Only return messages sent by the specified user ID - * * `int` **top_msg_id** - Optional: [Thread ID](https://core.telegram.org/api/threads) - * * `MessagesFilter` **filter** - Filter to return only specified message types - * * `int` **min_date** - If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned - * * `int` **max_date** - If a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned - * * `int` **offset_id** - Only return messages starting from the specified message ID - * * `int` **add_offset** - [Additional offset](https://core.telegram.org/api/offsets) - * * `int` **limit** - [Number of results to return](https://core.telegram.org/api/offsets) - * * `int` **max_id** - [Maximum message ID to return](https://core.telegram.org/api/offsets) - * * `int` **min_id** - [Minimum message ID to return](https://core.telegram.org/api/offsets) - * * `long` **hash** - [Hash](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function search($params); - - /** - * Marks message history as read. - * - * Parameters: - * * `InputPeer` **peer** - Target user or group - * * `int` **max_id** - If a positive value is passed, only messages with identifiers less or equal than the given one will be read - * - * @param array $params Parameters - * - * @return messages.AffectedMessages - */ - public function readHistory($params); - - /** - * Deletes communication history. - * - * Parameters: - * * `boolean` **just_clear** - Optional: Just clear history for the current user, without actually removing messages for every chat user - * * `boolean` **revoke** - Optional: Whether to delete the message history for all chat participants - * * `InputPeer` **peer** - User or chat, communication history of which will be deleted - * * `int` **max_id** - Maximum ID of message to delete - * * `int` **min_date** - Optional: Delete all messages newer than this UNIX timestamp - * * `int` **max_date** - Optional: Delete all messages older than this UNIX timestamp - * - * @param array $params Parameters - * - * @return messages.AffectedHistory - */ - public function deleteHistory($params); - - /** - * Deletes messages by their identifiers. - * - * Parameters: - * * `boolean` **revoke** - Optional: Whether to delete messages for all participants of the chat - * * `[int]` **id** - Message ID list - * - * @param array $params Parameters - * - * @return messages.AffectedMessages - */ - public function deleteMessages($params); - - /** - * Confirms receipt of messages by a client, cancels PUSH-notification sending. - * - * Parameters: - * * `int` **max_id** - Maximum message ID available in a client. - * - * @param array $params Parameters - * - * @return of ReceivedNotifyMessage[] - */ - public function receivedMessages($params); - - /** - * Sends a current user typing event (see [SendMessageAction](https://docs.madelineproto.xyz/API_docs/types/SendMessageAction.html) for all event types) to a conversation partner or group. - * - * Parameters: - * * `InputPeer` **peer** - Target user or group - * * `int` **top_msg_id** - Optional: [Thread ID](https://core.telegram.org/api/threads) - * * `SendMessageAction` **action** - Type of action - * - * @param array $params Parameters - * - * @return bool - */ - public function setTyping($params); - - /** - * Sends a message to a chat. - * - * Parameters: - * * `boolean` **no_webpage** - Optional: Set this flag to disable generation of the webpage preview - * * `boolean` **silent** - Optional: Send this message silently (no notifications for the receivers) - * * `boolean` **background** - Optional: Send this message as background message - * * `boolean` **clear_draft** - Optional: Clear the draft field - * * `boolean` **noforwards** - Optional: Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have [content protection](https://telegram.org/blog/protected-content-delete-by-date-and-more) enabled - * * `boolean` **update_stickersets_order** - Optional: - * * `InputPeer` **peer** - The destination where the message will be sent - * * `int` **reply_to_msg_id** - Optional: The message ID to which this message will reply to - * * `int` **top_msg_id** - Optional: - * * `string` **message** - The message - * * `ReplyMarkup` **reply_markup** - Optional: Reply markup for sending bot buttons - * * `[MessageEntity]` **entities** - Optional: Message [entities](https://core.telegram.org/api/entities) for sending styled text - * * `int` **schedule_date** - Optional: Scheduled message date for [scheduled messages](https://core.telegram.org/api/scheduled-messages) - * * `InputPeer` **send_as** - Optional: Send this message as the specified peer - * - * @param array $params Parameters - * - * @return Updates - */ - public function sendMessage($params); - - /** - * Send a media. - * - * Parameters: - * * `boolean` **silent** - Optional: Send message silently (no notification should be triggered) - * * `boolean` **background** - Optional: Send message in background - * * `boolean` **clear_draft** - Optional: Clear the draft - * * `boolean` **noforwards** - Optional: Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have [content protection](https://telegram.org/blog/protected-content-delete-by-date-and-more) enabled - * * `boolean` **update_stickersets_order** - Optional: - * * `InputPeer` **peer** - Destination - * * `int` **reply_to_msg_id** - Optional: Message ID to which this message should reply to - * * `int` **top_msg_id** - Optional: - * * `InputMedia` **media** - Attached media - * * `string` **message** - Caption - * * `ReplyMarkup` **reply_markup** - Optional: Reply markup for bot keyboards - * * `[MessageEntity]` **entities** - Optional: Message [entities](https://core.telegram.org/api/entities) for styled text - * * `int` **schedule_date** - Optional: Scheduled message date for [scheduled messages](https://core.telegram.org/api/scheduled-messages) - * * `InputPeer` **send_as** - Optional: Send this message as the specified peer - * - * @param array $params Parameters - * - * @return Updates - */ - public function sendMedia($params); - - /** - * Forwards messages by their IDs. - * - * Parameters: - * * `boolean` **silent** - Optional: Whether to send messages silently (no notification will be triggered on the destination clients) - * * `boolean` **background** - Optional: Whether to send the message in background - * * `boolean` **with_my_score** - Optional: When forwarding games, whether to include your score in the game - * * `boolean` **drop_author** - Optional: Whether to forward messages without quoting the original author - * * `boolean` **drop_media_captions** - Optional: Whether to strip captions from media - * * `boolean` **noforwards** - Optional: Only for bots, disallows further re-forwarding and saving of the messages, even if the destination chat doesn't have [content protection](https://telegram.org/blog/protected-content-delete-by-date-and-more) enabled - * * `InputPeer` **from_peer** - Source of messages - * * `[int]` **id** - IDs of messages - * * `InputPeer` **to_peer** - Destination peer - * * `int` **top_msg_id** - Optional: - * * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages - * * `InputPeer` **send_as** - Optional: Forward the messages as the specified peer - * - * @param array $params Parameters - * - * @return Updates - */ - public function forwardMessages($params); - - /** - * Report a new incoming chat for spam, if the [peer settings](https://docs.madelineproto.xyz/API_docs/constructors/peerSettings.html) of the chat allow us to do that. - * - * Parameters: - * * `InputPeer` **peer** - Peer to report - * - * @param array $params Parameters - * - * @return bool - */ - public function reportSpam($params); - - /** - * Get peer settings. - * - * Parameters: - * * `InputPeer` **peer** - The peer - * - * @param array $params Parameters - * - * @return messages.PeerSettings - */ - public function getPeerSettings($params); - - /** - * Report a message in a chat for violation of telegram's Terms of Service. - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `[int]` **id** - IDs of messages to report - * * `ReportReason` **reason** - Why are these messages being reported - * * `string` **message** - Comment for report moderation - * - * @param array $params Parameters - * - * @return bool - */ - public function report($params); - - /** - * Returns chat basic info on their IDs. - * - * Parameters: - * * `[long]` **id** - List of chat IDs - * - * @param array $params Parameters - * - * @return messages.Chats - */ - public function getChats($params); - - /** - * You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info). - * - * Parameters: - * * `InputPeer` **chat_id** - - * - * @param array $params Parameters - * - * @return messages.ChatFull - */ - public function getFullChat($params); - - /** - * Changes chat name and sends a service message on it. - * - * Parameters: - * * `InputPeer` **chat_id** - - * * `string` **title** - New chat name, different from the old one - * - * @param array $params Parameters - * - * @return Updates - */ - public function editChatTitle($params); - - /** - * Changes chat photo and sends a service message on it. - * - * Parameters: - * * `InputPeer` **chat_id** - - * * `InputChatPhoto` **photo** - Photo to be set - * - * @param array $params Parameters - * - * @return Updates - */ - public function editChatPhoto($params); - - /** - * Adds a user to a chat and sends a service message on it. - * - * Parameters: - * * `InputPeer` **chat_id** - - * * `InputUser` **user_id** - User ID to be added - * * `int` **fwd_limit** - Number of last messages to be forwarded - * - * @param array $params Parameters - * - * @return Updates - */ - public function addChatUser($params); - - /** - * Deletes a user from a chat and sends a service message on it. - * - * Parameters: - * * `boolean` **revoke_history** - Optional: Remove the entire chat history of the specified user in this chat. - * * `InputPeer` **chat_id** - - * * `InputUser` **user_id** - User ID to be deleted - * - * @param array $params Parameters - * - * @return Updates - */ - public function deleteChatUser($params); - - /** - * Creates a new chat. - * - * Parameters: - * * `[InputUser]` **users** - List of user IDs to be invited - * * `string` **title** - Chat name - * * `int` **ttl_period** - Optional: - * - * @param array $params Parameters - * - * @return Updates - */ - public function createChat($params); - - /** - * You cannot use this method directly, instead use $MadelineProto->getDhConfig();. - * - * Parameters: - * * `int` **version** - Value of the **version** parameter from [messages.dhConfig](https://docs.madelineproto.xyz/API_docs/constructors/messages.dhConfig.html), available at the client - * * `int` **random_length** - Length of the required random sequence - * - * @param array $params Parameters - * - * @return messages.DhConfig - */ - public function getDhConfig($params); - - /** - * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats. - * - * Parameters: - * * `InputUser` **user_id** - User ID - * * `bytes` **g_a** - `A = g ^ a mod p`, see [Wikipedia](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - * - * @param array $params Parameters - * - * @return EncryptedChat - */ - public function requestEncryption($params); - - /** - * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats. - * - * Parameters: - * * `InputEncryptedChat` **peer** - Secret chat ID - * * `bytes` **g_b** - `B = g ^ b mod p`, see [Wikipedia](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - * * `long` **key_fingerprint** - 64-bit fingerprint of the received key - * - * @param array $params Parameters - * - * @return EncryptedChat - */ - public function acceptEncryption($params); - - /** - * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats. - * - * Parameters: - * * `boolean` **delete_history** - Optional: Whether to delete the entire chat history for the other user as well - * * `int` **chat_id** - Secret chat ID - * - * @param array $params Parameters - * - * @return bool - */ - public function discardEncryption($params); - - /** - * Send typing event by the current user to a secret chat. - * - * Parameters: - * * `InputEncryptedChat` **peer** - Secret chat ID - * * `Bool` **typing** - Typing.
**Possible values**:
[(boolTrue)](https://docs.madelineproto.xyz/API_docs/constructors/boolTrue.html), if the user started typing and more than **5 seconds** have passed since the last request
[(boolFalse)](https://docs.madelineproto.xyz/API_docs/constructors/boolFalse.html), if the user stopped typing - * - * @param array $params Parameters - * - * @return bool - */ - public function setEncryptedTyping($params); - - /** - * Marks message history within a secret chat as read. - * - * Parameters: - * * `InputEncryptedChat` **peer** - Secret chat ID - * * `int` **max_date** - Maximum date value for received messages in history - * - * @param array $params Parameters - * - * @return bool - */ - public function readEncryptedHistory($params); - - /** - * Sends a text message to a secret chat. - * - * Parameters: - * * `boolean` **silent** - Optional: Send encrypted message without a notification - * * `InputEncryptedChat` **peer** - Secret chat ID - * * `DecryptedMessage` **message** - - * - * @param array $params Parameters - * - * @return messages.SentEncryptedMessage - */ - public function sendEncrypted($params); - - /** - * Sends a message with a file attachment to a secret chat. - * - * Parameters: - * * `boolean` **silent** - Optional: Whether to send the file without triggering a notification - * * `InputEncryptedChat` **peer** - Secret chat ID - * * `DecryptedMessage` **message** - - * * `InputEncryptedFile` **file** - File attachment for the secret chat - * - * @param array $params Parameters - * - * @return messages.SentEncryptedMessage - */ - public function sendEncryptedFile($params); - - /** - * Sends a service message to a secret chat. - * - * Parameters: - * * `InputEncryptedChat` **peer** - Secret chat ID - * * `DecryptedMessage` **message** - - * - * @param array $params Parameters - * - * @return messages.SentEncryptedMessage - */ - public function sendEncryptedService($params); - - /** - * You cannot use this method directly. - * - * Parameters: - * * `int` **max_qts** - Maximum qts value available at the client - * - * @param array $params Parameters - * - * @return of long[] - */ - public function receivedQueue($params); - - /** - * Report a secret chat for spam. - * - * Parameters: - * * `InputEncryptedChat` **peer** - The secret chat to report - * - * @param array $params Parameters - * - * @return bool - */ - public function reportEncryptedSpam($params); - - /** - * Notifies the sender about the recipient having listened a voice message or watched a video. - * - * Parameters: - * * `[int]` **id** - Message ID list - * - * @param array $params Parameters - * - * @return messages.AffectedMessages - */ - public function readMessageContents($params); - - /** - * Get stickers by emoji. - * - * Parameters: - * * `string` **emoticon** - The emoji - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.Stickers - */ - public function getStickers($params); - - /** - * Get all installed stickers. - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.AllStickers - */ - public function getAllStickers($params); - - /** - * Get preview of webpage. - * - * Parameters: - * * `string` **message** - Message from which to extract the preview - * * `[MessageEntity]` **entities** - Optional: [Message entities for styled text](https://core.telegram.org/api/entities) - * - * @param array $params Parameters - * - * @return MessageMedia - */ - public function getWebPagePreview($params); - - /** - * Export an invite link for a chat. - * - * Parameters: - * * `boolean` **legacy_revoke_permanent** - Optional: Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. - * * `boolean` **request_needed** - Optional: Whether admin confirmation is required before admitting each separate user into the chat - * * `InputPeer` **peer** - Chat - * * `int` **expire_date** - Optional: Expiration date - * * `int` **usage_limit** - Optional: Maximum number of users that can join using this link - * * `string` **title** - Optional: Description of the invite link, visible only to administrators - * - * @param array $params Parameters - * - * @return ExportedChatInvite - */ - public function exportChatInvite($params); - - /** - * Check the validity of a chat invite link and get basic info about it. - * - * Parameters: - * * `string` **hash** - Invite hash from [chat invite deep link »](https://core.telegram.org/api/links#chat-invite-links). - * - * @param array $params Parameters - * - * @return ChatInvite - */ - public function checkChatInvite($params); - - /** - * Import a chat invite and join a private chat/supergroup/channel. - * - * Parameters: - * * `string` **hash** - `hash` from a [chat invite deep link](https://core.telegram.org/api/links#chat-invite-links) - * - * @param array $params Parameters - * - * @return Updates - */ - public function importChatInvite($params); - - /** - * Get info about a stickerset. - * - * Parameters: - * * `InputStickerSet` **stickerset** - Stickerset - * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.StickerSet - */ - public function getStickerSet($params); - - /** - * Install a stickerset. - * - * Parameters: - * * `InputStickerSet` **stickerset** - Stickerset to install - * * `Bool` **archived** - Whether to archive stickerset - * - * @param array $params Parameters - * - * @return messages.StickerSetInstallResult - */ - public function installStickerSet($params); - - /** - * Uninstall a stickerset. - * - * Parameters: - * * `InputStickerSet` **stickerset** - The stickerset to uninstall - * - * @param array $params Parameters - * - * @return bool - */ - public function uninstallStickerSet($params); - - /** - * Start a conversation with a bot using a [deep linking parameter](https://core.telegram.org/api/links#bot-links). - * - * Parameters: - * * `InputUser` **bot** - The bot - * * `InputPeer` **peer** - The chat where to start the bot, can be the bot's private chat or a group - * * `string` **start_param** - [Deep linking parameter](https://core.telegram.org/api/links#bot-links) - * - * @param array $params Parameters - * - * @return Updates - */ - public function startBot($params); - - /** - * Get and increase the view counter of a message sent or forwarded from a [channel](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputPeer` **peer** - Peer where the message was found - * * `[int]` **id** - ID of message - * * `Bool` **increment** - Whether to mark the message as viewed and increment the view counter - * - * @param array $params Parameters - * - * @return messages.MessageViews - */ - public function getMessagesViews($params); - - /** - * Make a user admin in a [basic group](https://core.telegram.org/api/channel#basic-groups). - * - * Parameters: - * * `InputPeer` **chat_id** - - * * `InputUser` **user_id** - The user to make admin - * * `Bool` **is_admin** - Whether to make them admin - * - * @param array $params Parameters - * - * @return bool - */ - public function editChatAdmin($params); - - /** - * Turn a [basic group into a supergroup](https://core.telegram.org/api/channel#migration). - * - * Parameters: - * * `InputPeer` **chat_id** - - * - * @param array $params Parameters - * - * @return Updates - */ - public function migrateChat($params); - - /** - * Search for messages and peers globally. - * - * Parameters: - * * `int` **folder_id** - Optional: [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders) - * * `string` **q** - Query - * * `MessagesFilter` **filter** - Global search filter - * * `int` **min_date** - If a positive value was specified, the method will return only messages with date bigger than min\_date - * * `int` **max_date** - If a positive value was transferred, the method will return only messages with date smaller than max\_date - * * `int` **offset_rate** - Initially 0, then set to the [`next_rate` parameter of messages.messagesSlice](https://docs.madelineproto.xyz/API_docs/constructors/messages.messagesSlice.html) - * * `InputPeer` **offset_peer** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **limit** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function searchGlobal($params); - - /** - * Reorder installed stickersets. - * - * Parameters: - * * `boolean` **masks** - Optional: Reorder mask stickersets - * * `boolean` **emojis** - Optional: Reorder [custom emoji stickersets](https://core.telegram.org/api/custom-emoji) - * * `[long]` **order** - New stickerset order by stickerset IDs - * - * @param array $params Parameters - * - * @return bool - */ - public function reorderStickerSets($params); - - /** - * Get a document by its SHA256 hash, mainly used for gifs. - * - * Parameters: - * * `bytes` **sha256** - SHA256 of file - * * `long` **size** - Size of the file in bytes - * * `string` **mime_type** - Mime type - * - * @param array $params Parameters - * - * @return Document - */ - public function getDocumentByHash($params); - - /** - * Get saved GIFs. - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.SavedGifs - */ - public function getSavedGifs($params); - - /** - * Add GIF to saved gifs list. - * - * Parameters: - * * `InputDocument` **id** - GIF to save - * * `Bool` **unsave** - Whether to remove GIF from saved gifs list - * - * @param array $params Parameters - * - * @return bool - */ - public function saveGif($params); - - /** - * Query an inline bot. - * - * Parameters: - * * `InputUser` **bot** - The bot to query - * * `InputPeer` **peer** - The currently opened chat - * * `InputGeoPoint` **geo_point** - Optional: The geolocation, if requested - * * `string` **query** - The query - * * `string` **offset** - The offset within the results, will be passed directly as-is to the bot. - * - * @param array $params Parameters - * - * @return messages.BotResults - */ - public function getInlineBotResults($params); - - /** - * Answer an inline query, for bots only. - * - * Parameters: - * * `boolean` **gallery** - Optional: Set this flag if the results are composed of media files - * * `boolean` **private** - Optional: Set this flag if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query - * * `long` **query_id** - Unique identifier for the answered query - * * `[InputBotInlineResult]` **results** - Vector of results for the inline query - * * `int` **cache_time** - The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. - * * `string` **next_offset** - Optional: Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. - * * `InlineBotSwitchPM` **switch_pm** - Optional: If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter. - * - * @param array $params Parameters - * - * @return bool - */ - public function setInlineBotResults($params); - - /** - * Send a result obtained using [messages.getInlineBotResults](https://docs.madelineproto.xyz/API_docs/methods/messages.getInlineBotResults.html). - * - * Parameters: - * * `boolean` **silent** - Optional: Whether to send the message silently (no notification will be triggered on the other client) - * * `boolean` **background** - Optional: Whether to send the message in background - * * `boolean` **clear_draft** - Optional: Whether to clear the [draft](https://core.telegram.org/api/drafts) - * * `boolean` **hide_via** - Optional: Whether to hide the `via @botname` in the resulting message (only for bot usernames encountered in the [config](https://docs.madelineproto.xyz/API_docs/constructors/config.html)) - * * `InputPeer` **peer** - Destination - * * `int` **reply_to_msg_id** - Optional: ID of the message this message should reply to - * * `int` **top_msg_id** - Optional: - * * `long` **query_id** - Query ID from [messages.getInlineBotResults](https://docs.madelineproto.xyz/API_docs/methods/messages.getInlineBotResults.html) - * * `string` **id** - Result ID from [messages.getInlineBotResults](https://docs.madelineproto.xyz/API_docs/methods/messages.getInlineBotResults.html) - * * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages - * * `InputPeer` **send_as** - Optional: Send this message as the specified peer - * - * @param array $params Parameters - * - * @return Updates - */ - public function sendInlineBotResult($params); - - /** - * Find out if a media message's caption can be edited. - * - * Parameters: - * * `InputPeer` **peer** - Peer where the media was sent - * * `int` **id** - ID of message - * - * @param array $params Parameters - * - * @return messages.MessageEditData - */ - public function getMessageEditData($params); - - /** - * Edit message. - * - * Parameters: - * * `boolean` **no_webpage** - Optional: Disable webpage preview - * * `InputPeer` **peer** - Where was the message sent - * * `int` **id** - ID of the message to edit - * * `string` **message** - Optional: New message - * * `InputMedia` **media** - Optional: New attached media - * * `ReplyMarkup` **reply_markup** - Optional: Reply markup for inline keyboards - * * `[MessageEntity]` **entities** - Optional: [Message entities for styled text](https://core.telegram.org/api/entities) - * * `int` **schedule_date** - Optional: Scheduled message date for [scheduled messages](https://core.telegram.org/api/scheduled-messages) - * - * @param array $params Parameters - * - * @return Updates - */ - public function editMessage($params); - - /** - * Edit an inline bot message. - * - * Parameters: - * * `boolean` **no_webpage** - Optional: Disable webpage preview - * * `InputBotInlineMessageID` **id** - Sent inline message ID - * * `string` **message** - Optional: Message - * * `InputMedia` **media** - Optional: Media - * * `ReplyMarkup` **reply_markup** - Optional: Reply markup for inline keyboards - * * `[MessageEntity]` **entities** - Optional: [Message entities for styled text](https://core.telegram.org/api/entities) - * - * @param array $params Parameters - * - * @return bool - */ - public function editInlineBotMessage($params); - - /** - * Press an inline callback button and get a callback answer from the bot. - * - * Parameters: - * * `boolean` **game** - Optional: Whether this is a "play game" button - * * `InputPeer` **peer** - Where was the inline keyboard sent - * * `int` **msg_id** - ID of the Message with the inline keyboard - * * `bytes` **data** - Optional: Callback data - * * `InputCheckPasswordSRP` **password** - Optional: For buttons [requiring you to verify your identity with your 2FA password](https://docs.madelineproto.xyz/API_docs/constructors/keyboardButtonCallback.html), the SRP payload generated using [SRP](https://core.telegram.org/api/srp). - * - * @param array $params Parameters - * - * @return messages.BotCallbackAnswer - */ - public function getBotCallbackAnswer($params); - - /** - * Set the callback answer to a user button press (bots only). - * - * Parameters: - * * `boolean` **alert** - Optional: Whether to show the message as a popup instead of a toast notification - * * `long` **query_id** - Query ID - * * `string` **message** - Optional: Popup to show - * * `string` **url** - Optional: URL to open - * * `int` **cache_time** - Cache validity - * - * @param array $params Parameters - * - * @return bool - */ - public function setBotCallbackAnswer($params); - - /** - * Get dialog info of specified peers. - * - * Parameters: - * * `[InputDialogPeer]` **peers** - Peers - * - * @param array $params Parameters - * - * @return messages.PeerDialogs - */ - public function getPeerDialogs($params); - - /** - * Save a message [draft](https://core.telegram.org/api/drafts) associated to a chat. - * - * Parameters: - * * `boolean` **no_webpage** - Optional: Disable generation of the webpage preview - * * `int` **reply_to_msg_id** - Optional: Message ID the message should reply to - * * `int` **top_msg_id** - Optional: - * * `InputPeer` **peer** - Destination of the message that should be sent - * * `string` **message** - The draft - * * `[MessageEntity]` **entities** - Optional: Message [entities](https://core.telegram.org/api/entities) for styled text - * - * @param array $params Parameters - * - * @return bool - */ - public function saveDraft($params); - - /** - * Return all message [drafts](https://core.telegram.org/api/drafts). - * Returns all the latest [updateDraftMessage](https://docs.madelineproto.xyz/API_docs/constructors/updateDraftMessage.html) updates related to all chats with drafts. - * - * @return Updates - */ - public function getAllDrafts(); - - /** - * Get featured stickers. - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.FeaturedStickers - */ - public function getFeaturedStickers($params); - - /** - * Mark new featured stickers as read. - * - * Parameters: - * * `[long]` **id** - IDs of stickersets to mark as read - * - * @param array $params Parameters - * - * @return bool - */ - public function readFeaturedStickers($params); - - /** - * Get recent stickers. - * - * Parameters: - * * `boolean` **attached** - Optional: Get stickers recently attached to photo or video files - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.RecentStickers - */ - public function getRecentStickers($params); - - /** - * Add/remove sticker from recent stickers list. - * - * Parameters: - * * `boolean` **attached** - Optional: Whether to add/remove stickers recently attached to photo or video files - * * `InputDocument` **id** - Sticker - * * `Bool` **unsave** - Whether to save or unsave the sticker - * - * @param array $params Parameters - * - * @return bool - */ - public function saveRecentSticker($params); - - /** - * Clear recent stickers. - * - * Parameters: - * * `boolean` **attached** - Optional: Set this flag to clear the list of stickers recently attached to photo or video files - * - * @param array $params Parameters - * - * @return bool - */ - public function clearRecentStickers($params); - - /** - * Get all archived stickers. - * - * Parameters: - * * `boolean` **masks** - Optional: Get [mask stickers](https://core.telegram.org/api/stickers#mask-stickers) - * * `boolean` **emojis** - Optional: Get [custom emoji stickers](https://core.telegram.org/api/custom-emoji) - * * `long` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.ArchivedStickers - */ - public function getArchivedStickers($params); - - /** - * Get installed mask stickers. - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.AllStickers - */ - public function getMaskStickers($params); - - /** - * Get stickers attached to a photo or video. - * - * Parameters: - * * `InputStickeredMedia` **media** - Stickered media - * - * @param array $params Parameters - * - * @return of StickerSetCovered[] - */ - public function getAttachedStickers($params); - - /** - * Use this method to set the score of the specified user in a game sent as a normal message (bots only). - * - * Parameters: - * * `boolean` **edit_message** - Optional: Set this flag if the game message should be automatically edited to include the current scoreboard - * * `boolean` **force** - Optional: Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters - * * `InputPeer` **peer** - Unique identifier of target chat - * * `int` **id** - Identifier of the sent message - * * `InputUser` **user_id** - User identifier - * * `int` **score** - New score - * - * @param array $params Parameters - * - * @return Updates - */ - public function setGameScore($params); - - /** - * Use this method to set the score of the specified user in a game sent as an inline message (bots only). - * - * Parameters: - * * `boolean` **edit_message** - Optional: Set this flag if the game message should be automatically edited to include the current scoreboard - * * `boolean` **force** - Optional: Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters - * * `InputBotInlineMessageID` **id** - ID of the inline message - * * `InputUser` **user_id** - User identifier - * * `int` **score** - New score - * - * @param array $params Parameters - * - * @return bool - */ - public function setInlineGameScore($params); - - /** - * Get highscores of a game. - * - * Parameters: - * * `InputPeer` **peer** - Where was the game sent - * * `int` **id** - ID of message with game media attachment - * * `InputUser` **user_id** - Get high scores made by a certain user - * - * @param array $params Parameters - * - * @return messages.HighScores - */ - public function getGameHighScores($params); - - /** - * Get highscores of a game sent using an inline bot. - * - * Parameters: - * * `InputBotInlineMessageID` **id** - ID of inline message - * * `InputUser` **user_id** - Get high scores of a certain user - * - * @param array $params Parameters - * - * @return messages.HighScores - */ - public function getInlineGameHighScores($params); - - /** - * Get chats in common with a user. - * - * Parameters: - * * `InputUser` **user_id** - User ID - * * `long` **max_id** - Maximum ID of chat to return (see [pagination](https://core.telegram.org/api/offsets)) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.Chats - */ - public function getCommonChats($params); - - /** - * Get all chats, channels and supergroups. - * - * Parameters: - * * `[long]` **except_ids** - Except these chats/channels/supergroups - * - * @param array $params Parameters - * - * @return messages.Chats - */ - public function getAllChats($params); - - /** - * Get [instant view](https://instantview.telegram.org) page. - * - * Parameters: - * * `string` **url** - URL of IV page to fetch - * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return WebPage - */ - public function getWebPage($params); - - /** - * Pin/unpin a dialog. - * - * Parameters: - * * `boolean` **pinned** - Optional: Whether to pin or unpin the dialog - * * `InputDialogPeer` **peer** - The dialog to pin - * - * @param array $params Parameters - * - * @return bool - */ - public function toggleDialogPin($params); - - /** - * Reorder pinned dialogs. - * - * Parameters: - * * `boolean` **force** - Optional: If set, dialogs pinned server-side but not present in the `order` field will be unpinned. - * * `int` **folder_id** - [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders) - * * `[InputDialogPeer]` **order** - New dialog order - * - * @param array $params Parameters - * - * @return bool - */ - public function reorderPinnedDialogs($params); - - /** - * Get pinned dialogs. - * - * Parameters: - * * `int` **folder_id** - [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders) - * - * @param array $params Parameters - * - * @return messages.PeerDialogs - */ - public function getPinnedDialogs($params); - - /** - * If you sent an invoice requesting a shipping address and the parameter is\_flexible was specified, the bot will receive an [updateBotShippingQuery](https://docs.madelineproto.xyz/API_docs/constructors/updateBotShippingQuery.html) update. Use this method to reply to shipping queries. - * - * Parameters: - * * `long` **query_id** - Unique identifier for the query to be answered - * * `string` **error** - Optional: Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable"). Telegram will display this message to the user. - * * `[ShippingOption]` **shipping_options** - Optional: A vector of available shipping options. - * - * @param array $params Parameters - * - * @return bool - */ - public function setBotShippingResults($params); - - /** - * Once the user has confirmed their payment and shipping details, the bot receives an [updateBotPrecheckoutQuery](https://docs.madelineproto.xyz/API_docs/constructors/updateBotPrecheckoutQuery.html) update. - * Use this method to respond to such pre-checkout queries. - * **Note**: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. - * - * Parameters: - * * `boolean` **success** - Optional: Set this flag if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order, otherwise do not set it, and set the `error` field, instead - * * `long` **query_id** - Unique identifier for the query to be answered - * * `string` **error** - Optional: Required if the `success` isn't set. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. - * - * @param array $params Parameters - * - * @return bool - */ - public function setBotPrecheckoutResults($params); - - /** - * Upload a file and associate it to a chat (without actually sending it to the chat). - * - * Parameters: - * * `InputPeer` **peer** - The chat, can be [inputPeerEmpty](https://docs.madelineproto.xyz/API_docs/constructors/inputPeerEmpty.html) for bots and [inputPeerSelf](https://docs.madelineproto.xyz/API_docs/constructors/inputPeerSelf.html) for users. - * * `InputMedia` **media** - File uploaded in chunks as described in [files »](https://core.telegram.org/api/files) - * - * @param array $params Parameters - * - * @return MessageMedia - */ - public function uploadMedia($params); - - /** - * Notify the other user in a private chat that a screenshot of the chat was taken. - * - * Parameters: - * * `InputPeer` **peer** - Other user - * * `int` **reply_to_msg_id** - ID of message that was screenshotted, can be 0 - * - * @param array $params Parameters - * - * @return Updates - */ - public function sendScreenshotNotification($params); - - /** - * Get faved stickers. - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.FavedStickers - */ - public function getFavedStickers($params); - - /** - * Mark or unmark a sticker as favorite. - * - * Parameters: - * * `InputDocument` **id** - Sticker in question - * * `Bool` **unfave** - Whether to add or remove a sticker from favorites - * - * @param array $params Parameters - * - * @return bool - */ - public function faveSticker($params); - - /** - * Get unread messages where we were mentioned. - * - * Parameters: - * * `InputPeer` **peer** - Peer where to look for mentions - * * `int` **top_msg_id** - Optional: - * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **add_offset** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * * `int` **max_id** - Maximum message ID to return, [see pagination](https://core.telegram.org/api/offsets) - * * `int` **min_id** - Minimum message ID to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function getUnreadMentions($params); - - /** - * Mark mentions as read. - * - * Parameters: - * * `InputPeer` **peer** - Dialog - * * `int` **top_msg_id** - Optional: - * - * @param array $params Parameters - * - * @return messages.AffectedHistory - */ - public function readMentions($params); - - /** - * Get live location history of a certain user. - * - * Parameters: - * * `InputPeer` **peer** - User - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function getRecentLocations($params); - - /** - * Send an [album or grouped media](https://core.telegram.org/api/files#albums-grouped-media). - * - * Parameters: - * * `boolean` **silent** - Optional: Whether to send the album silently (no notification triggered) - * * `boolean` **background** - Optional: Send in background? - * * `boolean` **clear_draft** - Optional: Whether to clear [drafts](https://core.telegram.org/api/drafts) - * * `boolean` **noforwards** - Optional: Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have [content protection](https://telegram.org/blog/protected-content-delete-by-date-and-more) enabled - * * `boolean` **update_stickersets_order** - Optional: - * * `InputPeer` **peer** - The destination chat - * * `int` **reply_to_msg_id** - Optional: The message to reply to - * * `int` **top_msg_id** - Optional: - * * `[InputSingleMedia]` **multi_media** - The medias to send - * * `int` **schedule_date** - Optional: Scheduled message date for scheduled messages - * * `InputPeer` **send_as** - Optional: Send this message as the specified peer - * - * @param array $params Parameters - * - * @return Updates - */ - public function sendMultiMedia($params); - - /** - * Upload encrypted file and associate it to a secret chat. - * - * Parameters: - * * `InputEncryptedChat` **peer** - The secret chat to associate the file to - * * `InputEncryptedFile` **file** - The file - * - * @param array $params Parameters - * - * @return EncryptedFile - */ - public function uploadEncryptedFile($params); - - /** - * Search for stickersets. - * - * Parameters: - * * `boolean` **exclude_featured** - Optional: Exclude featured stickersets from results - * * `string` **q** - Query string - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.FoundStickerSets - */ - public function searchStickerSets($params); - - /** - * Get message ranges for saving the user's chat history. - * - * @return of MessageRange[] - */ - public function getSplitRanges(); - - /** - * Manually mark dialog as unread. - * - * Parameters: - * * `boolean` **unread** - Optional: Mark as unread/read - * * `InputDialogPeer` **peer** - Dialog - * - * @param array $params Parameters - * - * @return bool - */ - public function markDialogUnread($params); - - /** - * Get dialogs manually marked as unread. - * - * @return of DialogPeer[] - */ - public function getDialogUnreadMarks(); - - /** - * Clear all [drafts](https://core.telegram.org/api/drafts). - * - * @return bool - */ - public function clearAllDrafts(); - - /** - * Pin a message. - * - * Parameters: - * * `boolean` **silent** - Optional: Pin the message silently, without triggering a notification - * * `boolean` **unpin** - Optional: Whether the message should unpinned or pinned - * * `boolean` **pm_oneside** - Optional: Whether the message should only be pinned on the local side of a one-to-one chat - * * `InputPeer` **peer** - The peer where to pin the message - * * `int` **id** - The message to pin or unpin - * - * @param array $params Parameters - * - * @return Updates - */ - public function updatePinnedMessage($params); - - /** - * Vote in a [poll](https://docs.madelineproto.xyz/API_docs/constructors/poll.html). - * - * Parameters: - * * `InputPeer` **peer** - The chat where the poll was sent - * * `int` **msg_id** - The message ID of the poll - * * `[bytes]` **options** - The options that were chosen - * - * @param array $params Parameters - * - * @return Updates - */ - public function sendVote($params); - - /** - * Get poll results. - * - * Parameters: - * * `InputPeer` **peer** - Peer where the poll was found - * * `int` **msg_id** - Message ID of poll message - * - * @param array $params Parameters - * - * @return Updates - */ - public function getPollResults($params); - - /** - * Get count of online users in a chat. - * - * Parameters: - * * `InputPeer` **peer** - The chat - * - * @param array $params Parameters - * - * @return ChatOnlines - */ - public function getOnlines($params); - - /** - * Edit the description of a [group/supergroup/channel](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputPeer` **peer** - The [group/supergroup/channel](https://core.telegram.org/api/channel). - * * `string` **about** - The new description - * - * @param array $params Parameters - * - * @return bool - */ - public function editChatAbout($params); - - /** - * Edit the default banned rights of a [channel/supergroup/group](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputPeer` **peer** - The peer - * * `ChatBannedRights` **banned_rights** - The new global rights - * - * @param array $params Parameters - * - * @return Updates - */ - public function editChatDefaultBannedRights($params); - - /** - * Get localized emoji keywords. - * - * Parameters: - * * `string` **lang_code** - Language code - * - * @param array $params Parameters - * - * @return EmojiKeywordsDifference - */ - public function getEmojiKeywords($params); - - /** - * Get changed emoji keywords. - * - * Parameters: - * * `string` **lang_code** - Language code - * * `int` **from_version** - Previous emoji keyword localization version - * - * @param array $params Parameters - * - * @return EmojiKeywordsDifference - */ - public function getEmojiKeywordsDifference($params); - - /** - * Get info about an emoji keyword localization. - * - * Parameters: - * * `[string]` **lang_codes** - Language codes - * - * @param array $params Parameters - * - * @return of EmojiLanguage[] - */ - public function getEmojiKeywordsLanguages($params); - - /** - * Returns an HTTP URL which can be used to automatically log in into translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation. - * - * Parameters: - * * `string` **lang_code** - Language code for which the emoji replacements will be suggested - * - * @param array $params Parameters - * - * @return EmojiURL - */ - public function getEmojiURL($params); - - /** - * Get the number of results that would be found by a [messages.search](https://docs.madelineproto.xyz/API_docs/methods/messages.search.html) call with the same parameters. - * - * Parameters: - * * `InputPeer` **peer** - Peer where to search - * * `int` **top_msg_id** - Optional: - * * `[MessagesFilter]` **filters** - Search filters - * - * @param array $params Parameters - * - * @return of messages.SearchCounter[] - */ - public function getSearchCounters($params); - - /** - * Get more info about a Seamless Telegram Login authorization request, for more info [click here »](https://core.telegram.org/api/url-authorization). - * - * Parameters: - * * `InputPeer` **peer** - Optional: Peer where the message is located - * * `int` **msg_id** - Optional: The message - * * `int` **button_id** - Optional: The ID of the button with the authorization request - * * `string` **url** - Optional: URL used for [link URL authorization, click here for more info »](https://core.telegram.org/api/url-authorization#link-url-authorization) - * - * @param array $params Parameters - * - * @return UrlAuthResult - */ - public function requestUrlAuth($params); - - /** - * Use this to accept a Seamless Telegram Login authorization request, for more info [click here »](https://core.telegram.org/api/url-authorization). - * - * Parameters: - * * `boolean` **write_allowed** - Optional: Set this flag to allow the bot to send messages to you (if requested) - * * `InputPeer` **peer** - Optional: The location of the message - * * `int` **msg_id** - Optional: Message ID of the message with the login button - * * `int` **button_id** - Optional: ID of the login button - * * `string` **url** - Optional: URL used for [link URL authorization, click here for more info »](https://core.telegram.org/api/url-authorization#link-url-authorization) - * - * @param array $params Parameters - * - * @return UrlAuthResult - */ - public function acceptUrlAuth($params); - - /** - * Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the [peer's settings](https://docs.madelineproto.xyz/API_docs/constructors/peerSettings.html). - * - * Parameters: - * * `InputPeer` **peer** - Peer - * - * @param array $params Parameters - * - * @return bool - */ - public function hidePeerSettingsBar($params); - - /** - * Get scheduled messages. - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function getScheduledHistory($params); - - /** - * Get scheduled messages. - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `[int]` **id** - IDs of scheduled messages - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function getScheduledMessages($params); - - /** - * Send scheduled messages right away. - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `[int]` **id** - Scheduled message IDs - * - * @param array $params Parameters - * - * @return Updates - */ - public function sendScheduledMessages($params); - - /** - * Delete scheduled messages. - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `[int]` **id** - Scheduled message IDs - * - * @param array $params Parameters - * - * @return Updates - */ - public function deleteScheduledMessages($params); - - /** - * Get poll results for non-anonymous polls. - * - * Parameters: - * * `InputPeer` **peer** - Chat where the poll was sent - * * `int` **id** - Message ID - * * `bytes` **option** - Optional: Get only results for the specified poll `option` - * * `string` **offset** - Optional: Offset for results, taken from the `next_offset` field of [messages.votesList](https://docs.madelineproto.xyz/API_docs/constructors/messages.votesList.html), initially an empty string.
Note: if no more results are available, the method call will return an empty `next_offset`; thus, avoid providing the `next_offset` returned in [messages.votesList](https://docs.madelineproto.xyz/API_docs/constructors/messages.votesList.html) if it is empty, to avoid an infinite loop. - * * `int` **limit** - Number of results to return - * - * @param array $params Parameters - * - * @return messages.VotesList - */ - public function getPollVotes($params); - - /** - * Apply changes to multiple stickersets. - * - * Parameters: - * * `boolean` **uninstall** - Optional: Uninstall the specified stickersets - * * `boolean` **archive** - Optional: Archive the specified stickersets - * * `boolean` **unarchive** - Optional: Unarchive the specified stickersets - * * `[InputStickerSet]` **stickersets** - Stickersets to act upon - * - * @param array $params Parameters - * - * @return bool - */ - public function toggleStickerSets($params); - - /** - * Get [folders](https://core.telegram.org/api/folders). - * - * @return of DialogFilter[] - */ - public function getDialogFilters(); - - /** - * Get [suggested folders](https://core.telegram.org/api/folders). - * - * @return of DialogFilterSuggested[] - */ - public function getSuggestedDialogFilters(); - - /** - * Update [folder](https://core.telegram.org/api/folders). - * - * Parameters: - * * `int` **id** - [Folder](https://core.telegram.org/api/folders) ID - * * `DialogFilter` **filter** - Optional: [Folder](https://core.telegram.org/api/folders) info - * - * @param array $params Parameters - * - * @return bool - */ - public function updateDialogFilter($params); - - /** - * Reorder [folders](https://core.telegram.org/api/folders). - * - * Parameters: - * * `[int]` **order** - New [folder](https://core.telegram.org/api/folders) order - * - * @param array $params Parameters - * - * @return bool - */ - public function updateDialogFiltersOrder($params); - - /** - * Method for fetching previously featured stickers. - * - * Parameters: - * * `int` **offset** - Offset - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.FeaturedStickers - */ - public function getOldFeaturedStickers($params); - - /** - * Get messages in a reply thread. - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `int` **msg_id** - Message ID - * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **offset_date** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **add_offset** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * * `int` **max_id** - If a positive value was transferred, the method will return only messages with ID smaller than max\_id - * * `int` **min_id** - If a positive value was transferred, the method will return only messages with ID bigger than min\_id - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function getReplies($params); - - /** - * Get [discussion message](https://core.telegram.org/api/threads) from the [associated discussion group](https://core.telegram.org/api/discussion) of a channel to show it on top of the comment section, without actually joining the group. - * - * Parameters: - * * `InputPeer` **peer** - [Channel ID](https://core.telegram.org/api/channel) - * * `int` **msg_id** - Message ID - * - * @param array $params Parameters - * - * @return messages.DiscussionMessage - */ - public function getDiscussionMessage($params); - - /** - * Mark a [thread](https://core.telegram.org/api/threads) as read. - * - * Parameters: - * * `InputPeer` **peer** - Group ID - * * `int` **msg_id** - ID of message that started the thread - * * `int` **read_max_id** - ID up to which thread messages were read - * - * @param array $params Parameters - * - * @return bool - */ - public function readDiscussion($params); - - /** - * [Unpin](https://core.telegram.org/api/pin) all pinned messages. - * - * Parameters: - * * `InputPeer` **peer** - Chat where to unpin - * * `int` **top_msg_id** - Optional: - * - * @param array $params Parameters - * - * @return messages.AffectedHistory - */ - public function unpinAllMessages($params); - - /** - * Delete a [chat](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputPeer` **chat_id** - - * - * @param array $params Parameters - * - * @return bool - */ - public function deleteChat($params); - - /** - * Delete the entire phone call history. - * - * Parameters: - * * `boolean` **revoke** - Optional: Whether to remove phone call history for participants as well - * - * @param array $params Parameters - * - * @return messages.AffectedFoundMessages - */ - public function deletePhoneCallHistory($params); - - /** - * Obtains information about a chat export file, generated by a foreign chat app, [click here for more info about imported chats »](https://core.telegram.org/api/import). - * - * Parameters: - * * `string` **import_head** - Beginning of the message file; up to 100 lines. - * - * @param array $params Parameters - * - * @return messages.HistoryImportParsed - */ - public function checkHistoryImport($params); - - /** - * Import chat history from a foreign chat app into a specific Telegram chat, [click here for more info about imported chats »](https://core.telegram.org/api/import). - * - * Parameters: - * * `InputPeer` **peer** - The Telegram chat where the [history should be imported](https://core.telegram.org/api/import). - * * `InputFile` **file** - File with messages to import. - * * `int` **media_count** - Number of media files associated with the chat that will be uploaded using [messages.uploadImportedMedia](https://docs.madelineproto.xyz/API_docs/methods/messages.uploadImportedMedia.html). - * - * @param array $params Parameters - * - * @return messages.HistoryImport - */ - public function initHistoryImport($params); - - /** - * Upload a media file associated with an [imported chat, click here for more info »](https://core.telegram.org/api/import). - * - * Parameters: - * * `InputPeer` **peer** - The Telegram chat where the media will be imported - * * `long` **import_id** - Identifier of a [history import session](https://core.telegram.org/api/import), returned by [messages.initHistoryImport](https://docs.madelineproto.xyz/API_docs/methods/messages.initHistoryImport.html) - * * `string` **file_name** - File name - * * `InputMedia` **media** - Media metadata - * - * @param array $params Parameters - * - * @return MessageMedia - */ - public function uploadImportedMedia($params); - - /** - * Complete the [history import process](https://core.telegram.org/api/import), importing all messages into the chat. - * To be called only after initializing the import with [messages.initHistoryImport](https://docs.madelineproto.xyz/API_docs/methods/messages.initHistoryImport.html) and uploading all files using [messages.uploadImportedMedia](https://docs.madelineproto.xyz/API_docs/methods/messages.uploadImportedMedia.html). - * - * Parameters: - * * `InputPeer` **peer** - The Telegram chat where the messages should be [imported, click here for more info »](https://core.telegram.org/api/import) - * * `long` **import_id** - Identifier of a history import session, returned by [messages.initHistoryImport](https://docs.madelineproto.xyz/API_docs/methods/messages.initHistoryImport.html). - * - * @param array $params Parameters - * - * @return bool - */ - public function startHistoryImport($params); - - /** - * Get info about the chat invites of a specific chat. - * - * Parameters: - * * `boolean` **revoked** - Optional: Whether to fetch revoked chat invites - * * `InputPeer` **peer** - Chat - * * `InputUser` **admin_id** - Whether to only fetch chat invites from this admin - * * `int` **offset_date** - Optional: [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `string` **offset_link** - Optional: [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.ExportedChatInvites - */ - public function getExportedChatInvites($params); - - /** - * Get info about a chat invite. - * - * Parameters: - * * `InputPeer` **peer** - Chat - * * `string` **link** - Invite link - * - * @param array $params Parameters - * - * @return messages.ExportedChatInvite - */ - public function getExportedChatInvite($params); - - /** - * Edit an exported chat invite. - * - * Parameters: - * * `boolean` **revoked** - Optional: Whether to revoke the chat invite - * * `InputPeer` **peer** - Chat - * * `string` **link** - Invite link - * * `int` **expire_date** - Optional: New expiration date - * * `int` **usage_limit** - Optional: Maximum number of users that can join using this link - * * `Bool` **request_needed** - Optional: Whether admin confirmation is required before admitting each separate user into the chat - * * `string` **title** - Optional: Description of the invite link, visible only to administrators - * - * @param array $params Parameters - * - * @return messages.ExportedChatInvite - */ - public function editExportedChatInvite($params); - - /** - * Delete all revoked chat invites. - * - * Parameters: - * * `InputPeer` **peer** - Chat - * * `InputUser` **admin_id** - ID of the admin that originally generated the revoked chat invites - * - * @param array $params Parameters - * - * @return bool - */ - public function deleteRevokedExportedChatInvites($params); - - /** - * Delete a chat invite. - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `string` **link** - Invite link - * - * @param array $params Parameters - * - * @return bool - */ - public function deleteExportedChatInvite($params); - - /** - * Get info about chat invites generated by admins. - * - * Parameters: - * * `InputPeer` **peer** - Chat - * - * @param array $params Parameters - * - * @return messages.ChatAdminsWithInvites - */ - public function getAdminsWithInvites($params); - - /** - * Get info about the users that joined the chat using a specific chat invite. - * - * Parameters: - * * `boolean` **requested** - Optional: If set, only returns info about users with pending [join requests »](https://core.telegram.org/api/invites#join-requests) - * * `InputPeer` **peer** - Chat - * * `string` **link** - Optional: Invite link - * * `string` **q** - Optional: Search for a user in the pending [join requests »](https://core.telegram.org/api/invites#join-requests) list: only available when the `requested` flag is set, cannot be used together with a specific `link`. - * * `int` **offset_date** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `InputUser` **offset_user** - User ID for [pagination](https://core.telegram.org/api/offsets) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.ChatInviteImporters - */ - public function getChatInviteImporters($params); - - /** - * Set maximum Time-To-Live of all messages in the specified chat. - * - * Parameters: - * * `InputPeer` **peer** - The dialog - * * `int` **period** - Automatically delete all messages sent in the chat after this many seconds - * - * @param array $params Parameters - * - * @return Updates - */ - public function setHistoryTTL($params); - - /** - * Check whether chat history exported from another chat app can be [imported into a specific Telegram chat, click here for more info »](https://core.telegram.org/api/import). - * - * If the check succeeds, and no RPC errors are returned, a [messages.CheckedHistoryImportPeer](https://docs.madelineproto.xyz/API_docs/types/messages.CheckedHistoryImportPeer.html) constructor will be returned, with a confirmation text to be shown to the user, before actually initializing the import. - * - * Parameters: - * * `InputPeer` **peer** - The chat where we want to [import history »](https://core.telegram.org/api/import). - * - * @param array $params Parameters - * - * @return messages.CheckedHistoryImportPeer - */ - public function checkHistoryImportPeer($params); - - /** - * Change the chat theme of a certain chat. - * - * Parameters: - * * `InputPeer` **peer** - Private chat where to change theme - * * `string` **emoticon** - Emoji, identifying a specific chat theme; a list of chat themes can be fetched using [account.getChatThemes](https://docs.madelineproto.xyz/API_docs/methods/account.getChatThemes.html) - * - * @param array $params Parameters - * - * @return Updates - */ - public function setChatTheme($params); - - /** - * Get which users read a specific message: only available for groups and supergroups with less than [`chat_read_mark_size_threshold` members](https://core.telegram.org/api/config#chat-read-mark-size-threshold), read receipts will be stored for [`chat_read_mark_expire_period` seconds after the message was sent](https://core.telegram.org/api/config#chat-read-mark-expire-period), see [client configuration for more info »](https://core.telegram.org/api/config#client-configuration). - * - * Parameters: - * * `InputPeer` **peer** - Dialog - * * `int` **msg_id** - Message ID - * - * @param array $params Parameters - * - * @return of long[] - */ - public function getMessageReadParticipants($params); - - /** - * Returns information about the next messages of the specified type in the chat split by days. - * - * Returns the results in reverse chronological order. - * Can return partial results for the last returned day. - * - * Parameters: - * * `InputPeer` **peer** - Peer where to search - * * `MessagesFilter` **filter** - Message filter, [inputMessagesFilterEmpty](https://docs.madelineproto.xyz/API_docs/constructors/inputMessagesFilterEmpty.html), [inputMessagesFilterMyMentions](https://docs.madelineproto.xyz/API_docs/constructors/inputMessagesFilterMyMentions.html) filters are not supported by this method. - * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **offset_date** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.SearchResultsCalendar - */ - public function getSearchResultsCalendar($params); - - /** - * Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. - * - * Returns the results in reverse chronological order (i.e., in order of decreasing message\_id). - * - * Parameters: - * * `InputPeer` **peer** - Peer where to search - * * `MessagesFilter` **filter** - Message filter, [inputMessagesFilterEmpty](https://docs.madelineproto.xyz/API_docs/constructors/inputMessagesFilterEmpty.html), [inputMessagesFilterMyMentions](https://docs.madelineproto.xyz/API_docs/constructors/inputMessagesFilterMyMentions.html) filters are not supported by this method. - * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.SearchResultsPositions - */ - public function getSearchResultsPositions($params); - - /** - * Dismiss or approve a chat [join request](https://core.telegram.org/api/invites#join-requests) related to a specific chat or channel. - * - * Parameters: - * * `boolean` **approved** - Optional: Whether to dismiss or approve the chat [join request »](https://core.telegram.org/api/invites#join-requests) - * * `InputPeer` **peer** - The chat or channel - * * `InputUser` **user_id** - The user whose [join request »](https://core.telegram.org/api/invites#join-requests) should be dismissed or approved - * - * @param array $params Parameters - * - * @return Updates - */ - public function hideChatJoinRequest($params); - - /** - * Dismiss or approve all [join requests](https://core.telegram.org/api/invites#join-requests) related to a specific chat or channel. - * - * Parameters: - * * `boolean` **approved** - Optional: Whether to dismiss or approve all chat [join requests »](https://core.telegram.org/api/invites#join-requests) - * * `InputPeer` **peer** - The chat or channel - * * `string` **link** - Optional: Only dismiss or approve [join requests »](https://core.telegram.org/api/invites#join-requests) initiated using this invite link - * - * @param array $params Parameters - * - * @return Updates - */ - public function hideAllChatJoinRequests($params); - - /** - * Enable or disable [content protection](https://telegram.org/blog/protected-content-delete-by-date-and-more) on a channel or chat. - * - * Parameters: - * * `InputPeer` **peer** - The chat or channel - * * `Bool` **enabled** - Enable or disable content protection - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleNoForwards($params); - - /** - * Change the default peer that should be used when sending messages to a specific group. - * - * Parameters: - * * `InputPeer` **peer** - Group - * * `InputPeer` **send_as** - The default peer that should be used when sending messages to the group - * - * @param array $params Parameters - * - * @return bool - */ - public function saveDefaultSendAs($params); - - /** - * React to message. - * - * Parameters: - * * `boolean` **big** - Optional: Whether a bigger and longer reaction should be shown - * * `boolean` **add_to_recent** - Optional: - * * `InputPeer` **peer** - Peer - * * `int` **msg_id** - Message ID to react to - * * `[Reaction]` **reaction** - Optional: - * - * @param array $params Parameters - * - * @return Updates - */ - public function sendReaction($params); - - /** - * Get [message reactions »](https://core.telegram.org/api/reactions). - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `[int]` **id** - Message IDs - * - * @param array $params Parameters - * - * @return Updates - */ - public function getMessagesReactions($params); - - /** - * Get [message reaction](https://core.telegram.org/api/reactions) list, along with the sender of each reaction. - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `int` **id** - Message ID - * * `Reaction` **reaction** - Optional: - * * `string` **offset** - Optional: Offset (typically taken from the `next_offset` field of the returned [messages.MessageReactionsList](https://docs.madelineproto.xyz/API_docs/types/messages.MessageReactionsList.html)) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.MessageReactionsList - */ - public function getMessageReactionsList($params); - - /** - * Change the set of [message reactions »](https://core.telegram.org/api/reactions) that can be used in a certain group, supergroup or channel. - * - * Parameters: - * * `InputPeer` **peer** - Group where to apply changes - * * `ChatReactions` **available_reactions** - - * - * @param array $params Parameters - * - * @return Updates - */ - public function setChatAvailableReactions($params); - - /** - * Obtain available [message reactions »](https://core.telegram.org/api/reactions). - * - * Parameters: - * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.AvailableReactions - */ - public function getAvailableReactions($params); - - /** - * Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using [help.getConfig, `reactions_default` field](https://docs.madelineproto.xyz/API_docs/methods/help.getConfig.html). - * - * Parameters: - * * `Reaction` **reaction** - - * - * @param array $params Parameters - * - * @return bool - */ - public function setDefaultReaction($params); - - /** - * Translate a given text. - * - * Parameters: - * * `InputPeer` **peer** - Optional: If the text is a chat message, the peer ID - * * `int` **msg_id** - Optional: If the text is a chat message, the message ID - * * `string` **text** - Optional: The text to translate - * * `string` **from_lang** - Optional: Two-letter ISO 639-1 language code of the language from which the message is translated, if not set will be autodetected - * * `string` **to_lang** - Two-letter ISO 639-1 language code of the language to which the message is translated - * - * @param array $params Parameters - * - * @return messages.TranslatedText - */ - public function translateText($params); - - /** - * Get unread reactions to messages you sent. - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `int` **top_msg_id** - Optional: - * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **add_offset** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * * `int` **max_id** - Only return reactions for messages up until this message ID - * * `int` **min_id** - Only return reactions for messages starting from this message ID - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function getUnreadReactions($params); - - /** - * Mark [message reactions »](https://core.telegram.org/api/reactions) as read. - * - * Parameters: - * * `InputPeer` **peer** - Peer - * * `int` **top_msg_id** - Optional: - * - * @param array $params Parameters - * - * @return messages.AffectedHistory - */ - public function readReactions($params); - - /** - * View and search recently sent media. - * This method does not support pagination. - * - * Parameters: - * * `string` **q** - Optional search query - * * `MessagesFilter` **filter** - Message filter - * * `int` **limit** - Maximum number of results to return (max 100). - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function searchSentMedia($params); - - /** - * Returns installed attachment menu [bot web apps »](https://core.telegram.org/api/bots/attach). - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return AttachMenuBots - */ - public function getAttachMenuBots($params); - - /** - * Returns attachment menu entry for a [bot web app that can be launched from the attachment menu »](https://core.telegram.org/api/bots/attach). - * - * Parameters: - * * `InputUser` **bot** - Bot ID - * - * @param array $params Parameters - * - * @return AttachMenuBotsBot - */ - public function getAttachMenuBot($params); - - /** - * Enable or disable [web bot attachment menu »](https://core.telegram.org/api/bots/attach). - * - * Parameters: - * * `boolean` **write_allowed** - Optional: - * * `InputUser` **bot** - Bot ID - * * `Bool` **enabled** - Toggle - * - * @param array $params Parameters - * - * @return bool - */ - public function toggleBotInAttachMenu($params); - - /** - * Open a [bot web app](https://core.telegram.org/bots/webapps), sending over user information after user confirmation. - * - * After calling this method, until the user closes the webview, [messages.prolongWebView](https://docs.madelineproto.xyz/API_docs/methods/messages.prolongWebView.html) must be called every 60 seconds. - * - * Parameters: - * * `boolean` **from_bot_menu** - Optional: Whether the webview was opened by clicking on the bot's [menu button »](https://core.telegram.org/api/bots/menu). - * * `boolean` **silent** - Optional: Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is [terminated](https://docs.madelineproto.xyz/API_docs/methods/messages.sendWebViewResultMessage.html) should be sent silently (no notifications for the receivers). - * * `InputPeer` **peer** - Dialog where the web app is being opened, and where the resulting message will be sent (see the [docs for more info »](https://core.telegram.org/api/bots/webapps)). - * * `InputUser` **bot** - Bot that owns the [web app](https://core.telegram.org/api/bots/webapps) - * * `string` **url** - Optional: [Web app URL](https://core.telegram.org/api/bots/webapps) - * * `string` **start_param** - Optional: If the web app was opened from the attachment menu using a [attachment menu deep link](https://core.telegram.org/api/links#bot-attachment-menu-links), `start_param` should contain the `data` from the `startattach` parameter. - * * `DataJSON` **theme_params** - Optional: Theme parameters for the web app - * * `string` **platform** - - * * `int` **reply_to_msg_id** - Optional: Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is [terminated](https://docs.madelineproto.xyz/API_docs/methods/messages.sendWebViewResultMessage.html) should be sent in reply to this message ID. - * * `int` **top_msg_id** - Optional: - * * `InputPeer` **send_as** - Optional: Open the web app as the specified peer, sending the resulting the message as the specified peer. - * - * @param array $params Parameters - * - * @return WebViewResult - */ - public function requestWebView($params); - - /** - * Indicate to the server (from the user side) that the user is still using a web app. - * - * Parameters: - * * `boolean` **silent** - Optional: Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is [terminated](https://docs.madelineproto.xyz/API_docs/methods/messages.sendWebViewResultMessage.html) should be sent silently (no notifications for the receivers). - * * `InputPeer` **peer** - Dialog where the web app was opened. - * * `InputUser` **bot** - Bot that owns the [web app](https://core.telegram.org/api/bots/webapps) - * * `long` **query_id** - Web app interaction ID obtained from [messages.requestWebView](https://docs.madelineproto.xyz/API_docs/methods/messages.requestWebView.html) - * * `int` **reply_to_msg_id** - Optional: Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is [terminated](https://docs.madelineproto.xyz/API_docs/methods/messages.sendWebViewResultMessage.html) should be sent in reply to this message ID. - * * `int` **top_msg_id** - Optional: - * * `InputPeer` **send_as** - Optional: Open the web app as the specified peer - * - * @param array $params Parameters - * - * @return bool - */ - public function prolongWebView($params); - - /** - * Open a [bot web app](https://core.telegram.org/api/bots/webapps). - * - * Parameters: - * * `InputUser` **bot** - Bot that owns the webapp - * * `string` **url** - Web app URL - * * `DataJSON` **theme_params** - Optional: Theme parameters - * * `string` **platform** - - * - * @param array $params Parameters - * - * @return SimpleWebViewResult - */ - public function requestSimpleWebView($params); - - /** - * Terminate webview interaction started with [messages.requestWebView](https://docs.madelineproto.xyz/API_docs/methods/messages.requestWebView.html), sending the specified message to the chat on behalf of the user. - * - * Parameters: - * * `string` **bot_query_id** - Webview interaction ID obtained from [messages.requestWebView](https://docs.madelineproto.xyz/API_docs/methods/messages.requestWebView.html) - * * `InputBotInlineResult` **result** - Message to send - * - * @param array $params Parameters - * - * @return WebViewMessageSent - */ - public function sendWebViewResultMessage($params); - - /** - * Used by the user to relay data from an opened [reply keyboard bot web app](https://core.telegram.org/api/bots/webapps) to the bot that owns it. - * - * Parameters: - * * `InputUser` **bot** - Bot that owns the web app - * * `string` **button_text** - Text of the [keyboardButtonSimpleWebView](https://docs.madelineproto.xyz/API_docs/constructors/keyboardButtonSimpleWebView.html) that was pressed to open the web app. - * * `string` **data** - Data to relay to the bot, obtained from a [`web_app_data_send` JS event](https://core.telegram.org/api/web-events#web-app-data-send). - * - * @param array $params Parameters - * - * @return Updates - */ - public function sendWebViewData($params); - - /** - * [Transcribe voice message](https://core.telegram.org/api/transcribe). - * - * Parameters: - * * `InputPeer` **peer** - Peer ID where the voice message was sent - * * `int` **msg_id** - Voice message ID - * - * @param array $params Parameters - * - * @return messages.TranscribedAudio - */ - public function transcribeAudio($params); - - /** - * Rate [transcribed voice message](https://core.telegram.org/api/transcribe). - * - * Parameters: - * * `InputPeer` **peer** - Peer where the voice message was sent - * * `int` **msg_id** - Message ID - * * `long` **transcription_id** - Transcription ID - * * `Bool` **good** - Whether the transcription was correct - * - * @param array $params Parameters - * - * @return bool - */ - public function rateTranscribedAudio($params); - - /** - * Fetch [custom emoji stickers »](https://core.telegram.org/api/custom-emoji). - * - * Returns a list of [documents](https://docs.madelineproto.xyz/API_docs/constructors/document.html) with the animated custom emoji in TGS format, and a [documentAttributeCustomEmoji](https://docs.madelineproto.xyz/API_docs/constructors/documentAttributeCustomEmoji.html) attribute with the original emoji and info about the emoji stickerset this custom emoji belongs to. - * - * Parameters: - * * `[long]` **document_id** - [Custom emoji](https://core.telegram.org/api/custom-emoji) IDs from a [messageEntityCustomEmoji](https://docs.madelineproto.xyz/API_docs/constructors/messageEntityCustomEmoji.html). - * - * @param array $params Parameters - * - * @return of Document[] - */ - public function getCustomEmojiDocuments($params); - - /** - * Gets the list of currently installed [custom emoji stickersets](https://core.telegram.org/api/custom-emoji). - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.AllStickers - */ - public function getEmojiStickers($params); - - /** - * Gets featured custom emoji stickersets. - * - * Parameters: - * * `long` **hash** - [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return messages.FeaturedStickers - */ - public function getFeaturedEmojiStickers($params); - - /** - * - * - * Parameters: - * * `InputPeer` **peer** - - * * `int` **id** - - * * `InputPeer` **reaction_peer** -. - * - * @param array $params Parameters - * - * @return bool - */ - public function reportReaction($params); - - /** - * - * - * Parameters: - * * `int` **limit** - - * * `long` **hash** -. - * - * @param array $params Parameters - * - * @return messages.Reactions - */ - public function getTopReactions($params); - - /** - * - * - * Parameters: - * * `int` **limit** - - * * `long` **hash** -. - * - * @param array $params Parameters - * - * @return messages.Reactions - */ - public function getRecentReactions($params); - - /** - * - * - * @return bool - */ - public function clearRecentReactions(); - - /** - * - * - * Parameters: - * * `InputPeer` **peer** - - * * `[int]` **id** -. - * - * @param array $params Parameters - * - * @return Updates - */ - public function getExtendedMedia($params); - - /** - * - * - * Parameters: - * * `int` **period** -. - * - * @param array $params Parameters - * - * @return bool - */ - public function setDefaultHistoryTTL($params); - - /** - * - * - * @return DefaultHistoryTTL - */ - public function getDefaultHistoryTTL(); -} - -interface updates -{ - /** - * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates. - * - * @return updates.State - */ - public function getState(); - - /** - * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates. - * - * Parameters: - * * `int` **pts** - PTS, see [updates](https://core.telegram.org/api/updates). - * * `int` **pts_total_limit** - Optional: For fast updating: if provided and `pts + pts_total_limit < remote pts`, [updates.differenceTooLong](https://docs.madelineproto.xyz/API_docs/constructors/updates.differenceTooLong.html) will be returned.
Simply tells the server to not return the difference if it is bigger than `pts_total_limit`
If the remote pts is too big (> ~4000000), this field will default to 1000000 - * * `int` **date** - date, see [updates](https://core.telegram.org/api/updates). - * * `int` **qts** - QTS, see [updates](https://core.telegram.org/api/updates). - * - * @param array $params Parameters - * - * @return updates.Difference - */ - public function getDifference($params); - - /** - * You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates. - * - * Parameters: - * * `boolean` **force** - Optional: Set to true to skip some possibly unneeded updates and reduce server-side load - * * `InputChannel` **channel** - The channel - * * `ChannelMessagesFilter` **filter** - Messsage filter - * * `int` **pts** - Persistent timestamp (see [updates](https://core.telegram.org/api/updates)) - * * `int` **limit** - How many updates to fetch, max `100000`
Ordinary (non-bot) users are supposed to pass `10-100` - * - * @param array $params Parameters - * - * @return updates.ChannelDifference - */ - public function getChannelDifference($params); -} - -interface photos -{ - /** - * Installs a previously uploaded photo as a profile photo. - * - * Parameters: - * * `boolean` **fallback** - Optional: - * * `InputPhoto` **id** - Input photo - * - * @param array $params Parameters - * - * @return photos.Photo - */ - public function updateProfilePhoto($params); - - /** - * Updates current user profile photo. - * - * Parameters: - * * `boolean` **fallback** - Optional: - * * `InputFile` **file** - Optional: File saved in parts by means of [upload.saveFilePart](https://docs.madelineproto.xyz/API_docs/methods/upload.saveFilePart.html) method - * * `InputFile` **video** - Optional: [Animated profile picture](https://core.telegram.org/api/files#animated-profile-pictures) video - * * `double` **video_start_ts** - Optional: Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. - * - * @param array $params Parameters - * - * @return photos.Photo - */ - public function uploadProfilePhoto($params); - - /** - * Deletes profile photos. The method returns a list of successfully deleted photo IDs. - * - * Parameters: - * * `[InputPhoto]` **id** - Input photos to delete - * - * @param array $params Parameters - * - * @return of long[] - */ - public function deletePhotos($params); - - /** - * Returns the list of user photos. - * - * Parameters: - * * `InputUser` **user_id** - User ID - * * `int` **offset** - Number of list elements to be skipped - * * `long` **max_id** - If a positive value was transferred, the method will return only photos with IDs less than the set one - * * `int` **limit** - Number of list elements to be returned - * - * @param array $params Parameters - * - * @return photos.Photos - */ - public function getUserPhotos($params); - - /** - * - * - * Parameters: - * * `boolean` **suggest** - Optional: - * * `boolean` **save** - Optional: - * * `InputUser` **user_id** - - * * `InputFile` **file** - Optional: - * * `InputFile` **video** - Optional: - * * `double` **video_start_ts** - Optional:. - * - * @param array $params Parameters - * - * @return photos.Photo - */ - public function uploadContactProfilePhoto($params); -} - -interface upload -{ - /** - * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info. - * - * Parameters: - * * `long` **file_id** - Random file identifier created by the client - * * `int` **file_part** - Numerical order of a part - * * `bytes` **bytes** - Binary data, contend of a part - * - * @param array $params Parameters - * - * @return bool - */ - public function saveFilePart($params); - - /** - * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info. - * - * Parameters: - * * `boolean` **precise** - Optional: Disable some checks on limit and offset values, useful for example to stream videos by keyframes - * * `boolean` **cdn_supported** - Optional: Whether the current client supports [CDN downloads](https://core.telegram.org/cdn) - * * `InputFileLocation` **location** - File location - * * `long` **offset** - Number of bytes to be skipped - * * `int` **limit** - Number of bytes to be returned - * - * @param array $params Parameters - * - * @return upload.File - */ - public function getFile($params); - - /** - * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info. - * - * Parameters: - * * `long` **file_id** - Random file id, created by the client - * * `int` **file_part** - Part sequence number - * * `int` **file_total_parts** - Total number of parts - * * `bytes` **bytes** - Binary data, part contents - * - * @param array $params Parameters - * - * @return bool - */ - public function saveBigFilePart($params); - - /** - * Returns content of a web file, by proxying the request through telegram, see the [webfile docs for more info](https://core.telegram.org/api/files#downloading-webfiles). - * - * **Note**: the query must be sent to the DC specified in the `webfile_dc_id` [MTProto configuration field](https://core.telegram.org/api/config#mtproto-configuration). - * - * Parameters: - * * `InputWebFileLocation` **location** - The file to download - * * `int` **offset** - Number of bytes to be skipped - * * `int` **limit** - Number of bytes to be returned - * - * @param array $params Parameters - * - * @return upload.WebFile - */ - public function getWebFile($params); - - /** - * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info. - * - * Parameters: - * * `bytes` **file_token** - File token - * * `long` **offset** - Offset of chunk to download - * * `int` **limit** - Length of chunk to download - * - * @param array $params Parameters - * - * @return upload.CdnFile - */ - public function getCdnFile($params); - - /** - * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info. - * - * Parameters: - * * `bytes` **file_token** - File token - * * `bytes` **request_token** - Request token - * - * @param array $params Parameters - * - * @return of FileHash[] - */ - public function reuploadCdnFile($params); - - /** - * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info. - * - * Parameters: - * * `bytes` **file_token** - File - * * `long` **offset** - Offset from which to start getting hashes - * - * @param array $params Parameters - * - * @return of FileHash[] - */ - public function getCdnFileHashes($params); - - /** - * You cannot use this method directly, use the upload, downloadToStream, downloadToFile, downloadToDir methods instead; see https://docs.madelineproto.xyz for more info. - * - * Parameters: - * * `InputFileLocation` **location** - File - * * `long` **offset** - Offset from which to get file hashes - * - * @param array $params Parameters - * - * @return of FileHash[] - */ - public function getFileHashes($params); -} - -interface help -{ - /** - * Returns current configuration, including data center configuration. - * - * @return Config - */ - public function getConfig(); - - /** - * Returns info on data center nearest to the user. - * - * @return NearestDc - */ - public function getNearestDc(); - - /** - * Returns information on update availability for the current application. - * - * Parameters: - * * `string` **source** - Source - * - * @param array $params Parameters - * - * @return help.AppUpdate - */ - public function getAppUpdate($params); - - /** - * Returns localized text of a text message with an invitation. - * - * @return help.InviteText - */ - public function getInviteText(); - - /** - * Returns the support user for the "ask a question" feature. - * - * @return help.Support - */ - public function getSupport(); - - /** - * Get changelog of current app. - * Typically, an [updates](https://docs.madelineproto.xyz/API_docs/constructors/updates.html) constructor will be returned, containing one or more [updateServiceNotification](https://docs.madelineproto.xyz/API_docs/constructors/updateServiceNotification.html) updates with app-specific changelogs. - * - * Parameters: - * * `string` **prev_app_version** - Previous app version - * - * @param array $params Parameters - * - * @return Updates - */ - public function getAppChangelog($params); - - /** - * Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only. - * - * Parameters: - * * `int` **pending_updates_count** - Number of pending updates - * * `string` **message** - Error message, if present - * - * @param array $params Parameters - * - * @return bool - */ - public function setBotUpdatesStatus($params); - - /** - * Get configuration for [CDN](https://core.telegram.org/cdn) file downloads. - * - * @return CdnConfig - */ - public function getCdnConfig(); - - /** - * Get recently used `t.me` links. - * - * When installing official applications from "Download Telegram" buttons present in [t.me](https://t.me) pages, a referral parameter is passed to applications after installation. - * If, after downloading the application, the user creates a new account (instead of logging into an existing one), the referral parameter should be imported using this method, which returns the [t.me](https://t.me) pages the user recently opened, before installing Telegram. - * - * Parameters: - * * `string` **referer** - Referrer - * - * @param array $params Parameters - * - * @return help.RecentMeUrls - */ - public function getRecentMeUrls($params); - - /** - * Look for updates of telegram's terms of service. - * - * @return help.TermsOfServiceUpdate - */ - public function getTermsOfServiceUpdate(); - - /** - * Accept the new terms of service. - * - * Parameters: - * * `DataJSON` **id** - ID of terms of service - * - * @param array $params Parameters - * - * @return bool - */ - public function acceptTermsOfService($params); - - /** - * Get info about an unsupported deep link, see [here for more info »](https://core.telegram.org/api/links#unsupported-links). - * - * Parameters: - * * `string` **path** - Path component of a `tg:` link - * - * @param array $params Parameters - * - * @return help.DeepLinkInfo - */ - public function getDeepLinkInfo($params); - - /** - * Get app-specific configuration, see [client configuration](https://core.telegram.org/api/config#client-configuration) for more info on the result. - * - * @return JSONValue - */ - public function getAppConfig(); - - /** - * Saves logs of application on the server. - * - * Parameters: - * * `[InputAppEvent]` **events** - List of input events - * - * @param array $params Parameters - * - * @return bool - */ - public function saveAppLog($params); - - /** - * Get [passport](https://core.telegram.org/passport) configuration. - * - * Parameters: - * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return help.PassportConfig - */ - public function getPassportConfig($params); - - /** - * Get localized name of the telegram support user. - * - * @return help.SupportName - */ - public function getSupportName(); - - /** - * Internal use. - * - * Parameters: - * * `InputUser` **user_id** - User ID - * - * @param array $params Parameters - * - * @return help.UserInfo - */ - public function getUserInfo($params); - - /** - * Internal use. - * - * Parameters: - * * `InputUser` **user_id** - User - * * `string` **message** - Message - * * `[MessageEntity]` **entities** - [Message entities for styled text](https://core.telegram.org/api/entities) - * - * @param array $params Parameters - * - * @return help.UserInfo - */ - public function editUserInfo($params); - - /** - * Get MTProxy/Public Service Announcement information. - * - * @return help.PromoData - */ - public function getPromoData(); - - /** - * Hide MTProxy/Public Service Announcement information. - * - * Parameters: - * * `InputPeer` **peer** - Peer to hide - * - * @param array $params Parameters - * - * @return bool - */ - public function hidePromoData($params); - - /** - * Dismiss a [suggestion, see here for more info »](https://core.telegram.org/api/config#suggestions). - * - * Parameters: - * * `InputPeer` **peer** - In the case of pending suggestions in [channels](https://docs.madelineproto.xyz/API_docs/constructors/channelFull.html), the channel ID. - * * `string` **suggestion** - [Suggestion, see here for more info »](https://core.telegram.org/api/config#suggestions). - * - * @param array $params Parameters - * - * @return bool - */ - public function dismissSuggestion($params); - - /** - * Get name, ISO code, localized name and phone codes/patterns of all available countries. - * - * Parameters: - * * `string` **lang_code** - Language code of the current user - * * `[int]` **hash** - Optional: [Hash for pagination, for more info click here](https://core.telegram.org/api/offsets#hash-generation) - * - * @param array $params Parameters - * - * @return help.CountriesList - */ - public function getCountriesList($params); - - /** - * Get Telegram Premium promotion information. - * - * @return help.PremiumPromo - */ - public function getPremiumPromo(); -} - -interface channels -{ - /** - * Mark [channel/supergroup](https://core.telegram.org/api/channel) history as read. - * - * Parameters: - * * `InputChannel` **channel** - [Channel/supergroup](https://core.telegram.org/api/channel) - * * `int` **max_id** - ID of message up to which messages should be marked as read - * - * @param array $params Parameters - * - * @return bool - */ - public function readHistory($params); - - /** - * Delete messages in a [channel/supergroup](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputChannel` **channel** - [Channel/supergroup](https://core.telegram.org/api/channel) - * * `[int]` **id** - IDs of messages to delete - * - * @param array $params Parameters - * - * @return messages.AffectedMessages - */ - public function deleteMessages($params); - - /** - * Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup. - * - * Parameters: - * * `InputChannel` **channel** - Supergroup - * * `InputPeer` **participant** - Participant whose messages should be reported - * * `[int]` **id** - IDs of spam messages - * - * @param array $params Parameters - * - * @return bool - */ - public function reportSpam($params); - - /** - * Please use the [event handler](https://docs.madelineproto.xyz/docs/UPDATES.html). - * - * Parameters: - * * `InputChannel` **channel** - Channel/supergroup - * * `[InputMessage]` **id** - IDs of messages to get - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function getMessages($params); - - /** - * Get the participants of a [supergroup/channel](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputChannel` **channel** - Channel - * * `ChannelParticipantsFilter` **filter** - Which participant types to fetch - * * `int` **offset** - [Offset](https://core.telegram.org/api/offsets) - * * `int` **limit** - [Limit](https://core.telegram.org/api/offsets) - * * `long` **hash** - [Hash](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return channels.ChannelParticipants - */ - public function getParticipants($params); - - /** - * Get info about a [channel/supergroup](https://core.telegram.org/api/channel) participant. - * - * Parameters: - * * `InputChannel` **channel** - Channel/supergroup - * * `InputPeer` **participant** - Participant to get info about - * - * @param array $params Parameters - * - * @return channels.ChannelParticipant - */ - public function getParticipant($params); - - /** - * You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info). - * - * Parameters: - * * `[InputChannel]` **id** - IDs of channels/supergroups to get info about - * - * @param array $params Parameters - * - * @return messages.Chats - */ - public function getChannels($params); - - /** - * You cannot use this method directly, use the getPwrChat, getInfo, getFullInfo methods instead (see https://docs.madelineproto.xyz for more info). - * - * Parameters: - * * `InputChannel` **channel** - The [channel](https://core.telegram.org/api/channel#channels), [supergroup](https://core.telegram.org/api/channel#supergroups) or [gigagroup](https://core.telegram.org/api/channel#gigagroups) to get info about - * - * @param array $params Parameters - * - * @return messages.ChatFull - */ - public function getFullChannel($params); - - /** - * Create a [supergroup/channel](https://core.telegram.org/api/channel). - * - * Parameters: - * * `boolean` **broadcast** - Optional: Whether to create a [channel](https://core.telegram.org/api/channel) - * * `boolean` **megagroup** - Optional: Whether to create a [supergroup](https://core.telegram.org/api/channel) - * * `boolean` **for_import** - Optional: Whether the supergroup is being created to import messages from a foreign chat service using [messages.initHistoryImport](https://docs.madelineproto.xyz/API_docs/methods/messages.initHistoryImport.html) - * * `string` **title** - Channel title - * * `string` **about** - Channel description - * * `InputGeoPoint` **geo_point** - Optional: Geogroup location - * * `string` **address** - Optional: Geogroup address - * * `int` **ttl_period** - Optional: - * - * @param array $params Parameters - * - * @return Updates - */ - public function createChannel($params); - - /** - * Modify the admin rights of a user in a [supergroup/channel](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputChannel` **channel** - The [supergroup/channel](https://core.telegram.org/api/channel). - * * `InputUser` **user_id** - The ID of the user whose admin rights should be modified - * * `ChatAdminRights` **admin_rights** - The admin rights - * * `string` **rank** - Indicates the role (rank) of the admin in the group: just an arbitrary string - * - * @param array $params Parameters - * - * @return Updates - */ - public function editAdmin($params); - - /** - * Edit the name of a [channel/supergroup](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputChannel` **channel** - Channel/supergroup - * * `string` **title** - New name - * - * @param array $params Parameters - * - * @return Updates - */ - public function editTitle($params); - - /** - * Change the photo of a [channel/supergroup](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputChannel` **channel** - Channel/supergroup whose photo should be edited - * * `InputChatPhoto` **photo** - New photo - * - * @param array $params Parameters - * - * @return Updates - */ - public function editPhoto($params); - - /** - * Check if a username is free and can be assigned to a channel/supergroup. - * - * Parameters: - * * `InputChannel` **channel** - The [channel/supergroup](https://core.telegram.org/api/channel) that will assigned the specified username - * * `string` **username** - The username to check - * - * @param array $params Parameters - * - * @return bool - */ - public function checkUsername($params); - - /** - * Change the username of a supergroup/channel. - * - * Parameters: - * * `InputChannel` **channel** - Channel - * * `string` **username** - New username - * - * @param array $params Parameters - * - * @return bool - */ - public function updateUsername($params); - - /** - * Join a channel/supergroup. - * - * Parameters: - * * `InputChannel` **channel** - Channel/supergroup to join - * - * @param array $params Parameters - * - * @return Updates - */ - public function joinChannel($params); - - /** - * Leave a [channel/supergroup](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputChannel` **channel** - [Channel/supergroup](https://core.telegram.org/api/channel) to leave - * - * @param array $params Parameters - * - * @return Updates - */ - public function leaveChannel($params); - - /** - * Invite users to a channel/supergroup. - * - * Parameters: - * * `InputChannel` **channel** - Channel/supergroup - * * `[InputUser]` **users** - Users to invite - * - * @param array $params Parameters - * - * @return Updates - */ - public function inviteToChannel($params); - - /** - * Delete a [channel/supergroup](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputChannel` **channel** - [Channel/supergroup](https://core.telegram.org/api/channel) to delete - * - * @param array $params Parameters - * - * @return Updates - */ - public function deleteChannel($params); - - /** - * Get link and embed info of a message in a [channel/supergroup](https://core.telegram.org/api/channel). - * - * Parameters: - * * `boolean` **grouped** - Optional: Whether to include other grouped media (for albums) - * * `boolean` **thread** - Optional: Whether to also include a thread ID, if available, inside of the link - * * `InputChannel` **channel** - Channel - * * `int` **id** - Message ID - * - * @param array $params Parameters - * - * @return ExportedMessageLink - */ - public function exportMessageLink($params); - - /** - * Enable/disable message signatures in channels. - * - * Parameters: - * * `InputChannel` **channel** - Channel - * * `Bool` **enabled** - Value - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleSignatures($params); - - /** - * Get [channels/supergroups/geogroups](https://core.telegram.org/api/channel) we're admin in. Usually called when the user exceeds the [limit](https://docs.madelineproto.xyz/API_docs/constructors/config.html) for owned public [channels/supergroups/geogroups](https://core.telegram.org/api/channel), and the user is given the choice to remove one of his channels/supergroups/geogroups. - * - * Parameters: - * * `boolean` **by_location** - Optional: Get geogroups - * * `boolean` **check_limit** - Optional: If set and the user has reached the limit of owned public [channels/supergroups/geogroups](https://core.telegram.org/api/channel), instead of returning the channel list one of the specified [errors](#possible-errors) will be returned.
Useful to check if a new public channel can indeed be created, even before asking the user to enter a channel username to use in [channels.checkUsername](https://docs.madelineproto.xyz/API_docs/methods/channels.checkUsername.html)/[channels.updateUsername](https://docs.madelineproto.xyz/API_docs/methods/channels.updateUsername.html). - * - * @param array $params Parameters - * - * @return messages.Chats - */ - public function getAdminedPublicChannels($params); - - /** - * Ban/unban/kick a user in a [supergroup/channel](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputChannel` **channel** - The [supergroup/channel](https://core.telegram.org/api/channel). - * * `InputPeer` **participant** - Participant to ban - * * `ChatBannedRights` **banned_rights** - The banned rights - * - * @param array $params Parameters - * - * @return Updates - */ - public function editBanned($params); - - /** - * Get the admin log of a [channel/supergroup](https://core.telegram.org/api/channel). - * - * Parameters: - * * `InputChannel` **channel** - Channel - * * `string` **q** - Search query, can be empty - * * `ChannelAdminLogEventsFilter` **events_filter** - Optional: Event filter - * * `[InputUser]` **admins** - Optional: Only show events from these admins - * * `long` **max_id** - Maximum ID of message to return (see [pagination](https://core.telegram.org/api/offsets)) - * * `long` **min_id** - Minimum ID of message to return (see [pagination](https://core.telegram.org/api/offsets)) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return channels.AdminLogResults - */ - public function getAdminLog($params); - - /** - * Associate a stickerset to the supergroup. - * - * Parameters: - * * `InputChannel` **channel** - Supergroup - * * `InputStickerSet` **stickerset** - The stickerset to associate - * - * @param array $params Parameters - * - * @return bool - */ - public function setStickers($params); - - /** - * Mark [channel/supergroup](https://core.telegram.org/api/channel) message contents as read. - * - * Parameters: - * * `InputChannel` **channel** - [Channel/supergroup](https://core.telegram.org/api/channel) - * * `[int]` **id** - IDs of messages whose contents should be marked as read - * - * @param array $params Parameters - * - * @return bool - */ - public function readMessageContents($params); - - /** - * Delete the history of a [supergroup](https://core.telegram.org/api/channel). - * - * Parameters: - * * `boolean` **for_everyone** - Optional: Whether the history should be deleted for everyone - * * `InputChannel` **channel** - [Supergroup](https://core.telegram.org/api/channel) whose history must be deleted - * * `int` **max_id** - ID of message **up to which** the history must be deleted - * - * @param array $params Parameters - * - * @return Updates - */ - public function deleteHistory($params); - - /** - * Hide/unhide message history for new channel/supergroup users. - * - * Parameters: - * * `InputChannel` **channel** - Channel/supergroup - * * `Bool` **enabled** - Hide/unhide - * - * @param array $params Parameters - * - * @return Updates - */ - public function togglePreHistoryHidden($params); - - /** - * Get a list of [channels/supergroups](https://core.telegram.org/api/channel) we left. - * - * Parameters: - * * `int` **offset** - Offset for [pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.Chats - */ - public function getLeftChannels($params); - - /** - * Get all groups that can be used as [discussion groups](https://core.telegram.org/api/discussion). - * - * Returned [basic group chats](https://core.telegram.org/api/channel#basic-groups) must be first upgraded to [supergroups](https://core.telegram.org/api/channel#supergroups) before they can be set as a discussion group. - * To set a returned supergroup as a discussion group, access to its old messages must be enabled using [channels.togglePreHistoryHidden](https://docs.madelineproto.xyz/API_docs/methods/channels.togglePreHistoryHidden.html), first. - * - * @return messages.Chats - */ - public function getGroupsForDiscussion(); - - /** - * Associate a group to a channel as [discussion group](https://core.telegram.org/api/discussion) for that channel. - * - * Parameters: - * * `InputChannel` **broadcast** - Channel - * * `InputChannel` **group** - [Discussion group](https://core.telegram.org/api/discussion) to associate to the channel - * - * @param array $params Parameters - * - * @return bool - */ - public function setDiscussionGroup($params); - - /** - * Transfer channel ownership. - * - * Parameters: - * * `InputChannel` **channel** - Channel - * * `InputUser` **user_id** - New channel owner - * * `InputCheckPasswordSRP` **password** - [2FA password](https://core.telegram.org/api/srp) of account - * - * @param array $params Parameters - * - * @return Updates - */ - public function editCreator($params); - - /** - * Edit location of geogroup. - * - * Parameters: - * * `InputChannel` **channel** - [Geogroup](https://core.telegram.org/api/channel) - * * `InputGeoPoint` **geo_point** - New geolocation - * * `string` **address** - Address string - * - * @param array $params Parameters - * - * @return bool - */ - public function editLocation($params); - - /** - * Toggle supergroup slow mode: if enabled, users will only be able to send one message every `seconds` seconds. - * - * Parameters: - * * `InputChannel` **channel** - The [supergroup](https://core.telegram.org/api/channel) - * * `int` **seconds** - Users will only be able to send one message every `seconds` seconds, `0` to disable the limitation - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleSlowMode($params); - - /** - * Get inactive channels and supergroups. - * - * @return messages.InactiveChats - */ - public function getInactiveChannels(); - - /** - * Convert a [supergroup](https://core.telegram.org/api/channel) to a [gigagroup](https://core.telegram.org/api/channel), when requested by [channel suggestions](https://core.telegram.org/api/config#channel-suggestions). - * - * Parameters: - * * `InputChannel` **channel** - The [supergroup](https://core.telegram.org/api/channel) to convert - * - * @param array $params Parameters - * - * @return Updates - */ - public function convertToGigagroup($params); - - /** - * Mark a specific sponsored message as read. - * - * Parameters: - * * `InputChannel` **channel** - Peer - * - * @param array $params Parameters - * - * @return bool - */ - public function viewSponsoredMessage($params); - - /** - * Get a list of sponsored messages. - * - * Parameters: - * * `InputChannel` **channel** - Peer - * - * @param array $params Parameters - * - * @return messages.SponsoredMessages - */ - public function getSponsoredMessages($params); - - /** - * Obtains a list of peers that can be used to send messages in a specific group. - * - * Parameters: - * * `InputPeer` **peer** - The group where we intend to send messages - * - * @param array $params Parameters - * - * @return channels.SendAsPeers - */ - public function getSendAs($params); - - /** - * Delete all messages sent by a specific participant of a given supergroup. - * - * Parameters: - * * `InputChannel` **channel** - Supergroup - * * `InputPeer` **participant** - The participant whose messages should be deleted - * - * @param array $params Parameters - * - * @return messages.AffectedHistory - */ - public function deleteParticipantHistory($params); - - /** - * Set whether all users [should join a discussion group in order to comment on a post »](https://core.telegram.org/api/discussion#requiring-users-to-join-the-group). - * - * Parameters: - * * `InputChannel` **channel** - Discussion group - * * `Bool` **enabled** - Toggle - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleJoinToSend($params); - - /** - * Set whether all users should [request admin approval to join the group »](https://core.telegram.org/api/invites#join-requests). - * - * Parameters: - * * `InputChannel` **channel** - Group - * * `Bool` **enabled** - Toggle - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleJoinRequest($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `[string]` **order** -. - * - * @param array $params Parameters - * - * @return bool - */ - public function reorderUsernames($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `string` **username** - - * * `Bool` **active** -. - * - * @param array $params Parameters - * - * @return bool - */ - public function toggleUsername($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** -. - * - * @param array $params Parameters - * - * @return bool - */ - public function deactivateAllUsernames($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `Bool` **enabled** -. - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleForum($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `string` **title** - - * * `int` **icon_color** - Optional: - * * `long` **icon_emoji_id** - Optional: - * * `InputPeer` **send_as** - Optional:. - * - * @param array $params Parameters - * - * @return Updates - */ - public function createForumTopic($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `string` **q** - Optional: - * * `int` **offset_date** - - * * `int` **offset_id** - - * * `int` **offset_topic** - - * * `int` **limit** -. - * - * @param array $params Parameters - * - * @return messages.ForumTopics - */ - public function getForumTopics($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `[int]` **topics** -. - * - * @param array $params Parameters - * - * @return messages.ForumTopics - */ - public function getForumTopicsByID($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `int` **topic_id** - - * * `string` **title** - Optional: - * * `long` **icon_emoji_id** - Optional: - * * `Bool` **closed** - Optional: - * * `Bool` **hidden** - Optional:. - * - * @param array $params Parameters - * - * @return Updates - */ - public function editForumTopic($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `int` **topic_id** - - * * `Bool` **pinned** -. - * - * @param array $params Parameters - * - * @return Updates - */ - public function updatePinnedForumTopic($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `int` **top_msg_id** -. - * - * @param array $params Parameters - * - * @return messages.AffectedHistory - */ - public function deleteTopicHistory($params); - - /** - * - * - * Parameters: - * * `boolean` **force** - Optional: - * * `InputChannel` **channel** - - * * `[int]` **order** -. - * - * @param array $params Parameters - * - * @return Updates - */ - public function reorderPinnedForumTopics($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `Bool` **enabled** -. - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleAntiSpam($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `int` **msg_id** -. - * - * @param array $params Parameters - * - * @return bool - */ - public function reportAntiSpamFalsePositive($params); - - /** - * - * - * Parameters: - * * `InputChannel` **channel** - - * * `Bool` **enabled** -. - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleParticipantsHidden($params); -} - -interface bots -{ - /** - * Sends a custom request; for bots only. - * - * Parameters: - * * `string` **custom_method** - The method name - * * `DataJSON` **params** - JSON-serialized method parameters - * - * @param array $params Parameters - * - * @return DataJSON - */ - public function sendCustomRequest($params); - - /** - * Answers a custom query; for bots only. - * - * Parameters: - * * `long` **query_id** - Identifier of a custom query - * * `DataJSON` **data** - JSON-serialized answer to the query - * - * @param array $params Parameters - * - * @return bool - */ - public function answerWebhookJSONQuery($params); - - /** - * Set bot command list. - * - * Parameters: - * * `BotCommandScope` **scope** - Command scope - * * `string` **lang_code** - Language code - * * `[BotCommand]` **commands** - Bot commands - * - * @param array $params Parameters - * - * @return bool - */ - public function setBotCommands($params); - - /** - * Clear bot commands for the specified bot scope and language code. - * - * Parameters: - * * `BotCommandScope` **scope** - Command scope - * * `string` **lang_code** - Language code - * - * @param array $params Parameters - * - * @return bool - */ - public function resetBotCommands($params); - - /** - * Obtain a list of bot commands for the specified bot scope and language code. - * - * Parameters: - * * `BotCommandScope` **scope** - Command scope - * * `string` **lang_code** - Language code - * - * @param array $params Parameters - * - * @return of BotCommand[] - */ - public function getBotCommands($params); - - /** - * Sets the [menu button action »](https://core.telegram.org/api/bots/menu) for a given user or for all users. - * - * Parameters: - * * `InputUser` **user_id** - User ID - * * `BotMenuButton` **button** - Bot menu button action - * - * @param array $params Parameters - * - * @return bool - */ - public function setBotMenuButton($params); - - /** - * Gets the menu button action for a given user or for all users, previously set using [bots.setBotMenuButton](https://docs.madelineproto.xyz/API_docs/methods/bots.setBotMenuButton.html); users can see this information in the [botInfo](https://docs.madelineproto.xyz/API_docs/constructors/botInfo.html) constructor. - * - * Parameters: - * * `InputUser` **user_id** - User ID or empty for the default menu button. - * - * @param array $params Parameters - * - * @return BotMenuButton - */ - public function getBotMenuButton($params); - - /** - * Set the default [suggested admin rights](https://core.telegram.org/api/rights#suggested-bot-rights) for bots being added as admins to channels, see [here for more info on how to handle them »](https://core.telegram.org/api/rights#suggested-bot-rights). - * - * Parameters: - * * `ChatAdminRights` **admin_rights** - Admin rights - * - * @param array $params Parameters - * - * @return bool - */ - public function setBotBroadcastDefaultAdminRights($params); - - /** - * Set the default [suggested admin rights](https://core.telegram.org/api/rights#suggested-bot-rights) for bots being added as admins to groups, see [here for more info on how to handle them »](https://core.telegram.org/api/rights#suggested-bot-rights). - * - * Parameters: - * * `ChatAdminRights` **admin_rights** - Admin rights - * - * @param array $params Parameters - * - * @return bool - */ - public function setBotGroupDefaultAdminRights($params); -} - -interface payments -{ - /** - * Get a payment form. - * - * Parameters: - * * `InputInvoice` **invoice** - Invoice - * * `DataJSON` **theme_params** - Optional: A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
`bg_color` \- Background color
`text_color` \- Text color
`hint_color` \- Hint text color
`link_color` \- Link color
`button_color` \- Button color
`button_text_color` \- Button text color - * - * @param array $params Parameters - * - * @return payments.PaymentForm - */ - public function getPaymentForm($params); - - /** - * Get payment receipt. - * - * Parameters: - * * `InputPeer` **peer** - The peer where the payment receipt was sent - * * `int` **msg_id** - Message ID of receipt - * - * @param array $params Parameters - * - * @return payments.PaymentReceipt - */ - public function getPaymentReceipt($params); - - /** - * Submit requested order information for validation. - * - * Parameters: - * * `boolean` **save** - Optional: Save order information to re-use it for future orders - * * `InputInvoice` **invoice** - Invoice - * * `PaymentRequestedInfo` **info** - Requested order information - * - * @param array $params Parameters - * - * @return payments.ValidatedRequestedInfo - */ - public function validateRequestedInfo($params); - - /** - * Send compiled payment form. - * - * Parameters: - * * `long` **form_id** - Form ID - * * `InputInvoice` **invoice** - Invoice - * * `string` **requested_info_id** - Optional: ID of saved and validated [order info](https://docs.madelineproto.xyz/API_docs/constructors/payments.validatedRequestedInfo.html) - * * `string` **shipping_option_id** - Optional: Chosen shipping option ID - * * `InputPaymentCredentials` **credentials** - Payment credentials - * * `long` **tip_amount** - Optional: Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of `US$ 1.45` pass `amount = 145`. See the exp parameter in [currencies.json](https://core.telegram.org/bots/payments/currencies.json), it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - * - * @param array $params Parameters - * - * @return payments.PaymentResult - */ - public function sendPaymentForm($params); - - /** - * Get saved payment information. - * - * @return payments.SavedInfo - */ - public function getSavedInfo(); - - /** - * Clear saved payment information. - * - * Parameters: - * * `boolean` **credentials** - Optional: Remove saved payment credentials - * * `boolean` **info** - Optional: Clear the last order settings saved by the user - * - * @param array $params Parameters - * - * @return bool - */ - public function clearSavedInfo($params); - - /** - * Get info about a credit card. - * - * Parameters: - * * `string` **number** - Credit card number - * - * @param array $params Parameters - * - * @return payments.BankCardData - */ - public function getBankCardData($params); - - /** - * Generate an [invoice deep link](https://core.telegram.org/api/links#invoice-links). - * - * Parameters: - * * `InputMedia` **invoice_media** - Invoice - * - * @param array $params Parameters - * - * @return payments.ExportedInvoice - */ - public function exportInvoice($params); - - /** - * Informs server about a purchase made through the App Store: for official applications only. - * - * Parameters: - * * `bytes` **receipt** - Receipt - * * `InputStorePaymentPurpose` **purpose** - Payment purpose - * - * @param array $params Parameters - * - * @return Updates - */ - public function assignAppStoreTransaction($params); - - /** - * Informs server about a purchase made through the Play Store: for official applications only. - * - * Parameters: - * * `DataJSON` **receipt** - Receipt - * * `InputStorePaymentPurpose` **purpose** - Payment purpose - * - * @param array $params Parameters - * - * @return Updates - */ - public function assignPlayMarketTransaction($params); - - /** - * Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase, official apps only. - * - * Parameters: - * * `InputStorePaymentPurpose` **purpose** - Payment purpose - * - * @param array $params Parameters - * - * @return bool - */ - public function canPurchasePremium($params); -} - -interface stickers -{ - /** - * Create a stickerset, bots only. - * - * Parameters: - * * `boolean` **masks** - Optional: Whether this is a mask stickerset - * * `boolean` **animated** - Optional: Whether this is an animated stickerset - * * `boolean` **videos** - Optional: Whether this is a video stickerset - * * `InputUser` **user_id** - Stickerset owner - * * `string` **title** - Stickerset name, `1-64` chars - * * `string` **short_name** - Short name of sticker set, to be used in [sticker deep links »](https://core.telegram.org/api/links#stickerset-links). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and, **if called by a bot**, must end in `"_by_"`. `` is case insensitive. 1-64 characters. - * * `InputDocument` **thumb** - Optional: Thumbnail - * * `[InputStickerSetItem]` **stickers** - Stickers - * * `string` **software** - Optional: Used when [importing stickers using the sticker import SDKs](https://core.telegram.org/import-stickers), specifies the name of the software that created the stickers - * - * @param array $params Parameters - * - * @return messages.StickerSet - */ - public function createStickerSet($params); - - /** - * Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. - * - * Parameters: - * * `InputDocument` **sticker** - The sticker to remove - * - * @param array $params Parameters - * - * @return messages.StickerSet - */ - public function removeStickerFromSet($params); - - /** - * Changes the absolute position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot. - * - * Parameters: - * * `InputDocument` **sticker** - The sticker - * * `int` **position** - The new position of the sticker, zero-based - * - * @param array $params Parameters - * - * @return messages.StickerSet - */ - public function changeStickerPosition($params); - - /** - * Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. - * - * Parameters: - * * `InputStickerSet` **stickerset** - The stickerset - * * `InputStickerSetItem` **sticker** - The sticker - * - * @param array $params Parameters - * - * @return messages.StickerSet - */ - public function addStickerToSet($params); - - /** - * Set stickerset thumbnail. - * - * Parameters: - * * `InputStickerSet` **stickerset** - Stickerset - * * `InputDocument` **thumb** - Thumbnail - * - * @param array $params Parameters - * - * @return messages.StickerSet - */ - public function setStickerSetThumb($params); - - /** - * Check whether the given short name is available. - * - * Parameters: - * * `string` **short_name** - Short name - * - * @param array $params Parameters - * - * @return bool - */ - public function checkShortName($params); - - /** - * Suggests a short name for a given stickerpack name. - * - * Parameters: - * * `string` **title** - Sticker pack name - * - * @param array $params Parameters - * - * @return stickers.SuggestedShortName - */ - public function suggestShortName($params); -} - -interface phone -{ - /** - * Get phone call configuration to be passed to libtgvoip's shared config. - * - * @return DataJSON - */ - public function getCallConfig(); - - /** - * You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls. - * - * Parameters: - * * `boolean` **video** - Optional: Whether to start a video call - * * `InputUser` **user_id** - Destination of the phone call - * * `bytes` **g_a_hash** - [Parameter for E2E encryption key exchange »](https://core.telegram.org/api/end-to-end/voice-calls) - * * `PhoneCallProtocol` **protocol** - Phone call settings - * - * @param array $params Parameters - * - * @return phone.PhoneCall - */ - public function requestCall($params); - - /** - * You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls. - * - * Parameters: - * * `InputPhoneCall` **peer** - The call to accept - * * `bytes` **g_b** - [Parameter for E2E encryption key exchange »](https://core.telegram.org/api/end-to-end/voice-calls) - * * `PhoneCallProtocol` **protocol** - Phone call settings - * - * @param array $params Parameters - * - * @return phone.PhoneCall - */ - public function acceptCall($params); - - /** - * You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls. - * - * Parameters: - * * `InputPhoneCall` **peer** - The phone call - * * `bytes` **g_a** - [Parameter for E2E encryption key exchange »](https://core.telegram.org/api/end-to-end/voice-calls) - * * `long` **key_fingerprint** - Key fingerprint - * * `PhoneCallProtocol` **protocol** - Phone call settings - * - * @param array $params Parameters - * - * @return phone.PhoneCall - */ - public function confirmCall($params); - - /** - * Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. - * - * Parameters: - * * `InputPhoneCall` **peer** - The phone call we're currently in - * - * @param array $params Parameters - * - * @return bool - */ - public function receivedCall($params); - - /** - * You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls. - * - * Parameters: - * * `boolean` **video** - Optional: Whether this is a video call - * * `InputPhoneCall` **peer** - The phone call - * * `int` **duration** - Call duration - * * `PhoneCallDiscardReason` **reason** - Why was the call discarded - * * `long` **connection_id** - Preferred libtgvoip relay ID - * - * @param array $params Parameters - * - * @return Updates - */ - public function discardCall($params); - - /** - * Rate a call, returns info about the rating message sent to the official VoIP bot. - * - * Parameters: - * * `boolean` **user_initiative** - Optional: Whether the user decided on their own initiative to rate the call - * * `InputPhoneCall` **peer** - The call to rate - * * `int` **rating** - Rating in `1-5` stars - * * `string` **comment** - An additional comment - * - * @param array $params Parameters - * - * @return Updates - */ - public function setCallRating($params); - - /** - * Send phone call debug data to server. - * - * Parameters: - * * `InputPhoneCall` **peer** - Phone call - * * `DataJSON` **debug** - Debug statistics obtained from libtgvoip - * - * @param array $params Parameters - * - * @return bool - */ - public function saveCallDebug($params); - - /** - * Send VoIP signaling data. - * - * Parameters: - * * `InputPhoneCall` **peer** - Phone call - * * `bytes` **data** - Signaling payload - * - * @param array $params Parameters - * - * @return bool - */ - public function sendSignalingData($params); - - /** - * Create a group call or livestream. - * - * Parameters: - * * `boolean` **rtmp_stream** - Optional: Whether RTMP stream support should be enabled: only the [group/supergroup/channel](https://core.telegram.org/api/channel) owner can use this flag. - * * `InputPeer` **peer** - Associate the group call or livestream to the provided [group/supergroup/channel](https://core.telegram.org/api/channel) - * * `string` **title** - Optional: Call title - * * `int` **schedule_date** - Optional: For scheduled group call or livestreams, the absolute date when the group call will start - * - * @param array $params Parameters - * - * @return Updates - */ - public function createGroupCall($params); - - /** - * Join a group call. - * - * Parameters: - * * `boolean` **muted** - Optional: If set, the user will be muted by default upon joining. - * * `boolean` **video_stopped** - Optional: If set, the user's video will be disabled by default upon joining. - * * `InputGroupCall` **call** - The group call - * * `InputPeer` **join_as** - Join the group call, presenting yourself as the specified user/channel - * * `string` **invite_hash** - Optional: The invitation hash from the [invite link »](https://core.telegram.org/api/links#voice-chatvideo-chatlivestream-links), if provided allows speaking in a livestream or muted group chat. - * * `DataJSON` **params** - WebRTC parameters - * - * @param array $params Parameters - * - * @return Updates - */ - public function joinGroupCall($params); - - /** - * Leave a group call. - * - * Parameters: - * * `InputGroupCall` **call** - The group call - * * `int` **source** - Your source ID - * - * @param array $params Parameters - * - * @return Updates - */ - public function leaveGroupCall($params); - - /** - * Invite a set of users to a group call. - * - * Parameters: - * * `InputGroupCall` **call** - The group call - * * `[InputUser]` **users** - The users to invite. - * - * @param array $params Parameters - * - * @return Updates - */ - public function inviteToGroupCall($params); - - /** - * Terminate a group call. - * - * Parameters: - * * `InputGroupCall` **call** - The group call to terminate - * - * @param array $params Parameters - * - * @return Updates - */ - public function discardGroupCall($params); - - /** - * Change group call settings. - * - * Parameters: - * * `boolean` **reset_invite_hash** - Optional: Invalidate existing invite links - * * `InputGroupCall` **call** - Group call - * * `Bool` **join_muted** - Optional: Whether all users will that join this group call are muted by default upon joining the group call - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleGroupCallSettings($params); - - /** - * Get info about a group call. - * - * Parameters: - * * `InputGroupCall` **call** - The group call - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return phone.GroupCall - */ - public function getGroupCall($params); - - /** - * Get group call participants. - * - * Parameters: - * * `InputGroupCall` **call** - Group call - * * `[InputPeer]` **ids** - If specified, will fetch group participant info about the specified peers - * * `[int]` **sources** - If specified, will fetch group participant info about the specified WebRTC source IDs - * * `string` **offset** - Offset for results, taken from the `next_offset` field of [phone.groupParticipants](https://docs.madelineproto.xyz/API_docs/constructors/phone.groupParticipants.html), initially an empty string.
Note: if no more results are available, the method call will return an empty `next_offset`; thus, avoid providing the `next_offset` returned in [phone.groupParticipants](https://docs.madelineproto.xyz/API_docs/constructors/phone.groupParticipants.html) if it is empty, to avoid an infinite loop. - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return phone.GroupParticipants - */ - public function getGroupParticipants($params); - - /** - * Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs. - * Returns an intersection of the source IDs specified in `sources`, and the source IDs currently being forwarded by the SFU. - * - * Parameters: - * * `InputGroupCall` **call** - Group call - * * `[int]` **sources** - Source IDs - * - * @param array $params Parameters - * - * @return of int[] - */ - public function checkGroupCall($params); - - /** - * Start or stop recording a group call: the recorded audio and video streams will be automatically sent to `Saved messages` (the chat with ourselves). - * - * Parameters: - * * `boolean` **start** - Optional: Whether to start or stop recording - * * `boolean` **video** - Optional: Whether to also record video streams - * * `InputGroupCall` **call** - The group call or livestream - * * `string` **title** - Optional: Recording title - * * `Bool` **video_portrait** - Optional: If video stream recording is enabled, whether to record in portrait or landscape mode - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleGroupCallRecord($params); - - /** - * Edit information about a given group call participant. - * - * Note: [flags](https://core.telegram.org/mtproto/TL-combinators#conditional-fields).N?[Bool](https://docs.madelineproto.xyz/API_docs/types/Bool.html) parameters can have three possible values: - * - * - If the [TL flag](https://core.telegram.org/mtproto/TL-combinators#conditional-fields) is not set, the previous value will not be changed. - * - If the [TL flag](https://core.telegram.org/mtproto/TL-combinators#conditional-fields) is set and contains a [boolTrue](https://docs.madelineproto.xyz/API_docs/constructors/boolTrue.html), the previous value will be overwritten to `true`. - * - If the [TL flag](https://core.telegram.org/mtproto/TL-combinators#conditional-fields) is set and contains a [boolFalse](https://docs.madelineproto.xyz/API_docs/constructors/boolFalse.html), the previous value will be overwritten to `false`. - * - * Parameters: - * * `InputGroupCall` **call** - The group call - * * `InputPeer` **participant** - The group call participant (can also be the user itself) - * * `Bool` **muted** - Optional: Whether to mute or unmute the specified participant - * * `int` **volume** - Optional: New volume - * * `Bool` **raise_hand** - Optional: Raise or lower hand - * * `Bool` **video_stopped** - Optional: Start or stop the video stream - * * `Bool` **video_paused** - Optional: Pause or resume the video stream - * * `Bool` **presentation_paused** - Optional: Pause or resume the screen sharing stream - * - * @param array $params Parameters - * - * @return Updates - */ - public function editGroupCallParticipant($params); - - /** - * Edit the title of a group call or livestream. - * - * Parameters: - * * `InputGroupCall` **call** - Group call - * * `string` **title** - New title - * - * @param array $params Parameters - * - * @return Updates - */ - public function editGroupCallTitle($params); - - /** - * Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. - * - * Parameters: - * * `InputPeer` **peer** - The dialog whose group call or livestream we're trying to join - * - * @param array $params Parameters - * - * @return phone.JoinAsPeers - */ - public function getGroupCallJoinAs($params); - - /** - * Get an [invite link](https://core.telegram.org/api/links#voice-chatvideo-chatlivestream-links) for a group call or livestream. - * - * Parameters: - * * `boolean` **can_self_unmute** - Optional: For livestreams or muted group chats, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). - * * `InputGroupCall` **call** - The group call - * - * @param array $params Parameters - * - * @return phone.ExportedGroupCallInvite - */ - public function exportGroupCallInvite($params); - - /** - * Subscribe or unsubscribe to a scheduled group call. - * - * Parameters: - * * `InputGroupCall` **call** - Scheduled group call - * * `Bool` **subscribed** - Enable or disable subscription - * - * @param array $params Parameters - * - * @return Updates - */ - public function toggleGroupCallStartSubscription($params); - - /** - * Start a scheduled group call. - * - * Parameters: - * * `InputGroupCall` **call** - The scheduled group call - * - * @param array $params Parameters - * - * @return Updates - */ - public function startScheduledGroupCall($params); - - /** - * Set the default peer that will be used to join a group call in a specific dialog. - * - * Parameters: - * * `InputPeer` **peer** - The dialog - * * `InputPeer` **join_as** - The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. - * - * @param array $params Parameters - * - * @return bool - */ - public function saveDefaultGroupCallJoinAs($params); - - /** - * Start screen sharing in a call. - * - * Parameters: - * * `InputGroupCall` **call** - The group call - * * `DataJSON` **params** - WebRTC parameters - * - * @param array $params Parameters - * - * @return Updates - */ - public function joinGroupCallPresentation($params); - - /** - * Stop screen sharing in a group call. - * - * Parameters: - * * `InputGroupCall` **call** - The group call - * - * @param array $params Parameters - * - * @return Updates - */ - public function leaveGroupCallPresentation($params); - - /** - * Get info about RTMP streams in a group call or livestream. - * This method should be invoked to the same group/channel-related DC used for [downloading livestream chunks](https://core.telegram.org/api/files#downloading-files). - * As usual, the media DC is preferred, if available. - * - * Parameters: - * * `InputGroupCall` **call** - Group call or livestream - * - * @param array $params Parameters - * - * @return phone.GroupCallStreamChannels - */ - public function getGroupCallStreamChannels($params); - - /** - * Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the actual RTMP livestream with [phone.createGroupCall](https://docs.madelineproto.xyz/API_docs/methods/phone.createGroupCall.html) (the `rtmp_stream` flag must be set). - * - * Parameters: - * * `InputPeer` **peer** - Peer to livestream into - * * `Bool` **revoke** - Whether to revoke the previous stream key or simply return the existing one - * - * @param array $params Parameters - * - * @return phone.GroupCallStreamRtmpUrl - */ - public function getGroupCallStreamRtmpUrl($params); - - /** - * Save phone call debug information. - * - * Parameters: - * * `InputPhoneCall` **peer** - Phone call - * * `InputFile` **file** - Logs - * - * @param array $params Parameters - * - * @return bool - */ - public function saveCallLog($params); -} - -interface langpack -{ - /** - * Get localization pack strings. - * - * Parameters: - * * `string` **lang_pack** - Language pack name, usually obtained from a [language pack link](https://core.telegram.org/api/links#language-pack-links) - * * `string` **lang_code** - Language code - * - * @param array $params Parameters - * - * @return LangPackDifference - */ - public function getLangPack($params); - - /** - * Get strings from a language pack. - * - * Parameters: - * * `string` **lang_pack** - Language pack name, usually obtained from a [language pack link](https://core.telegram.org/api/links#language-pack-links) - * * `string` **lang_code** - Language code - * * `[string]` **keys** - Strings to get - * - * @param array $params Parameters - * - * @return of LangPackString[] - */ - public function getStrings($params); - - /** - * Get new strings in language pack. - * - * Parameters: - * * `string` **lang_pack** - Language pack - * * `string` **lang_code** - Language code - * * `int` **from_version** - Previous localization pack version - * - * @param array $params Parameters - * - * @return LangPackDifference - */ - public function getDifference($params); - - /** - * Get information about all languages in a localization pack. - * - * Parameters: - * * `string` **lang_pack** - Language pack - * - * @param array $params Parameters - * - * @return of LangPackLanguage[] - */ - public function getLanguages($params); - - /** - * Get information about a language in a localization pack. - * - * Parameters: - * * `string` **lang_pack** - Language pack name, usually obtained from a [language pack link](https://core.telegram.org/api/links#language-pack-links) - * * `string` **lang_code** - Language code - * - * @param array $params Parameters - * - * @return LangPackLanguage - */ - public function getLanguage($params); -} - -interface folders -{ - /** - * Edit peers in [peer folder](https://core.telegram.org/api/folders#peer-folders). - * - * Parameters: - * * `[InputFolderPeer]` **folder_peers** - New peer list - * - * @param array $params Parameters - * - * @return Updates - */ - public function editPeerFolders($params); - - /** - * Delete a [peer folder](https://core.telegram.org/api/folders#peer-folders). - * - * Parameters: - * * `int` **folder_id** - [Peer folder ID, for more info click here](https://core.telegram.org/api/folders#peer-folders) - * - * @param array $params Parameters - * - * @return Updates - */ - public function deleteFolder($params); -} - -interface stats -{ - /** - * Get [channel statistics](https://core.telegram.org/api/stats). - * - * Parameters: - * * `boolean` **dark** - Optional: Whether to enable dark theme for graph colors - * * `InputChannel` **channel** - The channel - * - * @param array $params Parameters - * - * @return stats.BroadcastStats - */ - public function getBroadcastStats($params); - - /** - * Load [channel statistics graph](https://core.telegram.org/api/stats) asynchronously. - * - * Parameters: - * * `string` **token** - Graph token from [statsGraphAsync](https://docs.madelineproto.xyz/API_docs/constructors/statsGraphAsync.html) constructor - * * `long` **x** - Optional: Zoom value, if required - * - * @param array $params Parameters - * - * @return StatsGraph - */ - public function loadAsyncGraph($params); - - /** - * Get [supergroup statistics](https://core.telegram.org/api/stats). - * - * Parameters: - * * `boolean` **dark** - Optional: Whether to enable dark theme for graph colors - * * `InputChannel` **channel** - [Supergroup ID](https://core.telegram.org/api/channel) - * - * @param array $params Parameters - * - * @return stats.MegagroupStats - */ - public function getMegagroupStats($params); - - /** - * Obtains a list of messages, indicating to which other public channels was a channel message forwarded. - * Will return a list of [messages](https://docs.madelineproto.xyz/API_docs/constructors/message.html) with `peer_id` equal to the public channel to which this message was forwarded. - * - * Parameters: - * * `InputChannel` **channel** - Source channel - * * `int` **msg_id** - Source message ID - * * `int` **offset_rate** - Initially 0, then set to the `next_rate` parameter of [messages.messagesSlice](https://docs.madelineproto.xyz/API_docs/constructors/messages.messagesSlice.html) - * * `InputPeer` **offset_peer** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **offset_id** - [Offsets for pagination, for more info click here](https://core.telegram.org/api/offsets) - * * `int` **limit** - Maximum number of results to return, [see pagination](https://core.telegram.org/api/offsets) - * - * @param array $params Parameters - * - * @return messages.Messages - */ - public function getMessagePublicForwards($params); - - /** - * Get [message statistics](https://core.telegram.org/api/stats). - * - * Parameters: - * * `boolean` **dark** - Optional: Whether to enable dark theme for graph colors - * * `InputChannel` **channel** - Channel ID - * * `int` **msg_id** - Message ID - * - * @param array $params Parameters - * - * @return stats.MessageStats - */ - public function getMessageStats($params); -} - -class InternalDoc extends APIFactory -{ - /** - * Convert MTProto parameters to bot API parameters. - * - * @param array $data Data - */ - public function MTProtoToBotAPI(array $data) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($data); - } - /** - * MTProto to TD params. - * - * @param mixed $params Params - */ - public function MTProtoToTd(mixed &$params) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($params); - } - /** - * MTProto to TDCLI params. - * - * @param mixed $params Params - */ - public function MTProtoToTdcli(mixed $params) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($params); - } - /** - * Accept call. - * - * @param array $call Call - */ - public function acceptCall(array $call) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($call); - } - /** - * Accept secret chat. - * - * @param array $params Secret chat ID - */ - public function acceptSecretChat(array $params): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($params); - } - /** - * Add user info. - * - * @param array $user User info - */ - public function addUser(array $user): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($user); - } - /** - * Call promise $b after promise $a. - * - * @deprecated Coroutines are deprecated since amp v3 - * @param Generator|Future $a Promise A - * @param Generator|Future $b Promise B - * @psalm-suppress InvalidScope - * @return Amp\Future - */ - public static function after(\Generator|\Amp\Future $a, \Generator|\Amp\Future $b): \Amp\Future - { - return \danog\MadelineProto\AsyncTools::after($a, $b); - } - /** - * Returns a promise that succeeds when all promises succeed, and fails if any promise fails. - * Returned promise succeeds with an array of values used to succeed each contained promise, with keys corresponding to the array of promises. - * - * @deprecated Coroutines are deprecated since amp v3 - * @param array<(Generator|Future)> $promises Promises - */ - public static function all(array $promises) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($promises); - } - /** - * Returns a promise that is resolved when all promises are resolved. The returned promise will not fail. - * - * @deprecated Coroutines are deprecated since amp v3 - * @param array<(Future|Generator)> $promises Promises - */ - public static function any(array $promises) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($promises); - } - /** - * Create array. - * - * @param mixed ...$params Params - */ - public static function arr(mixed ...$params): array - { - return \danog\MadelineProto\Tools::arr(...$params); - } - /** - * base64URL decode. - * - * @param string $data Data to decode - */ - public static function base64urlDecode(string $data): string - { - return \danog\MadelineProto\Tools::base64urlDecode($data); - } - /** - * Base64URL encode. - * - * @param string $data Data to encode - */ - public static function base64urlEncode(string $data): string - { - return \danog\MadelineProto\Tools::base64urlEncode($data); - } - /** - * Convert bot API parameters to MTProto parameters. - * - * @param array $arguments Arguments - */ - public function botAPIToMTProto(array $arguments) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($arguments); - } - /** - * Login as bot. - * - * @param string $token Bot token - */ - public function botLogin(string $token) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($token); - } - /** - * Convert generator, promise or any other value to a promise. - * - * @deprecated Coroutines are deprecated since amp v3 - * @template TReturn - * @param Generator|Future|TReturn $promise - * @return Future - */ - public static function call(mixed $promise): \Amp\Future - { - return \danog\MadelineProto\AsyncTools::call($promise); - } - /** - * Call promise in background. - * - * @deprecated Coroutines are deprecated since amp v3 - * @param Generator|Future $promise Promise to resolve - * @param ?\Generator|Future $actual Promise to resolve instead of $promise - * @param string $file File - * @psalm-suppress InvalidScope - */ - public static function callFork(\Generator|\Amp\Future $promise, $actual = null, string $file = ''): mixed - { - return \danog\MadelineProto\AsyncTools::callFork($promise, $actual, $file); - } - /** - * Call promise in background, deferring execution. - * - * @deprecated Coroutines are deprecated since amp v3 - * @param Generator|Future $promise Promise to resolve - */ - public static function callForkDefer(\Generator|\Amp\Future $promise): void - { - \danog\MadelineProto\AsyncTools::callForkDefer($promise); - } - /** - * Get call status. - * - * @param int $id Call ID - */ - public function callStatus(int $id) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($id); - } - /** - * Close connection with client, connected via web. - * - * @param string $message Message - */ - public static function closeConnection(string $message): void - { - \danog\MadelineProto\Tools::closeConnection($message); - } - /** - * Complete 2FA login. - * - * @param string $password Password - */ - public function complete2faLogin(string $password) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($password); - } - /** - * Complete call handshake. - * - * @param array $params Params - */ - public function completeCall(array $params) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($params); - } - /** - * Complet user login using login code. - * - * @param string $code Login code - */ - public function completePhoneLogin(string $code) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($code); - } - /** - * Complete signup to Telegram. - * - * @param string $first_name First name - * @param string $last_name Last name - */ - public function completeSignup(string $first_name, string $last_name = '') - { - return $this->wrapper->getAPI()->{__FUNCTION__}($first_name, $last_name); - } - /** - * Confirm call. - * - * @param array $params Params - */ - public function confirmCall(array $params) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($params); - } - /** - * Connects to all datacenters and if necessary creates authorization keys, binds them and writes client info. - * - * @param boolean $reconnectAll Whether to reconnect to all DCs - */ - public function connectToAllDcs(bool $reconnectAll = true): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($reconnectAll); - } - /** - * Discard call. - * - * @param array $call Call - * @param array $rating Rating - * @param boolean $need_debug Need debug? - */ - public function discardCall(array $call, array $reason, array $rating = [ - ], bool $need_debug = true) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($call, $reason, $rating, $need_debug); - } - /** - * Discard secret chat. - * - * @param int $chat Secret chat ID - */ - public function discardSecretChat(int $chat): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($chat); - } - /** - * Download file to browser. - * - * Supports HEAD requests and content-ranges for parallel and resumed downloads. - * - * @param array|string|FileCallbackInterface $messageMedia File to download - * @param null|callable $cb Status callback (can also use FileCallback) - * @param null|int $size Size of file to download, required for bot API file IDs. - * @param null|string $mime MIME type of file to download, required for bot API file IDs. - * @param null|string $name Name of file to download, required for bot API file IDs. - */ - public function downloadToBrowser(\danog\MadelineProto\FileCallbackInterface|array|string $messageMedia, ?callable $cb = null, ?int $size = null, ?string $name = null, ?string $mime = null): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $cb, $size, $name, $mime); - } - /** - * Download file to callable. - * The callable must accept two parameters: string $payload, int $offset - * The callable will be called (possibly out of order, depending on the value of $seekable). - * - * @param mixed $messageMedia File to download - * @param callable|FileCallbackInterface $callable Chunk callback - * @param callable $cb Status callback (DEPRECATED, use FileCallbackInterface) - * @param bool $seekable Whether the callable can be called out of order - * @param int $offset Offset where to start downloading - * @param int $end Offset where to stop downloading (inclusive) - * @param int $part_size Size of each chunk - */ - public function downloadToCallable(mixed $messageMedia, callable $callable, ?callable $cb = null, bool $seekable = true, int $offset = 0, int $end = -1, ?int $part_size = null) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $callable, $cb, $seekable, $offset, $end, $part_size); - } - /** - * Download file to directory. - * - * @param mixed $messageMedia File to download - * @param string|FileCallbackInterface $dir Directory where to download the file - * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) - */ - public function downloadToDir(mixed $messageMedia, \danog\MadelineProto\FileCallbackInterface|string $dir, ?callable $cb = null) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $dir, $cb); - } - /** - * Download file. - * - * @param mixed $messageMedia File to download - * @param string|FileCallbackInterface $file Downloaded file path - * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) - */ - public function downloadToFile(mixed $messageMedia, \danog\MadelineProto\FileCallbackInterface|string $file, ?callable $cb = null) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $file, $cb); - } - /** - * Download file to amphp/http-server response. - * - * Supports HEAD requests and content-ranges for parallel and resumed downloads. - * - * @param array|string|FileCallbackInterface $messageMedia File to download - * @param ServerRequest $request Request - * @param callable $cb Status callback (can also use FileCallback) - * @param null|int $size Size of file to download, required for bot API file IDs. - * @param null|string $name Name of file to download, required for bot API file IDs. - * @param null|string $mime MIME type of file to download, required for bot API file IDs. - */ - public function downloadToResponse(\danog\MadelineProto\FileCallbackInterface|array|string $messageMedia, \Amp\Http\Server\Request $request, ?callable $cb = null, ?int $size = null, ?string $mime = null, ?string $name = null) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $request, $cb, $size, $mime, $name); - } - /** - * Download file to stream. - * - * @param mixed $messageMedia File to download - * @param mixed|FileCallbackInterface|resource|WritableStream $stream Stream where to download file - * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) - * @param int $offset Offset where to start downloading - * @param int $end Offset where to end download - */ - public function downloadToStream(mixed $messageMedia, mixed $stream, ?callable $cb = null, int $offset = 0, int $end = -1) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia, $stream, $cb, $offset, $end); - } - /** - * Asynchronously write to stdout/browser. - * - * @param string $string Message to echo - */ - public static function echo(string $string): void - { - \danog\MadelineProto\AsyncTools::echo($string); - } - /** - * Get final element of array. - * - * @param array $what Array - */ - public static function end(array $what) - { - return \danog\MadelineProto\Tools::end($what); - } - /** - * Export authorization. - * - */ - public function exportAuthorization() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Extract file info from bot API message. - * - * @param array $info Bot API message object - * @return ?array - */ - public static function extractBotAPIFile(array $info): ?array - { - return \danog\MadelineProto\MTProto::extractBotAPIFile($info); - } - /** - * Extract a message constructor from an Updates constructor. - */ - public function extractMessage(array $updates) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($updates); - } - /** - * Extract a message ID from an Updates constructor. - */ - public function extractMessageId(array $updates) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($updates); - } - /** - * Extract an update message constructor from an Updates constructor. - */ - public function extractMessageUpdate(array $updates) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($updates); - } - /** - * Extract Update constructors from an Updates constructor. - * - */ - public function extractUpdates(array $updates) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($updates); - } - /** - * Get contents of remote file asynchronously. - * - * @param string $url URL - */ - public function fileGetContents(string $url) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($url); - } - /** - * Returns a promise that succeeds when the first promise succeeds, and fails only if all promises fail. - * - * @deprecated Coroutines are deprecated since amp v3 - * @param array<(Future|Generator)> $promises Promises - */ - public static function first(array $promises) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($promises); - } - /** - * Asynchronously lock a file - * Resolves with a callbable that MUST eventually be called in order to release the lock. - * - * @param string $file File to lock - * @param integer $operation Locking mode - * @param float $polling Polling interval - * @param ?Cancellation $token Cancellation token - * @param ?Closure $failureCb Failure callback, called only once if the first locking attempt fails. - * @return ($token is null ? (Closure(): void) : ((Closure(): void)|null)) - */ - public static function flock(string $file, int $operation, float $polling = 0.1, ?\Amp\Cancellation $token = null, ?\Closure $failureCb = null): ?\Closure - { - return \danog\MadelineProto\AsyncTools::flock($file, $operation, $polling, $token, $failureCb); - } - /** - * Convert bot API channel ID to MTProto channel ID. - * - * @param int $id Bot API channel ID - */ - public static function fromSupergroup(int $id): int - { - return \danog\MadelineProto\MTProto::fromSupergroup($id); - } - /** - * When were full info for this chat last cached. - * - * @param mixed $id Chat ID - */ - public function fullChatLastUpdated(mixed $id) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($id); - } - /** - * Get info about the logged-in user, not cached. - */ - public function fullGetSelf() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Generate MTProto vector hash. - * - * @param array $ints IDs - * @return string Vector hash - */ - public static function genVectorHash(array $ints): string - { - return \danog\MadelineProto\Tools::genVectorHash($ints); - } - /** - * Get full list of MTProto and API methods. - */ - public function getAllMethods() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get authorization info. - */ - public function getAuthorization() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get cached server-side config. - */ - public function getCachedConfig() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get call info. - * - * @param int $call Call ID - */ - public function getCall(int $call) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($call); - } - /** - * Store RSA keys for CDN datacenters. - */ - public function getCdnConfig(): void - { - $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get cached (or eventually re-fetch) server-side config. - * - * @param array $config Current config - */ - public function getConfig(array $config = [ - ]) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($config); - } - /** - * Get async DNS client. - */ - public function getDNSClient() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get all datacenter connections. - * - */ - public function getDataCenterConnections() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get main DC ID. - * - */ - public function getDataCenterId() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get diffie-hellman configuration. - */ - public function getDhConfig() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get dialog peers. - * - * @param boolean $force Whether to refetch all dialogs ignoring cache - */ - public function getDialogs(bool $force = true) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($force); - } - /** - * Get download info of file - * Returns an array with the following structure:. - * - * `$info['ext']` - The file extension - * `$info['name']` - The file name, without the extension - * `$info['mime']` - The file mime type - * `$info['size']` - The file size - * - * @param mixed $messageMedia File ID - */ - public function getDownloadInfo(mixed $messageMedia) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($messageMedia); - } - /** - * Get event handler. - */ - public function getEventHandler() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get extension from file location. - * - * @param mixed $location File location - * @param string $default Default extension - */ - public static function getExtensionFromLocation(mixed $location, string $default): string - { - return \danog\MadelineProto\TL\Conversion\Extension::getExtensionFromLocation($location, $default); - } - /** - * Get extension from mime type. - * - * @param string $mime MIME type - */ - public static function getExtensionFromMime(string $mime): string - { - return \danog\MadelineProto\TL\Conversion\Extension::getExtensionFromMime($mime); - } - /** - * Get info about file. - * - * @param mixed $constructor File ID - */ - public function getFileInfo(mixed $constructor) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($constructor); - } - /** - * Get folder ID from object. - * - * @param mixed $id Object - * @return ?int - */ - public static function getFolderId(mixed $id): ?int - { - return \danog\MadelineProto\MTProto::getFolderId($id); - } - /** - * Get full info of all dialogs. - * - * @param boolean $force Whether to refetch all dialogs ignoring cache - */ - public function getFullDialogs(bool $force = true) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($force); - } - /** - * Get full info about peer, returns an FullInfo object. - * - * @param mixed $id Peer - * @see https://docs.madelineproto.xyz/FullInfo.html - */ - public function getFullInfo(mixed $id) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($id); - } - /** - * Get async HTTP client. - */ - public function getHTTPClient() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get current password hint. - */ - public function getHint() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get bot API ID from peer object. - * - * @param mixed $id Peer - */ - public function getId(mixed $id) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($id); - } - /** - * Get info about peer, returns an Info object. - * - * @param mixed $id Peer - * @param MTProto::INFO_TYPE_* $type Whether to generate an Input*, an InputPeer or the full set of constructors - * @see https://docs.madelineproto.xyz/Info.html - * @return mixed - * InputPeer: array{_: string, user_id?: int, access_hash?: int, min?: bool, chat_id?: int, channel_id?: int}, - * Peer: array{_: string, user_id?: int, chat_id?: int, channel_id?: int}, - * DialogPeer: array{_: string, peer: array{_: string, user_id?: int, chat_id?: int, channel_id?: int}}, - * NotifyPeer: array{_: string, peer: array{_: string, user_id?: int, chat_id?: int, channel_id?: int}}, - * InputDialogPeer: array{_: string, peer: array{_: string, user_id?: int, access_hash?: int, min?: bool, chat_id?: int, channel_id?: int}}, - * InputNotifyPeer: array{_: string, peer: array{_: string, user_id?: int, access_hash?: int, min?: bool, chat_id?: int, channel_id?: int}}, - * bot_api_id: int|string, - * user_id?: int, - * chat_id?: int, - * channel_id?: int, - * InputUser?: array{_: string, user_id?: int, access_hash?: int, min?: bool}, - * InputChannel?: array{_: string, channel_id: int, access_hash: int, min: bool}, - * type: string - * } : ($type is INFO_TYPE_ID ? int : array{_: string, user_id?: int, access_hash?: int, min?: bool, chat_id?: int, channel_id?: int}|array{_: string, user_id?: int, access_hash?: int, min?: bool}|array{_: string, channel_id: int, access_hash: int, min: bool})) - */ - public function getInfo(mixed $id, int $type = \danog\MadelineProto\MTProto::INFO_TYPE_ALL) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($id, $type); - } - /** - * Get logger. - */ - public function getLogger() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get TL namespaces. - */ - public function getMethodNamespaces() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get namespaced methods (method => namespace). - */ - public function getMethodsNamespaced() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get mime type from buffer. - * - * @param string $buffer Buffer - */ - public static function getMimeFromBuffer(string $buffer): string - { - return \danog\MadelineProto\TL\Conversion\Extension::getMimeFromBuffer($buffer); - } - /** - * Get mime type from file extension. - * - * @param string $extension File extension - * @param string $default Default mime type - */ - public static function getMimeFromExtension(string $extension, string $default): string - { - return \danog\MadelineProto\TL\Conversion\Extension::getMimeFromExtension($extension, $default); - } - /** - * Get mime type of file. - * - * @param string $file File - */ - public static function getMimeFromFile(string $file): string - { - return \danog\MadelineProto\TL\Conversion\Extension::getMimeFromFile($file); - } - /** - * Get download info of the propic of a user - * Returns an array with the following structure:. - * - * `$info['ext']` - The file extension - * `$info['name']` - The file name, without the extension - * `$info['mime']` - The file mime type - * `$info['size']` - The file size - */ - public function getPropicInfo($data) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($data); - } - /** - * Get PSR logger. - */ - public function getPsrLogger() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get full info about peer (including full list of channel members), returns a Chat object. - * - * @param mixed $id Peer - * @see https://docs.madelineproto.xyz/Chat.html - */ - public function getPwrChat(mixed $id, bool $fullfetch = true) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($id, $fullfetch); - } - /** - * Get secret chat. - * - * @param array|int $chat Secret chat ID - */ - public function getSecretChat(array|int $chat) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($chat); - } - /** - * Get info about the logged-in user, cached. - * - * Use fullGetSelf to bypass the cache. - */ - public function getSelf() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Return current settings. - */ - public function getSettings() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get sponsored messages for channel. - * This method will return an array of [sponsored message objects](https://docs.madelineproto.xyz/API_docs/constructors/sponsoredMessage.html). - * - * See [the API documentation](https://core.telegram.org/api/sponsored-messages) for more info on how to handle sponsored messages. - * - * @param int|string|array $peer Channel ID, or Update, or Message, or Peer. - */ - public function getSponsoredMessages(array|string|int $peer) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($peer); - } - /** - * Get TL serializer. - */ - public function getTL() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Get updates. - * - * @param array{offset?: int, limit?: int, timeout?: float} $params Params - */ - public function getUpdates(array $params = [ - ]) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($params); - } - /** - * Accesses a private variable from an object. - * - * @param object $obj Object - * @param string $var Attribute name - * @psalm-suppress InvalidScope - * @access public - */ - public static function getVar(object $obj, string $var) - { - return \danog\MadelineProto\Tools::getVar($obj, $var); - } - /** - * Get a message to show to the user when starting the bot. - */ - public function getWebMessage(string $message) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($message); - } - /** - * Get web template. - */ - public function getWebTemplate() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Checks whether all datacenters are authorized. - */ - public function hasAllAuth() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Check if an event handler instance is present. - */ - public function hasEventHandler() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Check if has report peers. - */ - public function hasReportPeers() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Check whether secret chat exists. - * - * @param array|int $chat Secret chat ID - */ - public function hasSecretChat(array|int $chat) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($chat); - } - /** - * Checks private property exists in an object. - * - * @param object $obj Object - * @param string $var Attribute name - * @psalm-suppress InvalidScope - * @access public - */ - public static function hasVar(object $obj, string $var): bool - { - return \danog\MadelineProto\Tools::hasVar($obj, $var); - } - /** - * Import authorization. - * - * @param array $authorization Authorization info - * @param int $mainDcID Main DC ID - */ - public function importAuthorization(array $authorization, int $mainDcID) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($authorization, $mainDcID); - } - /** - * Inflate stripped photosize to full JPG payload. - * - * @param string $stripped Stripped photosize - * @return string JPG payload - */ - public static function inflateStripped(string $stripped): string - { - return \danog\MadelineProto\Tools::inflateStripped($stripped); - } - /** - * Initialize self-restart hack. - */ - public function initSelfRestart(): void - { - $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Whether this is altervista. - */ - public static function isAltervista(): bool - { - return \danog\MadelineProto\Tools::isAltervista(); - } - /** - * Check if is array or similar (traversable && countable && arrayAccess). - * - * @param mixed $var Value to check - */ - public static function isArrayOrAlike(mixed $var): bool - { - return \danog\MadelineProto\Tools::isArrayOrAlike($var); - } - /** - * Whether we're an IPC client instance. - */ - public function isIpc() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Whether we're an IPC server process (as opposed to an event handler). - */ - public function isIpcWorker() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Returns whether the current user is a premium user, cached. - */ - public function isPremium() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Check whether provided bot API ID is a channel. - * - * @param int $id Bot API ID - */ - public static function isSupergroup(int $id): bool - { - return \danog\MadelineProto\MTProto::isSupergroup($id); - } - /** - * Logger. - * - * @param mixed $param Parameter - * @param int $level Logging level - * @param string $file File where the message originated - */ - public function logger(mixed $param, int $level = \danog\MadelineProto\Logger::NOTICE, string $file = ''): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($param, $level, $file); - } - /** - * Start MadelineProto's update handling loop, or run the provided async callable. - * - * @param callable|null $callback Async callable to run - */ - public function loop(?callable $callback = null) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($callback); - } - /** - * Escape string for markdown. - * - * @param string $hwat String to escape - */ - public static function markdownEscape(string $hwat): string - { - return \danog\MadelineProto\StrTools::markdownEscape($hwat); - } - /** - * Telegram UTF-8 multibyte split. - * - * @param string $text Text - * @param integer $length Length - * @return array - */ - public static function mbStrSplit(string $text, int $length): array - { - return \danog\MadelineProto\StrTools::mbStrSplit($text, $length); - } - /** - * Get Telegram UTF-8 length of string. - * - * @param string $text Text - */ - public static function mbStrlen(string $text): int - { - return \danog\MadelineProto\StrTools::mbStrlen($text); - } - /** - * Telegram UTF-8 multibyte substring. - * - * @param string $text Text to substring - * @param integer $offset Offset - * @param null|int $length Length - */ - public static function mbSubstr(string $text, int $offset, ?int $length = null): string - { - return \danog\MadelineProto\StrTools::mbSubstr($text, $offset, $length); - } - /** - * Call method and wait asynchronously for response. - * - * If the $aargs['noResponse'] is true, will not wait for a response. - * - * @param string $method Method name - * @param array|(callable(): array) $args Arguments - * @param array $aargs Additional arguments - */ - public function methodCall(string $method, callable|array $args = [ - ], array $aargs = [ - 'msg_id' => null, - ]) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($method, $args, $aargs); - } - /** - * Call method and make sure it is asynchronously sent. - * - * @param string $method Method name - * @param array|(callable(): array) $args Arguments - * @param array $aargs Additional arguments - */ - public function methodCallWrite(string $method, callable|array $args = [ - ], array $aargs = [ - 'msg_id' => null, - ]) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($method, $args, $aargs); - } - /** - * Escape method name. - * - * @param string $method Method name - */ - public static function methodEscape(string $method): string - { - return \danog\MadelineProto\StrTools::methodEscape($method); - } - /** - * Convert double to binary version. - * - * @param float $value Value to convert - */ - public static function packDouble(float $value): string - { - return \danog\MadelineProto\Tools::packDouble($value); - } - /** - * Convert integer to base256 signed int. - * - * @param integer $value Value to convert - */ - public static function packSignedInt(int $value): string - { - return \danog\MadelineProto\Tools::packSignedInt($value); - } - /** - * Convert integer to base256 long. - * - * @param int $value Value to convert - */ - public static function packSignedLong(int $value): string - { - return \danog\MadelineProto\Tools::packSignedLong($value); - } - /** - * Convert value to unsigned base256 int. - * - * @param int $value Value - */ - public static function packUnsignedInt(int $value): string - { - return \danog\MadelineProto\Tools::packUnsignedInt($value); - } - /** - * Check if peer is present in internal peer database. - * - * @param mixed $id Peer - */ - public function peerIsset(mixed $id) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($id); - } - /** - * Login as user. - * - * @param string $number Phone number - * @param integer $sms_type SMS type - */ - public function phoneLogin(string $number, int $sms_type = 5) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($number, $sms_type); - } - /** - * Positive modulo - * Works just like the % (modulus) operator, only returns always a postive number. - * - * @param int $a A - * @param int $b B - * @return int Modulo - */ - public static function posmod(int $a, int $b): int - { - return \danog\MadelineProto\Tools::posmod($a, $b); - } - /** - * Get random string of specified length. - * - * @param integer $length Length - * @return string Random string - */ - public static function random(int $length): string - { - return \danog\MadelineProto\Tools::random($length); - } - /** - * Get random integer. - * - * @param integer $modulus Modulus - */ - public static function randomInt(int $modulus = 0): int - { - return \danog\MadelineProto\Tools::randomInt($modulus); - } - /** - * Asynchronously read line. - * - * @param string $prompt Prompt - */ - public static function readLine(string $prompt = ''): string - { - return \danog\MadelineProto\AsyncTools::readLine($prompt); - } - /** - * Refresh full peer cache for a certain peer. - * - * @param mixed $id The peer to refresh - */ - public function refreshFullPeerCache(mixed $id): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($id); - } - /** - * Refresh peer cache for a certain peer. - * - * @param mixed $id The peer to refresh - */ - public function refreshPeerCache(mixed $id): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($id); - } - /** - * Rekey secret chat. - * - * @param int $chat Secret chat to rekey - */ - public function rekey(int $chat) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($chat); - } - /** - * Report an error to the previously set peer. - * - * @param string $message Error to report - * @param string $parseMode Parse mode - */ - public function report(string $message, string $parseMode = ''): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($message, $parseMode); - } - /** - * Request VoIP call. - * - * @param mixed $user User - */ - public function requestCall(mixed $user) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($user); - } - /** - * Request secret chat. - * - * @param mixed $user User to start secret chat with - */ - public function requestSecretChat(mixed $user) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($user); - } - /** - * Reset the update state and fetch all updates from the beginning. - */ - public function resetUpdateState(): void - { - $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Restart update loop. - */ - public function restart(): void - { - $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * null-byte RLE decode. - * - * @param string $string Data to decode - */ - public static function rleDecode(string $string): string - { - return \danog\MadelineProto\Tools::rleDecode($string); - } - /** - * null-byte RLE encode. - * - * @param string $string Data to encode - */ - public static function rleEncode(string $string): string - { - return \danog\MadelineProto\Tools::rleEncode($string); - } - /** - * Get secret chat status. - * - * @param int $chat Chat ID - */ - public function secretChatStatus(int $chat) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($chat); - } - /** - * Set NOOP update handler, ignoring all updates. - */ - public function setNoop(): void - { - $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Set peer(s) where to send errors occurred in the event loop. - * - * @param int|string|array $userOrId Username(s) or peer ID(s) - */ - public function setReportPeers(array|string|int $userOrId): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($userOrId); - } - /** - * Sets a private variable in an object. - * - * @param object $obj Object - * @param string $var Attribute name - * @param mixed $val Attribute value - * @psalm-suppress InvalidScope - * @access public - */ - public static function setVar(object $obj, string $var, mixed &$val): void - { - \danog\MadelineProto\Tools::setVar($obj, $var, $val); - } - /** - * Set web template. - * - * @param string $template Template - */ - public function setWebTemplate(string $template): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($template); - } - /** - * Set webhook update handler. - * - * @param string $webhookUrl Webhook URL - */ - public function setWebhook(string $webhookUrl): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($webhookUrl); - } - /** - * Setup logger. - */ - public function setupLogger(): void - { - $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Asynchronously sleep. - * - * @param float $time Number of seconds to sleep for - */ - public static function sleep(float $time): void - { - \danog\MadelineProto\AsyncTools::sleep($time); - } - /** - * Resolves with a two-item array delineating successful and failed Promise results. - * The returned promise will only fail if the given number of required promises fail. - * - * @deprecated Coroutines are deprecated since amp v3 - * @param array<(Future|Generator)> $promises Promises - */ - public static function some(array $promises) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($promises); - } - /** - * Log in to telegram (via CLI or web). - */ - public function start() - { - return $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Stop update loop. - */ - public function stop(): void - { - $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Subscribe to event handler updates for a channel/supergroup we're not a member of. - * - */ - public function subscribeToUpdates(mixed $channel) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($channel); - } - /** - * Convert TD to MTProto parameters. - * - * @param array $params Parameters - */ - public function tdToMTProto(array $params) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($params); - } - /** - * Convert TD parameters to tdcli. - * - * @param mixed $params Parameters - */ - public function tdToTdcli(mixed $params) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($params); - } - /** - * Convert tdcli parameters to tdcli. - * - * @param mixed $params Params - * @param array $key Key - */ - public function tdcliToTd(&$params, ?array $key = null) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($params, $key); - } - /** - * Create an artificial timeout for any \Generator or Promise. - * - * @deprecated Coroutines are deprecated since amp v3 - * @param int $timeout In milliseconds - */ - public static function timeout(\Generator|\Amp\Future $promise, int $timeout): mixed - { - return \danog\MadelineProto\AsyncTools::timeout($promise, $timeout); - } - /** - * Creates an artificial timeout for any `Promise`. - * - * If the promise is resolved before the timeout expires, the result is returned - * - * If the timeout expires before the promise is resolved, a default value is returned - * - * @deprecated Coroutines are deprecated since amp v3 - * @template TReturnAlt - * @template TReturn - * @template TGenerator of Generator - * @param Future|TGenerator $promise Promise to which the timeout is applied. - * @param int $timeout Timeout in milliseconds. - * @param TReturnAlt $default - * @return TReturn|TReturnAlt - */ - public static function timeoutWithDefault($promise, int $timeout, $default = null): mixed - { - return \danog\MadelineProto\AsyncTools::timeoutWithDefault($promise, $timeout, $default); - } - /** - * Convert to camelCase. - * - * @param string $input String - */ - public static function toCamelCase(string $input): string - { - return \danog\MadelineProto\StrTools::toCamelCase($input); - } - /** - * Convert to snake_case. - * - * @param string $input String - */ - public static function toSnakeCase(string $input): string - { - return \danog\MadelineProto\StrTools::toSnakeCase($input); - } - /** - * Convert MTProto channel ID to bot API channel ID. - * - * @param int $id MTProto channel ID - */ - public static function toSupergroup(int $id): int - { - return \danog\MadelineProto\MTProto::toSupergroup($id); - } - /** - * Escape type name. - * - * @param string $type String to escape - */ - public static function typeEscape(string $type): string - { - return \danog\MadelineProto\StrTools::typeEscape($type); - } - /** - * Unpack binary double. - * - * @param string $value Value to unpack - */ - public static function unpackDouble(string $value): float - { - return \danog\MadelineProto\Tools::unpackDouble($value); - } - /** - * Unpack bot API file ID. - * - * @param string $fileId Bot API file ID - */ - public function unpackFileId(string $fileId) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($fileId); - } - /** - * Unpack base256 signed int. - * - * @param string $value base256 int - */ - public static function unpackSignedInt(string $value): int - { - return \danog\MadelineProto\Tools::unpackSignedInt($value); - } - /** - * Unpack base256 signed long. - * - * @param string $value base256 long - */ - public static function unpackSignedLong(string $value): int - { - return \danog\MadelineProto\Tools::unpackSignedLong($value); - } - /** - * Unpack base256 signed long to string. - * - * @param string|int|array $value base256 long - */ - public static function unpackSignedLongString(array|string|int $value): string - { - return \danog\MadelineProto\Tools::unpackSignedLongString($value); - } - /** - * Unset event handler. - * - */ - public function unsetEventHandler(): void - { - $this->wrapper->getAPI()->{__FUNCTION__}(); - } - /** - * Update the 2FA password. - * - * The params array can contain password, new_password, email and hint params. - * - * @param array $params The params - */ - public function update2fa(array $params): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($params); - } - /** - * Parse, update and store settings. - * - * @param SettingsAbstract $settings Settings - */ - public function updateSettings(\danog\MadelineProto\SettingsAbstract $settings): void - { - $this->wrapper->getAPI()->{__FUNCTION__}($settings); - } - /** - * Upload file. - * - * @param FileCallbackInterface|string|array $file File, URL or Telegram file to upload - * @param string $fileName File name - * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) - * @param boolean $encrypted Whether to encrypt file for secret chats - */ - public function upload(\danog\MadelineProto\FileCallbackInterface|array|string $file, string $fileName = '', ?callable $cb = null, bool $encrypted = false) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($file, $fileName, $cb, $encrypted); - } - /** - * Upload file to secret chat. - * - * @param FileCallbackInterface|string|array $file File, URL or Telegram file to upload - * @param string $fileName File name - * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) - */ - public function uploadEncrypted(\danog\MadelineProto\FileCallbackInterface|array|string $file, string $fileName = '', ?callable $cb = null) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($file, $fileName, $cb); - } - /** - * Upload file from callable. - * - * The callable must accept two parameters: int $offset, int $size - * The callable must return a string with the contest of the file at the specified offset and size. - * - * @param mixed $callable Callable - * @param integer $size File size - * @param string $mime Mime type - * @param string $fileName File name - * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) - * @param boolean $seekable Whether chunks can be fetched out of order - * @param boolean $encrypted Whether to encrypt file for secret chats - */ - public function uploadFromCallable(callable $callable, int $size, string $mime, string $fileName = '', ?callable $cb = null, bool $seekable = true, bool $encrypted = false) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($callable, $size, $mime, $fileName, $cb, $seekable, $encrypted); - } - /** - * Upload file from stream. - * - * @param mixed $stream PHP resource or AMPHP async stream - * @param integer $size File size - * @param string $mime Mime type - * @param string $fileName File name - * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) - * @param boolean $encrypted Whether to encrypt file for secret chats - */ - public function uploadFromStream(mixed $stream, int $size, string $mime, string $fileName = '', ?callable $cb = null, bool $encrypted = false) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($stream, $size, $mime, $fileName, $cb, $encrypted); - } - /** - * Reupload telegram file. - * - * @param mixed $media Telegram file - * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) - * @param boolean $encrypted Whether to encrypt file for secret chats - */ - public function uploadFromTgfile(mixed $media, ?callable $cb = null, bool $encrypted = false) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($media, $cb, $encrypted); - } - /** - * Upload file from URL. - * - * @param string|FileCallbackInterface $url URL of file - * @param integer $size Size of file - * @param string $fileName File name - * @param callable $cb Callback (DEPRECATED, use FileCallbackInterface) - * @param boolean $encrypted Whether to encrypt file for secret chats - */ - public function uploadFromUrl(\danog\MadelineProto\FileCallbackInterface|string $url, int $size = 0, string $fileName = '', ?callable $cb = null, bool $encrypted = false) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($url, $size, $fileName, $cb, $encrypted); - } - /** - * Mark sponsored message as read. - * - * @param int|array $peer Channel ID, or Update, or Message, or Peer. - * @param string|array{random_id: string} $message Random ID or sponsored message to mark as read. - */ - public function viewSponsoredMessage(array|int $peer, array|string $message) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($peer, $message); - } - /** - * Synchronously wait for a Future|generator. - * - * @deprecated Coroutines are deprecated since amp v3 - * @param Generator|Future $promise The promise to wait for - */ - public static function wait(\Generator|\Amp\Future $promise) - { - return $this->wrapper->getAPI()->{__FUNCTION__}($promise); - } -} diff --git a/tests/conversion/after-5.sh b/tests/conversion/after-5.sh index ddaa07d3a..d84954044 100755 --- a/tests/conversion/after-5.sh +++ b/tests/conversion/after-5.sh @@ -3,9 +3,9 @@ sed 's/^Loop::set.*;//g' -i vendor/amphp/amp/lib/Loop.php echo 'Loop::set((new DriverFactory())->create());' >> vendor/amphp/amp/lib/Loop.php cp $(dirname $0)/../random.php vendor/paragonie/random_compat/lib/random.php -cp vendor/danog/madelineproto/src/danog/MadelineProto/Coroutine.php vendor/amphp/amp/lib/Coroutine.php +cp vendor/danog/madelineproto/src/Coroutine.php vendor/amphp/amp/lib/Coroutine.php sed 's/namespace danog\\MadelineProto;/namespace Amp;/g' -i vendor/amphp/amp/lib/Coroutine.php -sed 's/public static function echo/public static function echo_/g' -i vendor/danog/madelineproto/src/danog/MadelineProto/Tools.php +sed 's/public static function echo/public static function echo_/g' -i vendor/danog/madelineproto/src/Tools.php sed 's/use Kelunik\\Certificate\\Certificate/use Kelunik\Certificate\Certificate as _Certificate/g;s/new Certificate/new _Certificate/g;s/empty[(]\$metadata[)] [?] null : //g' -i vendor/amphp/socket/src/TlsInfo.php diff --git a/ton/README.md b/ton/README.md index 10e2bb6f5..0fda1cb6e 100644 --- a/ton/README.md +++ b/ton/README.md @@ -38,7 +38,7 @@ $API->loop( For a full overview of async in MadelineProtoTon, take a look at the [MadelineProto async docs](https://docs.madelineproto.xyz/docs/ASYNC.html). -For a full list of methods that can be used, simply look at the PHPDOC suggestions in your favorite IDE, or take a look at the `---functions---` section of the [lite TL scheme](https://github.com/danog/MadelineProto/blob/master/src/danog/MadelineProto/TON/schemes/lite_api.tl). +For a full list of methods that can be used, simply look at the PHPDOC suggestions in your favorite IDE, or take a look at the `---functions---` section of the [lite TL scheme](https://github.com/danog/MadelineProto/blob/master/src/TON/schemes/lite_api.tl). This API can be used to build web-facing HTTP APIs that query the TON blockchain (using the async [http-client](https://github.com/amphp/http-client)), off-chain elements for TON applications and so much more! diff --git a/tools/build_docs.php b/tools/build_docs.php index 95a09bc8c..cb65cc05a 100755 --- a/tools/build_docs.php +++ b/tools/build_docs.php @@ -12,7 +12,6 @@ */ use danog\MadelineProto\API; -use danog\MadelineProto\APIFactory; use danog\MadelineProto\Logger; use danog\MadelineProto\Magic; use danog\MadelineProto\MTProto; @@ -55,10 +54,8 @@ $logger->logger('Creating annotations...', Logger::NOTICE); $doc = new \danog\MadelineProto\AnnotationsBuilder( $logger, $docs[0], - dirname(__FILE__).'/../src/danog/MadelineProto/InternalDoc.php', [ 'API' => API::class, - 'APIFactory' => APIFactory::class, 'MTProto' => MTProto::class ], 'danog\\MadelineProto' diff --git a/tools/build_docs/layerUpgrade.php b/tools/build_docs/layerUpgrade.php index 733734507..f24739c45 100644 --- a/tools/build_docs/layerUpgrade.php +++ b/tools/build_docs/layerUpgrade.php @@ -12,12 +12,12 @@ function layerUpgrade(int $layer): void $doc = preg_replace('|here \(layer \d+\)|', "here (layer $layer)", $doc); file_put_contents('docs/docs/docs/USING_METHODS.md', $doc); - array_map(unlink::class, glob('src/danog/MadelineProto/*.tl')); + array_map(unlink::class, glob('src/*.tl')); foreach (['TL_mtproto_v1', "TL_telegram_v$layer", 'TL_secret', 'TL_botAPI'] as $schema) { - copy("schemas/$schema.tl", "src/danog/MadelineProto/$schema.tl"); + copy("schemas/$schema.tl", "src/$schema.tl"); } - $doc = file_get_contents('src/danog/MadelineProto/Settings/TLSchema.php'); + $doc = file_get_contents('src/Settings/TLSchema.php'); preg_match("/layer = (\d+)/", $doc, $matches); $prevLayer = (int) $matches[1]; @@ -37,5 +37,5 @@ function layerUpgrade(int $layer): void $doc ); - file_put_contents('src/danog/MadelineProto/Settings/TLSchema.php', $doc); + file_put_contents('src/Settings/TLSchema.php', $doc); } diff --git a/tools/phar.php b/tools/phar.php index cb957f0b7..426df563a 100644 --- a/tools/phar.php +++ b/tools/phar.php @@ -171,7 +171,7 @@ class Installer \flock(self::$lock, LOCK_SH); $result = require_once $phar; if (\defined('MADELINE_WORKER_TYPE') && \constant('MADELINE_WORKER_TYPE') === 'madeline-ipc') { - require_once "phar://$phar/vendor/danog/madelineproto/src/danog/MadelineProto/Ipc/Runner/entry.php"; + require_once "phar://$phar/vendor/danog/madelineproto/src/Ipc/Runner/entry.php"; } return $result; } diff --git a/tools/translator.php b/tools/translator.php index dd24a50c0..c14dd243f 100644 --- a/tools/translator.php +++ b/tools/translator.php @@ -114,10 +114,10 @@ foreach (Lang::$current_lang as $key => $value) { if (in_array($key, ['v_error', 'v_tgerror'])) { Lang::$lang[$lang_code][$key] = bin2hex(Lang::$lang[$lang_code][$key]); } - file_put_contents('src/danog/MadelineProto/Lang.php', sprintf($template, var_export(Lang::$lang, true), var_export(Lang::$lang['en'], true))); - echo 'OK, '.($curcount * 100 / $count).'% done. edit src/danog/MadelineProto/Lang.php to fix mistakes.'.PHP_EOL; + file_put_contents('src/Lang.php', sprintf($template, var_export(Lang::$lang, true), var_export(Lang::$lang['en'], true))); + echo 'OK, '.($curcount * 100 / $count).'% done. edit src/Lang.php to fix mistakes.'.PHP_EOL; } $curcount++; } -file_put_contents('src/danog/MadelineProto/Lang.php', sprintf($template, var_export(Lang::$lang, true), var_export(Lang::$lang['en'], true))); -echo 'OK. edit src/danog/MadelineProto/Lang.php to fix mistakes.'.PHP_EOL; +file_put_contents('src/Lang.php', sprintf($template, var_export(Lang::$lang, true), var_export(Lang::$lang['en'], true))); +echo 'OK. edit src/Lang.php to fix mistakes.'.PHP_EOL;