-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
Change the occourences of discordapp.com to discord.com #555
Conversation
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 think you forgot some.
When I write discordapp
in my IDE, I found 53 occuration
Maybe a good solution will be to store the main url (discord.com) in a properties. load it on the begin of an app anreplace all real occuration (not javadoc) by this value
I read somewhere, that the cdn.discordapp.com won't change. |
Agreed. Even though I think that it should be enough to have it as a public static final String DISCORD_DOMAIN = "discord.com";
public static final String DISCORD_CDN_DOMAIN = "cnd.discordapp.com"; Maybe even in the API package in the |
Just have both in there. |
@@ -12,7 +12,7 @@ | |||
* The base link of a bot invite. | |||
*/ | |||
public static final String BASE_LINK = | |||
"https://discordapp.com/oauth2/authorize?client_id=%s&scope=bot&permissions=%s"; | |||
"https://discord.com/oauth2/authorize?client_id=%s&scope=bot&permissions=%s"; |
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.
"https://"+ DISCORD_URL +"/oauth2/authorize?client_id=%s&scope=bot&permissions=%s"
or using String.formatMessage
@@ -698,7 +698,7 @@ default String getReadableContent() { | |||
*/ | |||
default URL getLink() throws AssertionError { | |||
try { | |||
return new URL("https://discordapp.com/channels/" | |||
return new URL("https://discord.com/channels/" |
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.
"https://"+ DISCORD_URL +"/channels/"
or using String.formatMessage
Pattern.compile("(?x) # enable comment mode \n" | ||
+ "(?i) # ignore case \n" | ||
+ "(?:https?+://)?+ # 'https://' or 'http://' or '' \n" | ||
+ "discord(?:app)?\\.com/channels/ # 'discord(app).com/channels/' \n" |
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.
why adding (?:app)?\\
the url will only be discord.com/channels/
no ?
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.
Currently both is possible. And I would remove the (?:app)? only when only discord.com/channels is possible.
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'd also keep it, someone could post an old link. But add +
after ?
, there is no need to backtrack.
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.
And now the alignment again. :-)
javacord-core/src/main/java/org/javacord/core/util/rest/RestEndpoint.java
Outdated
Show resolved
Hide resolved
@Joshix-1 Do you plan to add the constants in this PR? I would be ok if you don't. In this case I would create an issue for it and someone else (maybe @CharlesLgn 😉 ) can create a separate PR for it. |
@@ -49,6 +49,8 @@ | |||
* This class is the most important class for your bot, containing all important methods, like registering listener. | |||
*/ | |||
public interface DiscordApi extends GloballyAttachableListenerManager { | |||
public static final String DISCORD_DOMAIN = "discord.com"; | |||
public static final String DISCORD_CDN_DOMAIN = "cnd.discordapp.com"; |
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.
cnd != cdn
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.
Like @CharlesLgn said, the constants should also be used.
@@ -49,6 +49,8 @@ | |||
* This class is the most important class for your bot, containing all important methods, like registering listener. | |||
*/ | |||
public interface DiscordApi extends GloballyAttachableListenerManager { | |||
public static final String DISCORD_DOMAIN = "discord.com"; | |||
public static final String DISCORD_CDN_DOMAIN = "cnd.discordapp.com"; |
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.
public static final String DISCORD_CDN_DOMAIN = "cnd.discordapp.com"; | |
/* | |
* The domain of Discord's CDN. | |
*/ | |
public static final String DISCORD_CDN_DOMAIN = "cnd.discordapp.com"; |
@@ -12,7 +12,7 @@ | |||
* The base link of a bot invite. | |||
*/ | |||
public static final String BASE_LINK = | |||
"https://discordapp.com/oauth2/authorize?client_id=%s&scope=bot&permissions=%s"; | |||
"https://discord.com/oauth2/authorize?client_id=%s&scope=bot&permissions=%s"; |
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.
When we have the constants, we should also use them.
"https://discord.com/oauth2/authorize?client_id=%s&scope=bot&permissions=%s"; | |
"https://" + DiscordApi.DISCORD_DOMAIN + "/oauth2/authorize?client_id=%s&scope=bot&permissions=%s"; |
@@ -698,7 +698,7 @@ default String getReadableContent() { | |||
*/ | |||
default URL getLink() throws AssertionError { | |||
try { | |||
return new URL("https://discordapp.com/channels/" | |||
return new URL("https://discord.com/channels/" |
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.
return new URL("https://discord.com/channels/" | |
return new URL("https://" + DiscordApi.DISCORD_DOMAIN + "/channels/" |
@@ -153,7 +153,7 @@ public void setGlobal(boolean global) { | |||
* @return The full url of the endpoint. | |||
*/ | |||
public String getFullUrl(String... parameters) { | |||
StringBuilder url = new StringBuilder("https://discordapp.com/api/v" + Javacord.DISCORD_API_VERSION + getEndpointUrl()); | |||
StringBuilder url = new StringBuilder("https://discord.com/api/v" + Javacord.DISCORD_API_VERSION + getEndpointUrl()); |
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.
StringBuilder url = new StringBuilder("https://discord.com/api/v" + Javacord.DISCORD_API_VERSION + getEndpointUrl()); | |
StringBuilder url = new StringBuilder("https://" + DiscordApi.DISCORD_DOMAIN + "/api/v" + Javacord.DISCORD_API_VERSION + getEndpointUrl()); |
71c1d4b
to
8b3d540
Compare
This commit updates from the old discordapp.com domain to the new discord.com domain. It also introduces constants for the Discord domain and Discord's CDN domain.
see #554!
I changed everything I could find. I don't know if it is complete.