Skip to content

Commit

Permalink
📦 NEW: Upgrade to Discord v9 api
Browse files Browse the repository at this point in the history
  • Loading branch information
ianagbip1oti committed Jul 5, 2021
1 parent a2a2f7b commit a27787b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/main/java/com/github/princesslana/smalld/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ public static class Builder {

private static final String V6_BASE_URL = "https://discord.com/api/v6";
private static final String V8_BASE_URL = "https://discord.com/api/v8";
private static final String V9_BASE_URL = "https://discord.com/api/v9";

private String baseUrl = V8_BASE_URL;
private String baseUrl = V9_BASE_URL;
private Clock clock = Clock.systemUTC();
private int currentShard = 0;
private int numberOfShards = 1;
Expand Down Expand Up @@ -129,6 +130,15 @@ public Builder v8() {
return setBaseUrl(V8_BASE_URL);
}

/**
* Set the base URL to that of the v9 Discord API.
*
* @return this
*/
public Builder v9() {
return setBaseUrl(V9_BASE_URL);
}

/**
* Set the {@link Clock} to be used by {@link SmallD}.
*
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/github/princesslana/smalld/TestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
class TestConfig {

@Test
void getBaseUrl_whenDefaults_shouldBeV6Url() {
void getBaseUrl_whenDefaults_shouldBeV9Url() {
Config cfg = Config.builder().build();
Assertions.assertThat(cfg.getBaseUrl()).isEqualTo("https://discord.com/api/v8");
Assertions.assertThat(cfg.getBaseUrl()).isEqualTo("https://discord.com/api/v9");
}

@Test
Expand Down

0 comments on commit a27787b

Please sign in to comment.