aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorBrandon <bwaggone@umich.edu>2018-04-14 15:26:48 -0400
committerBrandon <bwaggone@umich.edu>2018-04-14 15:26:48 -0400
commit14006737593b80d198f0d19d820a37bd984e8ccc (patch)
tree9187e688ad78f9ea1ad104a6c71857e6a24c7985 /src/main/java
parent97dd68fbbfd28c6c0f42ac06f4d70606990667b4 (diff)
parentf8fe02e835c6417a54033b30a66c9c3bc2097836 (diff)
downloadSoundChan-14006737593b80d198f0d19d820a37bd984e8ccc.tar.gz
SoundChan-14006737593b80d198f0d19d820a37bd984e8ccc.tar.bz2
SoundChan-14006737593b80d198f0d19d820a37bd984e8ccc.zip
Merge branch 'master' of https://github.com/bwaggone/SoundChan into feature/preempt-sound-effects
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/soundchan/BotListener/BotListener.java13
-rw-r--r--src/main/java/soundchan/BotListener/Commands.java3
2 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/soundchan/BotListener/BotListener.java b/src/main/java/soundchan/BotListener/BotListener.java
index f97db95..044625d 100644
--- a/src/main/java/soundchan/BotListener/BotListener.java
+++ b/src/main/java/soundchan/BotListener/BotListener.java
@@ -140,7 +140,8 @@ public class BotListener extends ListenerAdapter{
}else if(enumCommand == Commands.playingnow){
// Print the currently playing song
printCurrentlyPlaying(channel);
-
+ }else if(enumCommand == Commands.summon){
+ connectToUserVoiceChannel(monitoredGuild.getAudioManager(), event.getMember().getEffectiveName());
}
@@ -250,10 +251,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/BotListener/Commands.java b/src/main/java/soundchan/BotListener/Commands.java
index da1f45f..1a06436 100644
--- a/src/main/java/soundchan/BotListener/Commands.java
+++ b/src/main/java/soundchan/BotListener/Commands.java
@@ -10,5 +10,6 @@ public enum Commands {
unpause,
skip,
list,
- playingnow
+ playingnow,
+ summon
}