Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
amirrh6 committed Nov 30, 2024
1 parent 79585a4 commit e36e46b
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 115 deletions.
28 changes: 16 additions & 12 deletions examples/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ function dump(mixed ...$vars)

runExampleForGetMe();

runExampleForSendMessage();
$sentMessage1Id = runExampleForSendMessage();

runExampleForSendPhoto();
$sentMessage2Id = runExampleForSendPhoto();

runExampleFor_bulkCopyMessage();
runExampleFor_bulkCopyMessage($sentMessage1Id, $sentMessage2Id);
} catch (\Throwable $th) {
dump('Exception:', $th);
}
Expand Down Expand Up @@ -69,7 +69,7 @@ function runExampleForGetMe()
token: $token,
guzzle_options: $guzzle_options,
);
dump('Result:', $res);
dump($res);
}

function runExampleForSendMessage()
Expand All @@ -92,7 +92,9 @@ function runExampleForSendMessage()
),
guzzle_options: $guzzle_options,
);
dump('Result:', $res);
dump($res);

return $res->message_id;
}

function runExampleForSendPhoto()
Expand All @@ -110,10 +112,12 @@ function runExampleForSendPhoto()
),
guzzle_options: $guzzle_options,
);
dump('Result:', $res);
dump($res);

return $res->message_id;
}

function runExampleFor_bulkCopyMessage()
function runExampleFor_bulkCopyMessage(int $message1Id, int $message2Id)
{
global $token, $some_chat_id, $guzzle_options;

Expand All @@ -125,27 +129,27 @@ function runExampleFor_bulkCopyMessage()
new CopyMessageParams(
chat_id: $some_chat_id,
from_chat_id: $some_chat_id,
message_id: 325,
message_id: $message1Id,
caption: 'Copied the message and changed the caption!',
reply_parameters: new ReplyParameters(
message_id: 325,
message_id: $message1Id,
chat_id: $some_chat_id,
allow_sending_without_reply: true,
),
),
new CopyMessageParams(
chat_id: $some_chat_id,
from_chat_id: $some_chat_id,
message_id: 326,
message_id: $message2Id,
caption: 'Copied the message and changed the caption!',
reply_parameters: new ReplyParameters(
message_id: 326,
message_id: $message2Id,
chat_id: $some_chat_id,
allow_sending_without_reply: true,
),
),
],
guzzle_options: $guzzle_options,
);
dump('Result:', $promise->wait());
dump($promise->wait());
}
Loading

0 comments on commit e36e46b

Please sign in to comment.