aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/soundchan/BotListener.java14
-rw-r--r--src/main/java/soundchan/Commands.java3
2 files changed, 14 insertions, 3 deletions
diff --git a/src/main/java/soundchan/BotListener.java b/src/main/java/soundchan/BotListener.java
index 8e43ca9..8785892 100644
--- a/src/main/java/soundchan/BotListener.java
+++ b/src/main/java/soundchan/BotListener.java
@@ -139,6 +139,10 @@ public class BotListener extends ListenerAdapter{
case playingnow: {
break;
}
+ case summon: {
+ connectToUserVoiceChannel(guild.getAudioManager(), event.getMember().getEffectiveName());
+ break;
+ }
}
}
@@ -235,10 +239,16 @@ public class BotListener extends ListenerAdapter{
private static void connectToFollowingVoiceChannel(AudioManager audioManager) {
- if (!audioManager.isConnected() && !audioManager.isAttemptingToConnect()) {
+ if(!audioManager.isConnected()) {
+ connectToUserVoiceChannel(audioManager, followingUser);
+ }
+ }
+
+ private static void connectToUserVoiceChannel(AudioManager audioManager, String user) {
+ if (!audioManager.isAttemptingToConnect()) {
for (VoiceChannel voiceChannel : audioManager.getGuild().getVoiceChannels()) {
for (int i = 0; i < voiceChannel.getMembers().size(); i++) {
- if (voiceChannel.getMembers().get(i).getEffectiveName().compareTo(followingUser) == 0) {
+ if (voiceChannel.getMembers().get(i).getEffectiveName().compareTo(user) == 0) {
audioManager.openAudioConnection(voiceChannel);
break;
}
diff --git a/src/main/java/soundchan/Commands.java b/src/main/java/soundchan/Commands.java
index 3f96d37..45fda7a 100644
--- a/src/main/java/soundchan/Commands.java
+++ b/src/main/java/soundchan/Commands.java
@@ -10,5 +10,6 @@ public enum Commands {
unpause,
skip,
list,
- playingnow
+ playingnow,
+ summon
}