-
-
Notifications
You must be signed in to change notification settings - Fork 245
Paginated pinned messages #1366
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
Merged
Merged
Conversation
This file contains hidden or 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
|
Tested and confirmed working. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
https://discord.com/developers/docs/change-log#paginated-pin-endpoints
This pull request introduces significant updates to the handling of pinned messages in both
Channel
andThread
classes, aligning with Discord's updated API endpoints and adding new functionality for pagination and improved type handling. The changes also include the addition of two new classes,MessagePin
andMessagePinData
, to encapsulate pinned message data. Below is a categorized summary of the most important changes:API Endpoint Updates and Pagination Support
getPinnedMessages
inChannel
andThread
to use the newCHANNEL_MESSAGES_PINS
endpoint, with added support for pagination vialimit
andbefore
options. This includes validation for permissions likeview_channel
andread_message_history
. ([[1]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-347cb634bd9dfce6baf790e117c398ae2c78812c67bfbbce182b3a32b4e1313fL301-R351)
,[[2]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-d8ef6d2acb3e5337f4b975c64a55437b1bc76c2f8312a8dd0912cf9e031594d5L478-R533)
)pinMessage
andunpinMessage
methods inChannel
andThread
to use the newCHANNEL_MESSAGES_PIN
endpoint for pinning and unpinning messages. ([[1]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-347cb634bd9dfce6baf790e117c398ae2c78812c67bfbbce182b3a32b4e1313fL962-R1000)
,[[2]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-347cb634bd9dfce6baf790e117c398ae2c78812c67bfbbce182b3a32b4e1313fL1003-R1043)
,[[3]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-d8ef6d2acb3e5337f4b975c64a55437b1bc76c2f8312a8dd0912cf9e031594d5L650-R686)
,[[4]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-d8ef6d2acb3e5337f4b975c64a55437b1bc76c2f8312a8dd0912cf9e031594d5L686-R722)
)New Classes for Pinned Message Data
MessagePin
class to represent individual pinned messages with theirpinned_at
timestamp and correspondingMessage
object. ([src/Discord/Parts/Channel/Message/MessagePin.phpR1-R49](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-db162fcf07afe760466cdb97e45a3b766b5a4c2fde90c0a7ca0a4e9f483bbba0R1-R49)
)MessagePinData
class to represent a collection of pinned messages and ahas_more
flag for pagination. ([src/Discord/Parts/Channel/Message/MessagePinData.phpR1-R51](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-2d9d8f7c548f3dd3df122292456eace6272f85ab03aa5e1cc72bbff780976b45R1-R51)
)Documentation and Code Consistency
Channel
andThread
to reflect the new endpoints and the addition of pagination options. ([[1]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-347cb634bd9dfce6baf790e117c398ae2c78812c67bfbbce182b3a32b4e1313fL301-R351)
,[[2]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-d8ef6d2acb3e5337f4b975c64a55437b1bc76c2f8312a8dd0912cf9e031594d5L478-R533)
)[[1]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-347cb634bd9dfce6baf790e117c398ae2c78812c67bfbbce182b3a32b4e1313fL931-R977)
,[[2]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-347cb634bd9dfce6baf790e117c398ae2c78812c67bfbbce182b3a32b4e1313fL972-R1010)
,[[3]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-d8ef6d2acb3e5337f4b975c64a55437b1bc76c2f8312a8dd0912cf9e031594d5L478-R533)
)Miscellaneous
MessagePinData
to imports inChannel
andThread
classes to support the new functionality. ([[1]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-347cb634bd9dfce6baf790e117c398ae2c78812c67bfbbce182b3a32b4e1313fR39)
,[[2]](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-d8ef6d2acb3e5337f4b975c64a55437b1bc76c2f8312a8dd0912cf9e031594d5R24)
)resolve
function inThread
to handle cases where no pinned messages are returned due to missing permissions. ([src/Discord/Parts/Thread/Thread.phpR44](https://github.com/discord-php/DiscordPHP/pull/1366/files#diff-d8ef6d2acb3e5337f4b975c64a55437b1bc76c2f8312a8dd0912cf9e031594d5R44)
)