Moved to general chat for regular posts and added pinning

This commit is contained in:
Norbi Peti 2016-10-18 22:08:07 +02:00
parent f7dfc297ee
commit 5379d2cc1a

View file

@ -50,15 +50,17 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
} }
} }
private IChannel channel; private IChannel botchannel;
private IChannel modchannel; private IChannel annchannel;
private IChannel genchannel;
@Override @Override
public void handle(ReadyEvent event) { public void handle(ReadyEvent event) {
try { try {
channel = event.getClient().getGuilds().get(0).getChannelByID("209720707188260864"); // bot botchannel = event.getClient().getGuilds().get(0).getChannelByID("209720707188260864"); // bot
modchannel = event.getClient().getGuilds().get(0).getChannelByID("126795071927353344"); // announcements annchannel = event.getClient().getGuilds().get(0).getChannelByID("126795071927353344"); // announcements
channel.sendMessage("Minecraft server started up"); genchannel = event.getClient().getGuilds().get(0).getChannelByID("125813020357165056"); // general
botchannel.sendMessage("Minecraft server started up");
Runnable r = new Runnable() { Runnable r = new Runnable() {
public void run() { public void run() {
AnnouncementGetterThreadMethod(); AnnouncementGetterThreadMethod();
@ -120,9 +122,9 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
lastanntime = date; lastanntime = date;
} }
if (msgsb.length() > 0) if (msgsb.length() > 0)
channel.sendMessage(msgsb.toString()); genchannel.pin(genchannel.sendMessage(msgsb.toString()));
if (modmsgsb.length() > 0) if (modmsgsb.length() > 0) //TODO: Wait for distinguish
modchannel.sendMessage(modmsgsb.toString()); annchannel.sendMessage(modmsgsb.toString());
lastannouncementtime = lastanntime; // If sending succeeded lastannouncementtime = lastanntime; // If sending succeeded
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);