Added auto-updater listener

This commit is contained in:
Norbi Peti 2016-12-22 20:52:14 +01:00
parent 03540b430c
commit aeee423c5a
2 changed files with 24 additions and 1 deletions

View file

@ -74,6 +74,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
public static IChannel chatchannel; public static IChannel chatchannel;
public static IChannel issuechannel; public static IChannel issuechannel;
public static IChannel botroomchannel; public static IChannel botroomchannel;
public static IChannel officechannel;
public static IGuild mainServer; public static IGuild mainServer;
public static IGuild devServer; public static IGuild devServer;
@ -95,6 +96,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
chatchannel = mainServer.getChannelByID("249663564057411596"); // minecraft_chat chatchannel = mainServer.getChannelByID("249663564057411596"); // minecraft_chat
issuechannel = devServer.getChannelByID("219643416496046081"); // server-issues issuechannel = devServer.getChannelByID("219643416496046081"); // server-issues
botroomchannel = devServer.getChannelByID("239519012529111040"); // bot-room botroomchannel = devServer.getChannelByID("239519012529111040"); // bot-room
officechannel = devServer.getChannelByID("219626707458457603"); // developers-office
dc.changeStatus(Status.game("on TBMC")); dc.changeStatus(Status.game("on TBMC"));
} else { } else {
botchannel = devServer.getChannelByID("239519012529111040"); // bot-room botchannel = devServer.getChannelByID("239519012529111040"); // bot-room

View file

@ -0,0 +1,21 @@
package buttondevteam.discordplugin.listeners;
import buttondevteam.discordplugin.DiscordPlugin;
import sx.blah.discord.api.events.IListener;
import sx.blah.discord.handle.impl.events.MessageReceivedEvent;
public class AutoUpdaterListener implements IListener<MessageReceivedEvent> {
@Override
public void handle(MessageReceivedEvent event) {
if (!event.getMessage().getChannel().equals(DiscordPlugin.officechannel))
return;
if (event.getMessage().getWebhookID() == null)
return;
System.out.println(event.getMessage().getWebhookID());
if (event.getMessage().getEmbedded().size() == 0) {
System.out.println("No embed");
return;
}
System.out.println(event.getMessage().getEmbedded().get(0).getDescription());
}
}