diff options
author | Matt Kohls <mattkohls13@gmail.com> | 2020-06-28 23:27:53 -0400 |
---|---|---|
committer | Matt Kohls <mattkohls13@gmail.com> | 2020-06-28 23:27:53 -0400 |
commit | e175257892510877635d549e8b7890aff1d8ea31 (patch) | |
tree | 5719d792c31bfa4a8acc72c126403c7bd81323e4 /src/main/java/soundchan | |
parent | 8181375ae88c714dae2d7f0a396a46c95e5dcbca (diff) | |
download | SoundChan-e175257892510877635d549e8b7890aff1d8ea31.tar.gz SoundChan-e175257892510877635d549e8b7890aff1d8ea31.tar.bz2 SoundChan-e175257892510877635d549e8b7890aff1d8ea31.zip |
Updating depreciated methods
Diffstat (limited to 'src/main/java/soundchan')
-rw-r--r-- | src/main/java/soundchan/BotListener/BotListener.java | 5 | ||||
-rw-r--r-- | src/main/java/soundchan/Main.java | 9 |
2 files changed, 7 insertions, 7 deletions
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(); |