-
-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Some Bounded methods #1395
Merged
Merged
Add Some Bounded methods #1395
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
0f960b9
Add class for result of channels.getParticipant
ahjdev a9fc8bc
add/reomve methods
ahjdev 586f11d
add some methods
ahjdev d0f3002
add some methods
ahjdev c135261
Change descroption
ahjdev e424c0d
change add/remove to save/unsave method
ahjdev 4b1cbb1
add description for param
ahjdev 8522593
fix data type, change method
ahjdev 4996949
remove duplicate property
ahjdev e295693
make class as abstract
ahjdev 9c48c5d
make class as final
ahjdev eae2256
fix array key
ahjdev adbed66
Update ChannelMessage.php
danog ecbf46e
Update GroupMessage.php
danog a7c4eec
Update ChannelMessage.php
danog 9c4e852
Add screenShot method
ahjdev 66d2e4f
new service message class
ahjdev e5ce171
handle messageActionScreenshotTaken in wrapMessage method
ahjdev 349cdaf
Update Banned.php
danog 6694f5e
Update ChannelMessage.php
danog 0cb77bd
new block/unblock method
ahjdev b7292fa
Add more Dialogs
ahjdev cb503d3
Delete unused Classes
ahjdev 54eb52d
Merge branch 'danog:v8' into bounded-methods
ahjdev fcc0b6b
Clear GroupCall classes
ahjdev dc012cb
Fix PhoneCall & DiscardReason
ahjdev 48983ee
fixing
ahjdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/EventHandler/Message/Service/DialogScreenshotTaken.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of MadelineProto. | ||
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
* MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* 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/>. | ||
* | ||
* @author Daniil Gentili <daniil@daniil.it> | ||
* @copyright 2016-2023 Daniil Gentili <daniil@daniil.it> | ||
* @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 | ||
* @link https://docs.madelineproto.xyz MadelineProto documentation | ||
*/ | ||
|
||
namespace danog\MadelineProto\EventHandler\Message\Service; | ||
|
||
use danog\MadelineProto\EventHandler\Message\ServiceMessage; | ||
use danog\MadelineProto\MTProto; | ||
|
||
/** | ||
* A message was pinned in a chat. | ||
*/ | ||
final class DialogScreenshotTaken extends ServiceMessage | ||
{ | ||
public function __construct( | ||
MTProto $API, | ||
array $rawMessage, | ||
array $info, | ||
) { | ||
parent::__construct($API, $rawMessage, $info); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of MadelineProto. | ||
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
* MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* 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/>. | ||
* | ||
* @author Daniil Gentili <daniil@daniil.it> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW you can put yourself as author on the files you made :) |
||
* @copyright 2016-2023 Daniil Gentili <daniil@daniil.it> | ||
* @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 | ||
* @link https://docs.madelineproto.xyz MadelineProto documentation | ||
*/ | ||
|
||
namespace danog\MadelineProto\EventHandler; | ||
|
||
use danog\MadelineProto\MTProto; | ||
use JsonSerializable; | ||
use ReflectionClass; | ||
use ReflectionProperty; | ||
|
||
/** | ||
* Info about a channel participant | ||
*/ | ||
abstract class Participant implements JsonSerializable | ||
{ | ||
/** @internal */ | ||
public function jsonSerialize(): mixed | ||
{ | ||
$res = ['_' => static::class]; | ||
$refl = new ReflectionClass($this); | ||
foreach ($refl->getProperties(ReflectionProperty::IS_PUBLIC) as $prop) { | ||
$res[$prop->getName()] = $prop->getValue($this); | ||
} | ||
return $res; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of MadelineProto. | ||
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
* MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* 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/>. | ||
* | ||
* @author Daniil Gentili <daniil@daniil.it> | ||
* @copyright 2016-2023 Daniil Gentili <daniil@daniil.it> | ||
* @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 | ||
* @link https://docs.madelineproto.xyz MadelineProto documentation | ||
*/ | ||
|
||
namespace danog\MadelineProto\EventHandler\Participant; | ||
|
||
use danog\MadelineProto\EventHandler\Participant; | ||
use danog\MadelineProto\EventHandler\Participant\Rights\Admin as AdminRights; | ||
|
||
/** | ||
* Admin | ||
*/ | ||
final class Admin extends Participant | ||
{ | ||
/** Can this admin promote other admins with the same permissions? */ | ||
public readonly bool $canEdit; | ||
|
||
/** Is this the current user */ | ||
public readonly bool $self; | ||
|
||
/** Admin user ID */ | ||
public readonly int $userId; | ||
|
||
/** User that invited the admin to the channel/group */ | ||
public readonly ?int $inviterId; | ||
|
||
/** User that promoted the user to admin */ | ||
public readonly int $promotedBy; | ||
|
||
/** When did the user join */ | ||
public readonly int $date; | ||
|
||
/** Admin [rights](https://core.telegram.org/api/rights) */ | ||
public readonly AdminRights $adminRights; | ||
|
||
/** The role (rank) of the admin in the group: just an arbitrary string, `admin` by default */ | ||
public readonly string $rank; | ||
|
||
/** @internal */ | ||
public function __construct( | ||
array $rawParticipant | ||
) { | ||
$this->canEdit = $rawParticipant['can_edit']; | ||
$this->self = $rawParticipant['self']; | ||
$this->userId = $rawParticipant['user_id']; | ||
$this->inviterId = $rawParticipant['inviter_id'] ?? null; | ||
$this->promotedBy = $rawParticipant['promoted_by']; | ||
$this->date = $rawParticipant['date']; | ||
$this->rank = $rawParticipant['rank'] ?? 'admin'; | ||
$this->adminRights = new AdminRights($rawParticipant['admin_rights']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of MadelineProto. | ||
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
* MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* 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/>. | ||
* | ||
* @author Daniil Gentili <daniil@daniil.it> | ||
* @copyright 2016-2023 Daniil Gentili <daniil@daniil.it> | ||
* @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 | ||
* @link https://docs.madelineproto.xyz MadelineProto documentation | ||
*/ | ||
|
||
namespace danog\MadelineProto\EventHandler\Participant; | ||
|
||
use danog\MadelineProto\EventHandler\Participant; | ||
use danog\MadelineProto\EventHandler\Participant\Rights\Banned as BannedRights; | ||
use danog\MadelineProto\MTProto; | ||
|
||
/** | ||
* Banned/kicked user | ||
*/ | ||
final class Banned extends Participant | ||
{ | ||
/** Whether the user has left the group */ | ||
public readonly bool $left; | ||
|
||
/** The banned peer */ | ||
public readonly int $peer; | ||
|
||
/** User was kicked by the specified admin */ | ||
public readonly int $kickedBy; | ||
|
||
/** When did the user join the group */ | ||
public readonly ?int $date; | ||
|
||
/** Banned [rights](https://core.telegram.org/api/rights) */ | ||
public readonly BannedRights $bannedRights; | ||
|
||
/** @internal */ | ||
public function __construct( | ||
MTProto $API, | ||
array $rawParticipant | ||
) { | ||
$this->left = $rawParticipant['left']; | ||
$this->peer = $API->getIdInternal ($rawParticipant['peer']); | ||
$this->kickedBy = $rawParticipant['kicked_by']; | ||
$this->date = $rawParticipant['date']; | ||
$this->bannedRights = new BannedRights($rawParticipant['banned_rights']); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can return void in both