Bugfix
This commit is contained in:
parent
f4155bc3a7
commit
1f18cf6ab9
@ -18,12 +18,12 @@ $uMadelineProto = false;
|
|||||||
try {
|
try {
|
||||||
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('pipesbot.madeline');
|
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('pipesbot.madeline');
|
||||||
} catch (\danog\MadelineProto\Exception $e) {
|
} catch (\danog\MadelineProto\Exception $e) {
|
||||||
\danog\MadelineProto\Logger::log([$e->getMessage()]);
|
var_dump($e->getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$uMadelineProto = \danog\MadelineProto\Serialization::deserialize('pwr.madeline');
|
$uMadelineProto = \danog\MadelineProto\Serialization::deserialize('pwr.madeline');
|
||||||
} catch (\danog\MadelineProto\Exception $e) {
|
} catch (\danog\MadelineProto\Exception $e) {
|
||||||
\danog\MadelineProto\Logger::log([$e->getMessage()]);
|
var_dump($e->getMessage());
|
||||||
}
|
}
|
||||||
if (file_exists('token.php') && $MadelineProto === false) {
|
if (file_exists('token.php') && $MadelineProto === false) {
|
||||||
include_once 'token.php';
|
include_once 'token.php';
|
||||||
@ -108,6 +108,7 @@ while (true) {
|
|||||||
$updates = $MadelineProto->API->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout
|
$updates = $MadelineProto->API->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout
|
||||||
foreach ($updates as $update) {
|
foreach ($updates as $update) {
|
||||||
$offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id
|
$offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id
|
||||||
|
try {
|
||||||
switch ($update['update']['_']) {
|
switch ($update['update']['_']) {
|
||||||
case 'updateNewMessage':
|
case 'updateNewMessage':
|
||||||
if (isset($update['update']['message']['out']) && $update['update']['message']['out']) {
|
if (isset($update['update']['message']['out']) && $update['update']['message']['out']) {
|
||||||
@ -217,6 +218,8 @@ while (true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (\danog\MadelineProto\RPCErrorException $e) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
\danog\MadelineProto\Serialization::serialize('pipesbot.madeline', $MadelineProto);
|
\danog\MadelineProto\Serialization::serialize('pipesbot.madeline', $MadelineProto);
|
||||||
\danog\MadelineProto\Serialization::serialize('pwr.madeline', $uMadelineProto);
|
\danog\MadelineProto\Serialization::serialize('pwr.madeline', $uMadelineProto);
|
||||||
|
@ -414,7 +414,6 @@ trait BotAPI
|
|||||||
if (preg_match('|:new|', substr($href, -4))) {
|
if (preg_match('|:new|', substr($href, -4))) {
|
||||||
$entities['buttons'][] = ['_' => 'keyboardButtonUrl', 'text' => $text, 'url' => str_replace('buttonurl:', '', str_replace(':new', '', $href)), 'new' => true];
|
$entities['buttons'][] = ['_' => 'keyboardButtonUrl', 'text' => $text, 'url' => str_replace('buttonurl:', '', str_replace(':new', '', $href)), 'new' => true];
|
||||||
} else {
|
} else {
|
||||||
var_dump(true);
|
|
||||||
$entities['buttons'][] = ['_' => 'keyboardButtonUrl', 'text' => $text, 'url' => str_replace('buttonurl:', '', $href)];
|
$entities['buttons'][] = ['_' => 'keyboardButtonUrl', 'text' => $text, 'url' => str_replace('buttonurl:', '', $href)];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -468,7 +467,12 @@ trait BotAPI
|
|||||||
public function split_to_chunks($text)
|
public function split_to_chunks($text)
|
||||||
{
|
{
|
||||||
$total_length = 4096;
|
$total_length = 4096;
|
||||||
$text_arr = $this->multipleExplodeKeepDelimiters(["\n"], $text);
|
$text_arr = [];
|
||||||
|
foreach ($this->multipleExplodeKeepDelimiters(["\n"], $text) as $word) {
|
||||||
|
if (strlen($word) > 4096) {
|
||||||
|
foreach (str_split($word, 4096) as $vv) { $text_arr []= $vv; }
|
||||||
|
} else $text_arr []= $word;
|
||||||
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$message[0] = '';
|
$message[0] = '';
|
||||||
foreach ($text_arr as $word) {
|
foreach ($text_arr as $word) {
|
||||||
@ -497,7 +501,7 @@ trait BotAPI
|
|||||||
$finalArray = [];
|
$finalArray = [];
|
||||||
foreach ($initialArray as $item) {
|
foreach ($initialArray as $item) {
|
||||||
if (strlen($item) > 0) {
|
if (strlen($item) > 0) {
|
||||||
array_push($finalArray, $item.$string[strpos($string, $item) + strlen($item)]);
|
$finalArray []= $item.$string[strpos($string, $item)+strlen($item)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user