Updated Discord4J, fixed token file location

This commit is contained in:
Norbi Peti 2016-10-08 18:05:04 +02:00
parent 7db8c283f5
commit 45f6cdd39f
2 changed files with 3 additions and 3 deletions

View file

@ -126,7 +126,7 @@
<dependency> <dependency>
<groupId>com.github.austinv11</groupId> <groupId>com.github.austinv11</groupId>
<artifactId>Discord4j</artifactId> <artifactId>Discord4j</artifactId>
<version>2.6.0</version> <version>2.6.1</version>
<!-- <classifier>shaded</classifier> --> <!-- Include this line if you want a shaded jar (all the Discord4J dependencies <!-- <classifier>shaded</classifier> --> <!-- Include this line if you want a shaded jar (all the Discord4J dependencies
bundled into one jar) --> bundled into one jar) -->
</dependency> </dependency>

View file

@ -41,7 +41,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
lastannouncementtime = Long.parseLong(line); lastannouncementtime = Long.parseLong(line);
} }
ClientBuilder cb = new ClientBuilder(); ClientBuilder cb = new ClientBuilder();
cb.withToken(IOUtils.toString(getClass().getResourceAsStream("/Token.txt"), Charsets.UTF_8)); cb.withToken(Files.readFirstLine(new File("TBMC", "Token.txt"), StandardCharsets.UTF_8));
dc = cb.login(); dc = cb.login();
dc.getDispatcher().registerListener(this); dc.getDispatcher().registerListener(this);
} catch (Exception e) { } catch (Exception e) {
@ -55,7 +55,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
@Override @Override
public void handle(ReadyEvent event) { public void handle(ReadyEvent event) {
try { try {
channel = event.getClient().getGuilds().get(0).getChannelsByName("bot").get(0); channel = event.getClient().getGuilds().get(0).getChannelByID("209720707188260864"); // bot
channel.sendMessage("Minecraft server started up"); channel.sendMessage("Minecraft server started up");
Runnable r = new Runnable() { Runnable r = new Runnable() {
public void run() { public void run() {