use of com.jagrosh.jdautilities.command.Command in project flowermoon by wolf-yuan-6115.
the class PlayCmd method doCommand.
@Override
public void doCommand(CommandEvent event) {
if (event.getArgs().isEmpty() && event.getMessage().getAttachments().isEmpty()) {
AudioHandler handler = (AudioHandler) event.getGuild().getAudioManager().getSendingHandler();
if (handler.getPlayer().getPlayingTrack() != null && handler.getPlayer().isPaused()) {
if (DJCommand.checkDJPermission(event)) {
handler.getPlayer().setPaused(false);
event.replySuccess("繼續播放 **" + handler.getPlayer().getPlayingTrack().getInfo().title + "**.");
} else
event.replyError("只有擁有DJ權限的成員可以繼續播放歌曲!");
return;
}
StringBuilder builder = new StringBuilder(event.getClient().getWarning() + " 播放指令:\n");
builder.append("\n`").append(event.getClient().getPrefix()).append(name).append(" <標題>` - 播放YouTube上的音樂");
builder.append("\n`").append(event.getClient().getPrefix()).append(name).append(" <網址>` - 播放歌曲,播放清單或直播音樂");
for (Command cmd : children) builder.append("\n`").append(event.getClient().getPrefix()).append(name).append(" ").append(cmd.getName()).append(" ").append(cmd.getArguments()).append("` - ").append(cmd.getHelp());
event.reply(builder.toString());
return;
}
String args = event.getArgs().startsWith("<") && event.getArgs().endsWith(">") ? event.getArgs().substring(1, event.getArgs().length() - 1) : event.getArgs().isEmpty() ? event.getMessage().getAttachments().get(0).getUrl() : event.getArgs();
event.reply(loadingEmoji + " 載入中... `[" + args + "]`", m -> bot.getPlayerManager().loadItemOrdered(event.getGuild(), args, new ResultHandler(m, event, false)));
}
use of com.jagrosh.jdautilities.command.Command in project flowermoon by wolf-yuan-6115.
the class PlaylistCmd method execute.
@Override
public void execute(CommandEvent event) {
StringBuilder builder = new StringBuilder(event.getClient().getWarning() + " 播放清單管理指令:\n");
for (Command cmd : this.children) builder.append("\n`").append(event.getClient().getPrefix()).append(name).append(" ").append(cmd.getName()).append(" ").append(cmd.getArguments() == null ? "" : cmd.getArguments()).append("` - ").append(cmd.getHelp());
event.reply(builder.toString());
}
Aggregations