Added bitconnect music command
For sync purposes
This commit is contained in:
1 parent
fffe3cf328
commit
5131611bbb
2 files changed
+77
No files matched your search
@@ -0,0 +1,74 @@
|
|||||||
|
package netneutrality.command.music;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) anthorob
|
||||||
|
*
|
||||||
|
* This file is closed-source. It should not be distributed or copied in any way or form
|
||||||
|
*/
|
||||||
|
|
||||||
|
import net.dv8tion.jda.core.entities.Member;
|
||||||
|
import net.dv8tion.jda.core.entities.VoiceChannel;
|
||||||
|
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||||
|
import netneutrality.command.AbstractCommand;
|
||||||
|
import netneutrality.command.Visibility;
|
||||||
|
import netneutrality.music.MusicManager;
|
||||||
|
|
||||||
|
public class BitconnectCommand extends AbstractCommand {
|
||||||
|
@Override
|
||||||
|
public boolean needAdmin() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommand() {
|
||||||
|
return "bitconnect";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getAlias() {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsage() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Visibility getVisibility() {
|
||||||
|
return Visibility.CHANNEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(MessageReceivedEvent event, String args) {
|
||||||
|
Member member = event.getMember();
|
||||||
|
MusicManager player = MusicManager.get(event.getGuild());
|
||||||
|
|
||||||
|
if (member.getVoiceState().inVoiceChannel()) {
|
||||||
|
VoiceChannel vChannel = member.getVoiceState().getChannel();
|
||||||
|
|
||||||
|
if (player.isConnected()) {
|
||||||
|
if (player.isConnectedTo(vChannel)) {
|
||||||
|
player.play("https://www.youtube.com/watch?v=A8M70M7tzTI", event.getTextChannel(), true);
|
||||||
|
} else
|
||||||
|
event.getTextChannel().sendMessage("Not in your voice channel").queue();
|
||||||
|
} else {
|
||||||
|
player.connect(vChannel);
|
||||||
|
player.play("https://www.youtube.com/watch?v=A8M70M7tzTI", event.getTextChannel(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else
|
||||||
|
event.getTextChannel().sendMessage("You are not in a voice channel").queue();
|
||||||
|
|
||||||
|
event.getMessage().delete().queue();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,6 +34,9 @@ public class TrackScheduler extends AudioEventAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the next track, stopping the current one if it is playing.
|
||||||
|
*/
|
||||||
public void nextTrack() {
|
public void nextTrack() {
|
||||||
// Start the next track, regardless of if something is already playing or not. In case queue was empty, we are
|
// Start the next track, regardless of if something is already playing or not. In case queue was empty, we are
|
||||||
// giving null to startTrack, which is a valid argument and will simply stop the player.
|
// giving null to startTrack, which is a valid argument and will simply stop the player.
|
||||||
|
|||||||
Reference in new issue
Block a user