use of net.dv8tion.jda.api.entities.GuildVoiceState in project ascent_bot by FeroniK.
the class Leave method handle.
@Override
@SuppressWarnings("ConstantConditions")
public void handle(CommandContext ctx) {
final TextChannel channel = ctx.getChannel();
final Member member = ctx.getMember();
final GuildVoiceState memberVoiceState = member.getVoiceState();
GuildMusicManager musicManager = PlayerManager.getInstance().getMusicManager(ctx.getGuild());
musicManager.scheduler.isRepeating = false;
musicManager.scheduler.queue.clear();
musicManager.scheduler.player.startTrack(null, false);
AudioManager audioManager = ctx.getGuild().getAudioManager();
audioManager.closeAudioConnection();
String desc = "Disconnected from " + memberVoiceState.getChannel().getAsMention();
EmbedBuilder builder = Embeds.createBuilder("Disconnected", desc, "Requested by " + member.getEffectiveName(), member.getEffectiveAvatarUrl(), null);
channel.sendMessageEmbeds(builder.build()).queue();
}
use of net.dv8tion.jda.api.entities.GuildVoiceState in project aiode by robinfriedli.
the class RewindAction method doRun.
@Override
public void doRun() {
AudioQueue queue = audioPlayback.getAudioQueue();
if (!queue.isEmpty()) {
if (queue.hasPrevious()) {
queue.reverse();
}
Guild guild = getContext().getGuild();
GuildVoiceState voiceState = getContext().getMember().getVoiceState();
audioManager.startPlayback(guild, voiceState != null ? voiceState.getChannel() : null);
}
}
use of net.dv8tion.jda.api.entities.GuildVoiceState in project aiode by robinfriedli.
the class SkipAction method doRun.
@Override
public void doRun() {
AudioQueue queue = audioPlayback.getAudioQueue();
if (!queue.isEmpty()) {
Guild guild = getContext().getGuild();
if (queue.hasNext()) {
queue.iterate();
GuildVoiceState voiceState = getContext().getMember().getVoiceState();
audioManager.startPlayback(guild, voiceState != null ? voiceState.getChannel() : null);
} else {
audioPlayback.stop();
queue.reset();
}
}
}
use of net.dv8tion.jda.api.entities.GuildVoiceState in project Robertify-Bot by bombies.
the class SeekCommand method handle.
@Override
public void handle(CommandContext ctx) throws ScriptException {
final List<String> args = ctx.getArgs();
final Message msg = ctx.getMessage();
final var guild = ctx.getGuild();
if (args.isEmpty()) {
msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You must provide the position you would like to jump to").build()).queue();
return;
}
var position = ctx.getArgs().get(0);
if (Pattern.matches("^\\d{1,2}:\\d{2}$", position)) {
String[] positionSplit = position.split(":");
int mins = Integer.parseInt(positionSplit[0]);
int secs = Integer.parseInt(positionSplit[1]);
final GuildVoiceState memberVoiceState = ctx.getMember().getVoiceState();
final GuildVoiceState selfVoiceState = ctx.getSelfMember().getVoiceState();
msg.replyEmbeds(handleSeek(selfVoiceState, memberVoiceState, mins, secs).build()).queue();
} else if (Pattern.matches("^\\d{1,2}:\\d{1,2}:\\d{2}$", position)) {
String[] positionSplit = position.split(":");
int hours = Integer.parseInt(positionSplit[0]);
int mins = Integer.parseInt(positionSplit[1]);
int secs = Integer.parseInt(positionSplit[2]);
final GuildVoiceState memberVoiceState = ctx.getMember().getVoiceState();
final GuildVoiceState selfVoiceState = ctx.getSelfMember().getVoiceState();
msg.replyEmbeds(handleSeek(selfVoiceState, memberVoiceState, hours, mins, secs).build()).queue();
} else {
msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You must provide the position in the format `mm:ss` **OR** `hh:mm:ss`").build()).queue();
return;
}
}
use of net.dv8tion.jda.api.entities.GuildVoiceState in project Robertify-Bot by bombies.
the class VolumeCommand method handle.
@Override
public void handle(CommandContext ctx) throws ScriptException {
final Message msg = ctx.getMessage();
final var guild = ctx.getGuild();
if (ctx.getArgs().isEmpty()) {
msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You must provide what volume you'd like to set the bot to").build()).queue();
return;
}
if (!GeneralUtils.stringIsInt(ctx.getArgs().get(0))) {
msg.replyEmbeds(RobertifyEmbedUtils.embedMessage(guild, "You must provide an integer as the volume").build()).queue();
return;
}
final int volume = Integer.parseInt(ctx.getArgs().get(0));
final Member member = ctx.getMember();
final GuildVoiceState memberVoiceState = member.getVoiceState();
final GuildVoiceState selfVoiceState = ctx.getSelfMember().getVoiceState();
msg.replyEmbeds(handleVolumeChange(selfVoiceState, memberVoiceState, volume).build()).queue();
}
Aggregations