mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 09:34:38 +01:00
Bugfixes
This commit is contained in:
parent
f63fd6fecf
commit
2cfc97b6bd
@ -10,7 +10,6 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require '../vendor/autoload.php';
|
||||
$settings = [];
|
||||
include_once 'token.php';
|
||||
@ -159,7 +158,7 @@ var_dump($update);
|
||||
foreach ($mtproto as $key => $n) {
|
||||
$message .= $key.' ('.$n.'): not found'.PHP_EOL;
|
||||
}
|
||||
$MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => $message, 'reply_to_msg_id' => $update['update']['message']['id'], 'parse_mode' => 'html']);
|
||||
$MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => $message, 'reply_to_msg_id' => $update['update']['message']['id'], 'parse_mode' => 'markdown']);
|
||||
}
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
|
||||
|
@ -316,7 +316,7 @@ trait PeerHandler
|
||||
$res['bot_info'] = $full['full']['bot_info'];
|
||||
}
|
||||
if (isset($full['full']['profile_photo']['sizes'])) {
|
||||
$res['photo'] = $this->photosize_to_botapi(end($full['full']['profile_photo']['sizes']), $full['User']);
|
||||
$res['photo'] = $this->photosize_to_botapi(end($full['full']['profile_photo']['sizes']), []);
|
||||
}
|
||||
$bio = '';
|
||||
if ($full['type'] === 'user' && isset($res['username']) && !isset($res['about']) && $fullfetch) {
|
||||
@ -338,7 +338,7 @@ trait PeerHandler
|
||||
}
|
||||
|
||||
if (isset($full['full']['chat_photo']['sizes'])) {
|
||||
$res['photo'] = $this->photosize_to_botapi(end($full['full']['chat_photo']['sizes']), $full['Chat']);
|
||||
$res['photo'] = $this->photosize_to_botapi(end($full['full']['chat_photo']['sizes']), []);
|
||||
}
|
||||
if (isset($full['full']['exported_invite']['link'])) {
|
||||
$res['invite'] = $full['full']['exported_invite']['link'];
|
||||
@ -361,7 +361,7 @@ trait PeerHandler
|
||||
}
|
||||
|
||||
if (isset($full['full']['chat_photo']['sizes'])) {
|
||||
$res['photo'] = $this->photosize_to_botapi(end($full['full']['chat_photo']['sizes']), $full['Chat']);
|
||||
$res['photo'] = $this->photosize_to_botapi(end($full['full']['chat_photo']['sizes']), []);
|
||||
}
|
||||
if (isset($full['full']['exported_invite']['link'])) {
|
||||
$res['invite'] = $full['full']['exported_invite']['link'];
|
||||
|
@ -105,7 +105,7 @@ trait Files
|
||||
public function photosize_to_botapi($photo, $message_media, $thumbnail = false)
|
||||
{
|
||||
$ext = $this->get_extension_from_location(['_' => 'inputFileLocation', 'volume_id' => $photo['location']['volume_id'], 'local_id' => $photo['location']['local_id'], 'secret' => $photo['location']['secret'], 'dc_id' => $photo['location']['dc_id']], '.jpg');
|
||||
$data = \danog\PHP\Struct::pack('<iiqqqqib', $thumbnail ? 0 : 2, $photo['location']['dc_id'], $thumbnail ? 0 : $message_media['id'], $thumbnail ? 0 : $message_media['access_hash'], $photo['location']['volume_id'], $photo['location']['secret'], $photo['location']['local_id'], 2);
|
||||
$data = \danog\PHP\Struct::pack('<iiqqqqib', $thumbnail ? 0 : 2, $photo['location']['dc_id'], isset($message_media['id']) ? $message_media['id'] : 0, isset($message_media['access_hash']) ? $message_media['access_hash'] : 0, $photo['location']['volume_id'], $photo['location']['secret'], $photo['location']['local_id'], 2);
|
||||
|
||||
return [
|
||||
'file_id' => $this->base64url_encode($this->rle_encode($data)),
|
||||
|
@ -148,7 +148,7 @@ trait TL
|
||||
case 'double':
|
||||
return \danog\PHP\Struct::pack('<d', $object);
|
||||
case 'string':
|
||||
$object = utf8_decode($object);
|
||||
$object = pack('C*', ...unpack('C*', $object));
|
||||
case 'bytes':
|
||||
$l = strlen($object);
|
||||
$concat = '';
|
||||
@ -460,7 +460,7 @@ trait TL
|
||||
$type_name = 'document';
|
||||
$res = [];
|
||||
if ($data['document']['thumb']['_'] === 'photoSize') {
|
||||
$res['thumb'] = $this->photosize_to_botapi($data['document']['thumb'], $data['document'], true);
|
||||
$res['thumb'] = $this->photosize_to_botapi($data['document']['thumb'], [], true);
|
||||
}
|
||||
foreach ($data['document']['attributes'] as $attribute) {
|
||||
switch ($attribute['_']) {
|
||||
@ -644,7 +644,7 @@ trait TL
|
||||
$nmessage = '';
|
||||
try {
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadHTML($arguments['message']);
|
||||
$dom->loadHTML(mb_convert_encoding($arguments['message'], 'HTML-ENTITIES', 'UTF-8'));
|
||||
if (!isset($arguments['entities'])) {
|
||||
$arguments['entities'] = [];
|
||||
}
|
||||
@ -657,7 +657,6 @@ trait TL
|
||||
}
|
||||
$arguments['message'] = $nmessage;
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user