1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 20:35:23 +01:00
This commit is contained in:
Daniil Gentili 2022-07-26 17:46:18 +02:00
parent 6c75e08ee7
commit 2a0d9a22e7
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
9 changed files with 251 additions and 240 deletions

2
docs

@ -1 +1 @@
Subproject commit 60e196b7ac6a67aa0a9192646d2153d530e33610
Subproject commit e3b7940ee5f8cfd7bdcf347a202491394dd7e1d2

View File

@ -12,6 +12,7 @@
<directory name="vendor" />
<file name="src/danog/MadelineProto/InternalDoc.php" />
<file name="src/danog/MadelineProto/TON/InternalDoc.php" />
<file name="src/danog/MadelineProto/Lua.php" />
</ignoreFiles>
</projectFiles>
</psalm>

View File

@ -170,6 +170,14 @@ trait Constructors
if ($param['name'] === 'reply_markup') {
$hasreplymarkup = true;
}
if ($param['name'] === 'entities' && $ptype === 'InputSingleMedia') {
$hasentities = true;
$table .= '|parse\\_mode| [string](/API_docs/types/string.md) | Whether to parse HTML or Markdown markup in the message| Optional |
';
$params .= "parse_mode: 'string', ";
$lua_params .= "parseMode='string', ";
$pwr_params = "parseMode - string\n";
}
}
$params = "['_' => '".$constructor."'".$params.']';
$lua_params = "{_='".$constructor."'".$lua_params.'}';

View File

@ -7232,7 +7232,7 @@ class InternalDoc extends APIFactory
/**
* Refresh full peer cache for a certain peer.
*
* @param mixed $id
* @param mixed $id The peer to refresh
* @return \Amp\Promise
*/
public function refreshFullPeerCache($id, array $extra = [])
@ -7242,7 +7242,7 @@ class InternalDoc extends APIFactory
/**
* Refresh peer cache for a certain peer.
*
* @param mixed $id
* @param mixed $id The peer to refresh
* @return \Amp\Promise
*/
public function refreshPeerCache($id, array $extra = [])

View File

@ -67,7 +67,6 @@ class MTProto extends AsyncConstruct implements TLCallback
use \danog\MadelineProto\SecretChats\ResponseHandler;
use \danog\MadelineProto\SecretChats\SeqNoHandler;
use \danog\MadelineProto\TL\Conversion\BotAPI;
use \danog\MadelineProto\TL\Conversion\Entities;
use \danog\MadelineProto\TL\Conversion\BotAPIFiles;
use \danog\MadelineProto\TL\Conversion\TD;
use \danog\MadelineProto\VoIP\AuthKeyHandler;
@ -113,7 +112,7 @@ class MTProto extends AsyncConstruct implements TLCallback
*
* @var int
*/
const V = 158;
const V = 157;
/**
* Release version.
*

View File

@ -816,7 +816,7 @@ trait PeerHandler
/**
* Refresh peer cache for a certain peer.
*
* @param mixed $id
* @param mixed $id The peer to refresh
* @return \Generator
*/
public function refreshPeerCache($id): \Generator
@ -831,7 +831,7 @@ trait PeerHandler
/**
* Refresh full peer cache for a certain peer.
*
* @param mixed $id
* @param mixed $id The peer to refresh
* @return \Generator
*/
public function refreshFullPeerCache($id): \Generator

View File

@ -373,13 +373,13 @@ trait BotAPI
$arguments['parse_mode'] = \str_replace('textParseMode', '', $arguments['parse_mode']['_']);
}
if (\stripos($arguments['parse_mode'], 'markdown') !== false) {
[$arguments['message'],$arguments['entities']] = $this->parseText(($arguments['message']),'markdown');
[$arguments['message'],$arguments['entities']] = $this->parseText(($arguments['message']), 'markdown');
}
if (\stripos($arguments['parse_mode'], 'html') !== false) {
[$arguments['message'],$arguments['entities']] = $this->parseText(($arguments['message']),'html');
[$arguments['message'],$arguments['entities']] = $this->parseText(($arguments['message']), 'html');
/**
* deprecated future or you can fix it in future
* deprecated future or you can fix it in future.
* @deprecated
*/
/*
@ -387,13 +387,12 @@ trait BotAPI
$arguments['reply_markup'] = $this->buildRows($arguments['entities']['buttons']);
unset($arguments['entities']['buttons']);
} */
}
/**
* this is new future added! but for use must scape some special chars ...
*/
if(\stripos($arguments['parse_mode'], 'combined') !== false){
[$arguments['message'],$arguments['entities']] = yield $this->parseText(\trim($arguments['message']),'markdownhtml');
if (\stripos($arguments['parse_mode'], 'combined') !== false) {
[$arguments['message'],$arguments['entities']] = yield $this->parseText(\trim($arguments['message']), 'markdownhtml');
}
unset($arguments['parse_mode']);
return $arguments;

File diff suppressed because it is too large Load Diff

View File

@ -283,11 +283,20 @@ $MadelineProto->loop(function () use ($MadelineProto) {
$mention = yield $MadelineProto->getInfo(\getenv('TEST_USERNAME')); // Returns an array with all of the constructors that can be extracted from a username or an id
$mention = $mention['user_id']; // Selects only the numeric user id
foreach (\json_decode(\getenv('TEST_DESTINATION_GROUPS'), true) as $peer) {
$peers = \json_decode(\getenv('TEST_DESTINATION_GROUPS'), true);
if (!$peers) {
die("No TEST_DESTINATION_GROUPS array was provided!");
}
foreach ($peers as $peer) {
$sentMessage = yield $MadelineProto->messages->sendMessage(['peer' => $peer, 'message' => $message, 'entities' => [['_' => 'inputMessageEntityMentionName', 'offset' => 0, 'length' => \mb_strlen($message), 'user_id' => $mention]]]);
$MadelineProto->logger($sentMessage, \danog\MadelineProto\Logger::NOTICE);
foreach ($media as $type => $inputMedia) {
$MadelineProto->logger("Sending multi $type");
yield $MadelineProto->messages->sendMultiMedia(['peer' => $peer, 'multi_media' => [
['_' => 'inputSingleMedia', 'media' => $inputMedia, 'message' => '['.$message.'](mention:'.$mention.')', 'parse_mode' => 'markdown'],
['_' => 'inputSingleMedia', 'media' => $inputMedia, 'message' => '['.$message.'](mention:'.$mention.')', 'parse_mode' => 'markdown'],
]]);
$MadelineProto->logger("Sending $type");
yield $MadelineProto->messages->sendMedia(['peer' => $peer, 'media' => $inputMedia, 'message' => '['.$message.'](mention:'.$mention.')', 'parse_mode' => 'markdown']);
$MadelineProto->logger("Uploading $type");