Apply fixes from StyleCI
This commit is contained in:
parent
c1e2c93af7
commit
33d95dab58
@ -54,7 +54,7 @@ class Logger
|
||||
self::$default = new self($mode, $optional, $prefix, $level, $max_size);
|
||||
}
|
||||
|
||||
public function __construct($mode, $optional = null, $prefix = '', $level = self::NOTICE, $max_size = 100*1024*1024)
|
||||
public function __construct($mode, $optional = null, $prefix = '', $level = self::NOTICE, $max_size = 100 * 1024 * 1024)
|
||||
{
|
||||
if ($mode === null) {
|
||||
throw new Exception(\danog\MadelineProto\Lang::$current_lang['no_mode_specified']);
|
||||
|
@ -542,7 +542,7 @@ trait AuthKeyHandler
|
||||
$this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['gen_perm_auth_key'], $id), \danog\MadelineProto\Logger::NOTICE);
|
||||
$socket->auth_key = $this->create_auth_key(-1, $id);
|
||||
$socket->authorized = false;
|
||||
} else if ($socket->auth_key === null && $media) {
|
||||
} elseif ($socket->auth_key === null && $media) {
|
||||
$socket->auth_key = $this->datacenter->sockets[intval($id)]->auth_key;
|
||||
$socket->authorized = $this->datacenter->sockets[intval($id)]->authorized;
|
||||
}
|
||||
|
@ -340,7 +340,6 @@ trait ResponseHandler
|
||||
$aargs['datacenter'] .= '_media';
|
||||
}
|
||||
|
||||
|
||||
throw new \danog\MadelineProto\Exception('Received request to switch to DC '.$this->datacenter->curdc);
|
||||
case 401:
|
||||
switch ($server_answer['error_message']) {
|
||||
|
@ -506,15 +506,15 @@ trait BotAPI
|
||||
$offset = 0;
|
||||
foreach ($args['entities'] as $entity) {
|
||||
do {
|
||||
while ($entity['offset'] > $offset+$this->mb_strlen($multiple_args[$i]['message'])) {
|
||||
while ($entity['offset'] > $offset + $this->mb_strlen($multiple_args[$i]['message'])) {
|
||||
$offset += $this->mb_strlen($multiple_args[$i]['message']);
|
||||
$i++;
|
||||
}
|
||||
$entity['offset'] -= $offset;
|
||||
if ($entity['offset']+$entity['length'] > $this->mb_strlen($multiple_args[$i]['message'])) {
|
||||
if ($entity['offset'] + $entity['length'] > $this->mb_strlen($multiple_args[$i]['message'])) {
|
||||
$newentity = $entity;
|
||||
$newentity['length'] = $entity['length']-($this->mb_strlen($multiple_args[$i]['message'])-$entity['offset']);
|
||||
$entity['length'] = $this->mb_strlen($multiple_args[$i]['message'])-$entity['offset'];
|
||||
$newentity['length'] = $entity['length'] - ($this->mb_strlen($multiple_args[$i]['message']) - $entity['offset']);
|
||||
$entity['length'] = $this->mb_strlen($multiple_args[$i]['message']) - $entity['offset'];
|
||||
$multiple_args[$i]['entities'][] = $entity;
|
||||
|
||||
$offset += $this->mb_strlen($multiple_args[$i]['message']);
|
||||
@ -529,6 +529,7 @@ trait BotAPI
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
return $multiple_args;
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,8 @@ namespace danog\MadelineProto\Wrappers;
|
||||
*/
|
||||
trait TOS
|
||||
{
|
||||
public function check_tos()
|
||||
{
|
||||
public function check_tos()
|
||||
{
|
||||
if ($this->authorized === self::LOGGED_IN && !$this->get_self()['bot']) {
|
||||
if ($this->tos['expires'] < time()) {
|
||||
$this->logger->logger('Fetching TOS...');
|
||||
|
@ -45,10 +45,8 @@ echo 'Loading MadelineProto...'.PHP_EOL;
|
||||
|
||||
$MadelineProto = new \danog\MadelineProto\API(getcwd().'/testing.madeline', $settings);
|
||||
|
||||
|
||||
$MadelineProto->messages->sendMessage(['peer' => '@pwrtelegramgroupita', 'message' => '<b>'.str_repeat('a b c d', 700).'</b>', 'parse_mode' => 'markdown']);
|
||||
|
||||
|
||||
try {
|
||||
$MadelineProto->get_self();
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
@ -272,5 +270,3 @@ foreach (json_decode(getenv('TEST_DESTINATION_GROUPS'), true) as $peer) {
|
||||
$sentMessage = $MadelineProto->messages->sendMessage(['peer' => $peer, 'message' => $message, 'entities' => [['_' => 'inputMessageEntityMentionName', 'offset' => 0, 'length' => mb_strlen($message), 'user_id' => $mention]]]);
|
||||
\danog\MadelineProto\Logger::log($sentMessage, \danog\MadelineProto\Logger::NOTICE);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user