-
-
Notifications
You must be signed in to change notification settings - Fork 736
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
Implement access and retrieval of message_reference #1686
Implement access and retrieval of message_reference #1686
Conversation
src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java
Outdated
Show resolved
Hide resolved
Bump |
Sorry about the late commit, i never received the notifications for this PR. |
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.
Please add back the things for referenced message that you removed.
src/main/java/net/dv8tion/jda/internal/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Florian Spieß <[email protected]>
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Florian Spieß <[email protected]>
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Florian Spieß <[email protected]>
Co-authored-by: Florian Spieß <[email protected]>
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Florian Spieß <[email protected]>
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.
Almost there
? referencedMessage.getTextChannel() | ||
: api.getTextChannelById(channelId); | ||
|
||
if (tc == null) |
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.
To prepare for threads we should do:
if (guildId == 0L)
this.channel = api.getPrivateChannelById(channelId);
else
this.channel = (MessageChannel) api.getGuildChannelById(channelId);
this.guild = api.getGuildById(guild); // is null if guildId = 0 anyway
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.
I assume we just trust that the API gave us the ID for a message channel? Is it worth instaneof checking it
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.
Well messages should only ever be inside message channels, if discord changes this that would break lots of things anyway.
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/api/entities/MessageReference.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Florian Spieß <[email protected]>
Pull Request Etiquette
Changes
Closes Issue: NaN
Description
This PR adds support for retrieving referenced message in cases where discord does not provide one. It also adds a MessageReference class which wraps the message_reference value seen in a message's json. It also adds some getters for referenced message id