From e175257892510877635d549e8b7890aff1d8ea31 Mon Sep 17 00:00:00 2001 From: Matt Kohls Date: Sun, 28 Jun 2020 23:27:53 -0400 Subject: Updating depreciated methods --- src/main/java/soundchan/BotListener/BotListener.java | 5 ++--- src/main/java/soundchan/Main.java | 9 +++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/soundchan/BotListener/BotListener.java b/src/main/java/soundchan/BotListener/BotListener.java index 1e84a54..1d97a5a 100644 --- a/src/main/java/soundchan/BotListener/BotListener.java +++ b/src/main/java/soundchan/BotListener/BotListener.java @@ -14,7 +14,6 @@ import net.dv8tion.jda.api.entities.VoiceChannel; import net.dv8tion.jda.api.events.guild.voice.GuildVoiceJoinEvent; import net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent; import net.dv8tion.jda.api.events.guild.voice.GuildVoiceMoveEvent; -import net.dv8tion.jda.api.events.message.GenericMessageEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.managers.AudioManager; @@ -176,7 +175,7 @@ public class BotListener extends ListenerAdapter{ Guild guild = event.getGuild(); setMonitoredGuild(guild); AudioManager audioManager = monitoredGuild.getAudioManager(); - if(!audioManager.isAttemptingToConnect()) { + if(!audioManager.isConnected()) { audioManager.openAudioConnection(event.getChannelJoined()); } } @@ -436,7 +435,7 @@ public class BotListener extends ListenerAdapter{ } private static void connectToUserVoiceChannel(AudioManager audioManager, String user) { - if (!audioManager.isAttemptingToConnect()) { + if (!audioManager.isConnected()) { for (VoiceChannel voiceChannel : audioManager.getGuild().getVoiceChannels()) { for (int i = 0; i < voiceChannel.getMembers().size(); i++) { if (voiceChannel.getMembers().get(i).getEffectiveName().compareTo(user) == 0) { diff --git a/src/main/java/soundchan/Main.java b/src/main/java/soundchan/Main.java index 587c7e9..0021aba 100644 --- a/src/main/java/soundchan/Main.java +++ b/src/main/java/soundchan/Main.java @@ -1,8 +1,7 @@ package soundchan; -import net.dv8tion.jda.api.AccountType; import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.JDABuilder; +import net.dv8tion.jda.api.requests.GatewayIntent; import soundchan.BotListener.*; import java.io.FileInputStream; @@ -10,13 +9,15 @@ import java.io.IOException; import java.io.InputStream; import java.util.*; +import static net.dv8tion.jda.api.JDABuilder.createDefault; + public class Main { public static void main(String[] args) throws Exception { Properties properties = LoadProperties(); - JDA jda = new JDABuilder(AccountType.BOT) - .setToken(properties.getProperty("botToken")) + JDA jda = createDefault(properties.getProperty("botToken")) + .enableIntents(GatewayIntent.GUILD_MESSAGES) .addEventListeners(new BotListener(properties)) .build(); jda.awaitReady(); -- cgit v1.2.3