-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added discord stats thing and more changes to the home screen
- Loading branch information
1 parent
47c9f1a
commit 009362b
Showing
9 changed files
with
171 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
22 changes: 22 additions & 0 deletions
22
src/main/java/me/eldodebug/soar/management/remote/discord/DiscordManager.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package me.eldodebug.soar.management.remote.discord; | ||
|
||
import com.google.gson.JsonObject; | ||
import me.eldodebug.soar.Glide; | ||
import me.eldodebug.soar.utils.JsonUtils; | ||
import me.eldodebug.soar.utils.Multithreading; | ||
import me.eldodebug.soar.utils.network.HttpUtils; | ||
|
||
public class DiscordManager { | ||
public DiscordManager() {Multithreading.runAsync(this::checkDiscordValues);} | ||
|
||
public void checkDiscordValues(){ | ||
DiscordStats discordStats = Glide.getInstance().getDiscordStats(); | ||
JsonObject jsonObject = HttpUtils.readJson("https://discord.com/api/v9/invites/42PXqKvwxq?with_counts=true", null); | ||
|
||
if(jsonObject != null) { | ||
discordStats.setMemberCount(JsonUtils.getIntProperty(jsonObject, "approximate_member_count", -1)); | ||
discordStats.setMemberOnline(JsonUtils.getIntProperty(jsonObject, "approximate_presence_count", -1)); | ||
} | ||
} | ||
} | ||
|
16 changes: 16 additions & 0 deletions
16
src/main/java/me/eldodebug/soar/management/remote/discord/DiscordStats.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package me.eldodebug.soar.management.remote.discord; | ||
|
||
public class DiscordStats { | ||
int membersCount = -1; | ||
int membersOnline = -1; | ||
|
||
public void setMemberCount(int in){ | ||
this.membersCount = in; | ||
} | ||
public int getMemberCount(){return membersCount;} | ||
public void setMemberOnline(int in){ | ||
this.membersOnline = in; | ||
} | ||
public int getMemberOnline(){return membersOnline;} | ||
|
||
} |
This file contains 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