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 support for guild welcome screens #1989
Conversation
* @return The id of the emote that is used for this recommended channel or {@code null} | ||
*/ | ||
@Nullable | ||
public String getEmoteId() |
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'm not sure whether I should wrap this (while removing the getter below) into an Emoji
object instead. The class constructor accepts the animated
field which we can't know, but a recommended channel's emote can be animated.
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't tell by the emote's id via something like a_
prefix or whatever?
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.
no, the object only contains the emote id and name, not the hash
* | ||
* <p>Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} include: | ||
* <ul> | ||
* <li>{@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_GUILD_WELCOME_SCREEN Unknown Guild Welcome Screen} |
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 wonder if we should convert this error into a null
instead of forcing users to handle it as a user.
* @see Guild#retrieveWelcomeScreen() | ||
* @see Invite.Guild#getWelcomeScreen() | ||
*/ | ||
public class GuildWelcomeScreen |
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.
This should have a getGuild
getter
@Nullable | ||
public BaseGuildMessageChannel getChannel() | ||
{ | ||
return (BaseGuildMessageChannel) api.getGuildChannelById(id); |
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.
This is questionable as I could see ForumChannels being a recommendable channel in the future.
* @return The id of the emote that is used for this recommended channel or {@code null} | ||
*/ | ||
@Nullable | ||
public String getEmoteId() |
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't tell by the emote's id via something like a_
prefix or whatever?
* @return The name of the emoji that is used for this recommended channel or {@code null} | ||
*/ | ||
@Nullable | ||
public String getEmojiName() |
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.
So this method can return a name or a unicode emoji? Yeah, not sure how to feel about that representation given the method naming..
* @return The welcome screen of this Guild or {@code null} | ||
*/ | ||
@Nullable | ||
GuildWelcomeScreen getWelcomeScreen(); |
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.
So all resolved invites have this information, but the Guild itself doesnt? Curious
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.
exactly, you have to retrieve it yourself.
welcomeChannels.add(new GuildWelcomeScreen.Channel(api, welcomeChannelObj.getLong("channel_id"), welcomeChannelObj.getString("description"), | ||
welcomeChannelObj.getString("emoji_id", null), welcomeChannelObj.getString("emoji_name", 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.
welcomeChannels.add(new GuildWelcomeScreen.Channel(api, welcomeChannelObj.getLong("channel_id"), welcomeChannelObj.getString("description"), | |
welcomeChannelObj.getString("emoji_id", null), welcomeChannelObj.getString("emoji_name", null))); | |
welcomeChannels.add(new GuildWelcomeScreen.Channel( | |
api, | |
welcomeChannelObj.getLong("channel_id"), | |
welcomeChannelObj.getString("description"), | |
welcomeChannelObj.getString("emoji_id", null), | |
welcomeChannelObj.getString("emoji_name", null) | |
)); |
We should probably include creation/mutation of GuildWelcomeScreens in this PR instead of providing only read-only access. We can likely use a simple builder system like we do with EntityBuilder to build it up. |
Something else that I forgot to mention is that |
it's intentionally in its own file because it has an inner |
I don't personally see a problem with In contrast, something like |
Hey any updates on this one? |
not right now, no. I won't have time for the next 2-3 weeks, so if someone wants to tackle this earlier, let me know. |
Yeah choosing a good design for modifying the welcome screen seems tricky. One possible design could be to have a welcome screen manager, with methods such as |
Closing due to inactivity. If anyone wants to continue this based on the current master branch, feel free to open a new PR. |
Pull Request Etiquette
Changes
Closes Issue: #1987
Description
this PR adds support for Guild welcome screens. this currently doesn't support modifying the welcome screen as I'm still figuring out a good design.