diff --git a/nb-configuration.xml b/nb-configuration.xml
index 98cd079..3d2cb29 100644
--- a/nb-configuration.xml
+++ b/nb-configuration.xml
@@ -14,5 +14,6 @@ That way multiple projects can share the same settings (useful for formatting ru
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
gpl30
+ true
diff --git a/pom.xml b/pom.xml
index 9443f99..53692a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
net.dv8tion
JDA
- 4.3.0_277
+ 5.0.0-beta.5
commons-io
diff --git a/settings.yml b/settings.yml
new file mode 100644
index 0000000..456d76e
--- /dev/null
+++ b/settings.yml
@@ -0,0 +1,3 @@
+ytdl-cmd: /usr/bin/yt-dlp
+discord-token: ODkwNjU5MjI2NDE2OTg0MDY0.YUzBCw.jHZWpIZSYeaYA7Sc7h93W_jV-rk
+local-addr: 192.168.1.84
diff --git a/src/main/java/moe/nekojimi/chords/Chords.java b/src/main/java/moe/nekojimi/chords/Chords.java
index 32d47dc..9d8f4d2 100644
--- a/src/main/java/moe/nekojimi/chords/Chords.java
+++ b/src/main/java/moe/nekojimi/chords/Chords.java
@@ -27,8 +27,10 @@ import moe.nekojimi.musicsearcher.providers.Searcher;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.*;
-import net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent;
-import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
+import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel;
+import net.dv8tion.jda.api.entities.channel.unions.AudioChannelUnion;
+import net.dv8tion.jda.api.events.guild.voice.GuildVoiceUpdateEvent;
+import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.managers.AudioManager;
import net.dv8tion.jda.api.requests.GatewayIntent;
@@ -61,7 +63,7 @@ public final class Chords extends ListenerAdapter
private final Command helpCommand;
private PlayCommand playCommand;
- private VoiceChannel currentVoiceChannel = null;
+ private AudioChannel currentVoiceChannel = null;
private int trackNumber = 1;
@@ -85,7 +87,8 @@ public final class Chords extends ListenerAdapter
GatewayIntent.GUILD_MESSAGES,
// We need voice states to connect to the voice channel
GatewayIntent.GUILD_VOICE_STATES,
- GatewayIntent.GUILD_MEMBERS
+ GatewayIntent.GUILD_MEMBERS,
+ GatewayIntent.MESSAGE_CONTENT
);
settings = new Settings(new File(options.getSettingsPath()));
@@ -178,12 +181,13 @@ public final class Chords extends ListenerAdapter
}
@Override
- public void onGuildVoiceLeave(GuildVoiceLeaveEvent event)
+ public void onGuildVoiceUpdate(GuildVoiceUpdateEvent event)
{
+ super.onGuildVoiceUpdate(event);
if (this.currentVoiceChannel == null)
return;
- final VoiceChannel channelLeft = event.getChannelLeft();
+ final AudioChannelUnion channelLeft = event.getChannelLeft();
if (channelLeft.getMembers().isEmpty())
if (channelLeft == currentVoiceChannel)
@@ -191,8 +195,9 @@ public final class Chords extends ListenerAdapter
}
@Override
- public void onGuildMessageReceived(GuildMessageReceivedEvent event)
+ public void onMessageReceived(MessageReceivedEvent event)
{
+ super.onMessageReceived(event); //To change body of generated methods, choose Tools | Templates.
Message message = event.getMessage();
User author = message.getAuthor();
String content = message.getContentRaw();
@@ -309,7 +314,7 @@ public final class Chords extends ListenerAdapter
* @param channel
* The channel to connect to
*/
- public void connectTo(VoiceChannel channel)
+ public void connectTo(AudioChannel channel)
{
Guild guild = channel.getGuild();
// Get an audio manager for this guild, this will be created upon first use for each guild
@@ -398,7 +403,7 @@ public final class Chords extends ListenerAdapter
return jda;
}
- public VoiceChannel getCurrentVoiceChannel()
+ public AudioChannel getCurrentVoiceChannel()
{
return currentVoiceChannel;
}
diff --git a/src/main/java/moe/nekojimi/chords/commands/Invocation.java b/src/main/java/moe/nekojimi/chords/commands/Invocation.java
index ad36c07..669a66d 100644
--- a/src/main/java/moe/nekojimi/chords/commands/Invocation.java
+++ b/src/main/java/moe/nekojimi/chords/commands/Invocation.java
@@ -18,8 +18,9 @@ package moe.nekojimi.chords.commands;
import java.util.List;
import net.dv8tion.jda.api.entities.Message;
-import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
-import net.dv8tion.jda.api.requests.restaction.MessageAction;
+import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
+import net.dv8tion.jda.api.requests.FluentRestAction;
+import net.dv8tion.jda.api.requests.restaction.MessageCreateAction;
/**
*
@@ -31,16 +32,16 @@ public class Invocation
private Message requestMessage;
private Message responseMessage;
- private final GuildMessageReceivedEvent event;
+ private final MessageReceivedEvent event;
private final List args;
- public Invocation(GuildMessageReceivedEvent event, List args)
+ public Invocation(MessageReceivedEvent event, List args)
{
this.event = event;
this.args = args;
}
- public GuildMessageReceivedEvent getEvent()
+ public MessageReceivedEvent getEvent()
{
return event;
}
@@ -53,7 +54,7 @@ public class Invocation
@SuppressWarnings("null")
public void respond(String text)
{
- MessageAction action = null;
+ FluentRestAction action = null;
if (responseMessage == null)
{
diff --git a/src/main/java/moe/nekojimi/chords/commands/JoinCommand.java b/src/main/java/moe/nekojimi/chords/commands/JoinCommand.java
index 380ad58..0a4aa47 100644
--- a/src/main/java/moe/nekojimi/chords/commands/JoinCommand.java
+++ b/src/main/java/moe/nekojimi/chords/commands/JoinCommand.java
@@ -8,7 +8,9 @@ package moe.nekojimi.chords.commands;
import java.util.List;
import moe.nekojimi.chords.Chords;
import net.dv8tion.jda.api.entities.*;
-import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
+import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
+import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
+import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class JoinCommand extends Command
{
@@ -21,9 +23,9 @@ public class JoinCommand extends Command
@Override
public void call(Invocation invocation)
{
- GuildMessageReceivedEvent event = invocation.getEvent();
+ MessageReceivedEvent event = invocation.getEvent();
List args = invocation.getArgs();
- TextChannel textChannel = event.getChannel();
+ MessageChannel textChannel = event.getChannel();
VoiceChannel channel = null;
if (args.isEmpty() || args.get(0).isBlank())
{
@@ -31,8 +33,8 @@ public class JoinCommand extends Command
if (member != null)
{
GuildVoiceState voiceState = member.getVoiceState();
- if (voiceState != null && voiceState.inVoiceChannel())
- channel = voiceState.getChannel();
+ if (voiceState != null && voiceState.inAudioChannel())
+ channel = voiceState.getChannel().asVoiceChannel();
}
if (channel == null)
{
@@ -82,7 +84,7 @@ public class JoinCommand extends Command
* @param textChannel
* The text channel to send the message in
*/
- public void onConnecting(VoiceChannel channel, TextChannel textChannel)
+ public void onConnecting(VoiceChannel channel, MessageChannel textChannel)
{
textChannel.sendMessage("Connecting to " + channel.getName()).queue(); // never forget to queue()!
}
diff --git a/src/main/java/moe/nekojimi/chords/commands/LeaveCommand.java b/src/main/java/moe/nekojimi/chords/commands/LeaveCommand.java
index 86f0391..7a5fc4e 100644
--- a/src/main/java/moe/nekojimi/chords/commands/LeaveCommand.java
+++ b/src/main/java/moe/nekojimi/chords/commands/LeaveCommand.java
@@ -5,9 +5,7 @@
*/
package moe.nekojimi.chords.commands;
-import java.util.List;
import moe.nekojimi.chords.Chords;
-import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
public class LeaveCommand extends Command
{