Added line to send message
This commit is contained in:
parent
23fbc0824c
commit
bd51083568
1 changed files with 2 additions and 1 deletions
|
@ -79,7 +79,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
private void AnnouncementGetterThreadMethod() {
|
private void AnnouncementGetterThreadMethod() {
|
||||||
while (!stop) {
|
while (!stop) {
|
||||||
try {
|
try {
|
||||||
String body = TBMCCoreAPI.DownloadString(SubredditURL + "/new/.json?limit=10"); // TODO: Save last announcement
|
String body = TBMCCoreAPI.DownloadString(SubredditURL + "/new/.json?limit=10");
|
||||||
JsonArray json = new JsonParser().parse(body).getAsJsonObject().get("data").getAsJsonObject()
|
JsonArray json = new JsonParser().parse(body).getAsJsonObject().get("data").getAsJsonObject()
|
||||||
.get("children").getAsJsonArray();
|
.get("children").getAsJsonArray();
|
||||||
StringBuilder msgsb = new StringBuilder();
|
StringBuilder msgsb = new StringBuilder();
|
||||||
|
@ -118,6 +118,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
lastannouncementtime = date;
|
lastannouncementtime = date;
|
||||||
File file = new File("TBMC", "DiscordRedditLastAnnouncement.txt");
|
File file = new File("TBMC", "DiscordRedditLastAnnouncement.txt");
|
||||||
Files.write(lastannouncementtime + "", file, StandardCharsets.UTF_8);
|
Files.write(lastannouncementtime + "", file, StandardCharsets.UTF_8);
|
||||||
|
channel.sendMessage(msgsb.toString()); //TODO: Mod msgsb for announcements
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
|
|
Loading…
Reference in a new issue