Refactored commands and optimized music manager
This commit is contained in:
1 parent
c11af0da51
commit
1b24a55ca6
14 files changed
+89
-91
No files matched your search
@@ -21,7 +21,7 @@ import javax.security.auth.login.LoginException;
|
|||||||
public class MusicBot {
|
public class MusicBot {
|
||||||
|
|
||||||
private static JDA jda;
|
private static JDA jda;
|
||||||
private final static Logger logger = LoggerFactory.getLogger(MusicBot.class);
|
public final static Logger logger = LoggerFactory.getLogger(MusicBot.class);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.setProperty("log4j.skipJansi", "false");
|
System.setProperty("log4j.skipJansi", "false");
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ package netneutrality.command;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
public abstract class AbstractCommand implements ICommand {
|
||||||
|
|
||||||
public abstract class AbstractCommand {
|
|
||||||
|
|
||||||
public AbstractCommand() {
|
public AbstractCommand() {
|
||||||
|
|
||||||
@@ -41,12 +39,6 @@ public abstract class AbstractCommand {
|
|||||||
|
|
||||||
public abstract CommandType getType();
|
public abstract CommandType getType();
|
||||||
|
|
||||||
/**
|
|
||||||
* @param args the arguments to the command
|
|
||||||
*/
|
|
||||||
public abstract String execute(MessageReceivedEvent event, String args);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int countArgs(String command) {
|
public int countArgs(String command) {
|
||||||
if (command.isEmpty())
|
if (command.isEmpty())
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ package netneutrality.command;
|
|||||||
* https://discord.gg/CdFcyQ
|
* https://discord.gg/CdFcyQ
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import netneutrality.MusicBot;
|
|
||||||
import org.reflections.Reflections;
|
import org.reflections.Reflections;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package netneutrality.command;/*
|
||||||
|
* Copyright (c) anthorob
|
||||||
|
*
|
||||||
|
* https://xtremcommunity.com/
|
||||||
|
* https://discord.gg/CdFcyQ
|
||||||
|
*/
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
|
||||||
|
public interface ICommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param args the arguments to the command
|
||||||
|
*/
|
||||||
|
String execute(MessageReceivedEvent event, String args);
|
||||||
|
}
|
||||||
@@ -15,8 +15,8 @@ import netneutrality.http.WebModule;
|
|||||||
|
|
||||||
public class BitcoinPriceCommand extends AbstractCommand {
|
public class BitcoinPriceCommand extends AbstractCommand {
|
||||||
|
|
||||||
private String currency = "USD";
|
private String currency;
|
||||||
private String currencyUrl = "https://api.coindesk.com/v1/bpi/currentprice/";
|
private final String currencyUrl = "https://api.coindesk.com/v1/bpi/currentprice/";
|
||||||
private String price;
|
private String price;
|
||||||
|
|
||||||
public BitcoinPriceCommand() {
|
public BitcoinPriceCommand() {
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import netneutrality.http.WebModule;
|
|||||||
|
|
||||||
public class EthereumPriceCommand extends AbstractCommand {
|
public class EthereumPriceCommand extends AbstractCommand {
|
||||||
|
|
||||||
private String currency = "USD";
|
private String currency;
|
||||||
private String currencyUrl = "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=";
|
private final String currencyUrl = "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=";
|
||||||
private String price = "";
|
private String price = "";
|
||||||
|
|
||||||
public EthereumPriceCommand() {
|
public EthereumPriceCommand() {
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import netneutrality.http.WebModule;
|
|||||||
|
|
||||||
public class LitecoinPriceCommand extends AbstractCommand {
|
public class LitecoinPriceCommand extends AbstractCommand {
|
||||||
|
|
||||||
private String currency = "USD";
|
private String currency;
|
||||||
private String currencyUrl = "https://api.coinmarketcap.com/v1/ticker/litecoin/?convert=";
|
private final String currencyUrl = "https://api.coinmarketcap.com/v1/ticker/litecoin/?convert=";
|
||||||
private String price;
|
private String price;
|
||||||
|
|
||||||
public LitecoinPriceCommand() {
|
public LitecoinPriceCommand() {
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ public class StopCommand extends AbstractCommand {
|
|||||||
|
|
||||||
if (player.isConnected()) {
|
if (player.isConnected()) {
|
||||||
if (player.isConnectedTo(vChannel)) {
|
if (player.isConnectedTo(vChannel)) {
|
||||||
player.stopMusic();
|
|
||||||
player.leave();
|
player.leave();
|
||||||
} else
|
} else
|
||||||
event.getTextChannel().sendMessage("Not in your voice channel").queue();
|
event.getTextChannel().sendMessage("Not in your voice channel").queue();
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class DatabaseCommand extends AbstractCommand {
|
|||||||
@Override
|
@Override
|
||||||
public String execute(MessageReceivedEvent event, String args) {
|
public String execute(MessageReceivedEvent event, String args) {
|
||||||
//TODO: Clean up the mess
|
//TODO: Clean up the mess
|
||||||
|
|
||||||
event.getMessage().delete().queue();
|
event.getMessage().delete().queue();
|
||||||
|
|
||||||
if (!event.getAuthor().getDiscriminator().equals(Settings.getInstance().getCreator().getDiscriminator()))
|
if (!event.getAuthor().getDiscriminator().equals(Settings.getInstance().getCreator().getDiscriminator()))
|
||||||
|
|||||||
@@ -30,23 +30,13 @@ public class AudioPlayerSendHandler implements AudioSendHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvide() {
|
public boolean canProvide() {
|
||||||
if (lastFrame == null) {
|
|
||||||
lastFrame = audioPlayer.provide();
|
lastFrame = audioPlayer.provide();
|
||||||
}
|
|
||||||
|
|
||||||
return lastFrame != null;
|
return lastFrame != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ByteBuffer provide20MsAudio() {
|
public ByteBuffer provide20MsAudio() {
|
||||||
if (lastFrame == null) {
|
return ByteBuffer.wrap(lastFrame.getData());
|
||||||
lastFrame = audioPlayer.provide();
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] data = lastFrame != null ? lastFrame.getData() : null;
|
|
||||||
lastFrame = null;
|
|
||||||
|
|
||||||
return ByteBuffer.wrap(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,26 +9,58 @@ import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
|||||||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
|
import netneutrality.handler.LogHandler;
|
||||||
|
import netneutrality.utils.MessageFunction;
|
||||||
|
|
||||||
public class LoadResultHandler implements AudioLoadResultHandler {
|
public class LoadResultHandler implements AudioLoadResultHandler {
|
||||||
|
|
||||||
|
private final TextChannel channel;
|
||||||
|
private final Member user;
|
||||||
|
private final TrackScheduler scheduler;
|
||||||
|
private final String identifier;
|
||||||
|
private final boolean silent;
|
||||||
|
|
||||||
|
public LoadResultHandler(String identifier, TextChannel channel, Member user, TrackScheduler scheduler, boolean silent) {
|
||||||
|
this.identifier = identifier;
|
||||||
|
this.channel = channel;
|
||||||
|
this.user = user;
|
||||||
|
this.scheduler = scheduler;
|
||||||
|
this.silent = silent;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void trackLoaded(AudioTrack audioTrack) {
|
public void trackLoaded(AudioTrack audioTrack) {
|
||||||
|
if (!silent) {
|
||||||
|
channel.sendMessage(MessageFunction.buildAddingTrackMessage(audioTrack, user)).queue();
|
||||||
|
}
|
||||||
|
|
||||||
|
scheduler.queue(audioTrack);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playlistLoaded(AudioPlaylist audioPlaylist) {
|
public void playlistLoaded(AudioPlaylist audioPlaylist) {
|
||||||
|
if (identifier.startsWith("ytsearch:")) {
|
||||||
|
AudioTrack track = audioPlaylist.getTracks().get(0);
|
||||||
|
|
||||||
|
channel.sendMessage(MessageFunction.buildAddingTrackMessage(track, user)).queue();
|
||||||
|
scheduler.queue(track);
|
||||||
|
} else {
|
||||||
|
for (AudioTrack track : audioPlaylist.getTracks()) {
|
||||||
|
scheduler.queue(track);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void noMatches() {
|
public void noMatches() {
|
||||||
|
channel.sendMessage("No matches found").queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadFailed(FriendlyException e) {
|
public void loadFailed(FriendlyException e) {
|
||||||
|
LogHandler.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,19 +6,13 @@ package netneutrality.music;
|
|||||||
* This file is closed-source. It should not be distributed or copied in any way or form
|
* This file is closed-source. It should not be distributed or copied in any way or form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||||
import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
|
import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
|
||||||
import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers;
|
import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers;
|
||||||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
import netneutrality.MusicBot;
|
|
||||||
import netneutrality.ThreadManager;
|
import netneutrality.ThreadManager;
|
||||||
import netneutrality.handler.LogHandler;
|
|
||||||
import netneutrality.utils.MessageFunction;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -32,18 +26,18 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class MusicManager {
|
public class MusicManager {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(MusicManager.class);
|
private final static Logger logger = LoggerFactory.getLogger(MusicManager.class);
|
||||||
|
private final Guild guild;
|
||||||
private final static AudioPlayerManager playerManager = new DefaultAudioPlayerManager();
|
private final static AudioPlayerManager playerManager = new DefaultAudioPlayerManager();
|
||||||
private final AudioPlayer player;
|
private final AudioPlayer player;
|
||||||
private final TrackScheduler scheduler;
|
private final TrackScheduler scheduler;
|
||||||
private final static Map<String, MusicManager> managers = new ConcurrentHashMap<>();
|
private final static Map<String, MusicManager> managers = new ConcurrentHashMap<>();
|
||||||
private final String guildId;
|
|
||||||
|
|
||||||
private MusicManager(Guild guild) {
|
private MusicManager(Guild guild) {
|
||||||
|
|
||||||
this.guildId = guild.getId();
|
this.guild = guild;
|
||||||
player = playerManager.createPlayer();
|
this.player = playerManager.createPlayer();
|
||||||
|
this.scheduler = new TrackScheduler(player);
|
||||||
guild.getAudioManager().setSendingHandler(new AudioPlayerSendHandler(player));
|
guild.getAudioManager().setSendingHandler(new AudioPlayerSendHandler(player));
|
||||||
scheduler = new TrackScheduler(player);
|
|
||||||
player.addListener(scheduler);
|
player.addListener(scheduler);
|
||||||
player.setVolume(30);
|
player.setVolume(30);
|
||||||
|
|
||||||
@@ -62,12 +56,11 @@ public class MusicManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnectedTo(VoiceChannel vChannel) {
|
public boolean isConnectedTo(VoiceChannel vChannel) {
|
||||||
return vChannel != null && vChannel.equals(MusicBot.getJDA().getGuildById(guildId).getAudioManager().getConnectedChannel());
|
return vChannel != null && vChannel.equals(guild.getAudioManager().getConnectedChannel());
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void connect(VoiceChannel vChannel) {
|
public synchronized void connect(VoiceChannel vChannel) {
|
||||||
if (vChannel != null && !isConnectedTo(vChannel)) {
|
if (vChannel != null && !isConnectedTo(vChannel)) {
|
||||||
Guild guild = MusicBot.getJDA().getGuildById(guildId);
|
|
||||||
guild.getAudioManager().openAudioConnection(vChannel);
|
guild.getAudioManager().openAudioConnection(vChannel);
|
||||||
|
|
||||||
((ScheduledExecutorService) ThreadManager.getExecutor("music", ThreadManager.ExecutorType.SCHEDULED, 5)).scheduleWithFixedDelay(() -> {
|
((ScheduledExecutorService) ThreadManager.getExecutor("music", ThreadManager.ExecutorType.SCHEDULED, 5)).scheduleWithFixedDelay(() -> {
|
||||||
@@ -79,7 +72,6 @@ public class MusicManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
Guild guild = MusicBot.getJDA().getGuildById(guildId);
|
|
||||||
return guild != null && guild.getAudioManager().getConnectedChannel() != null;
|
return guild != null && guild.getAudioManager().getConnectedChannel() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,24 +81,18 @@ public class MusicManager {
|
|||||||
|
|
||||||
public synchronized void leave() {
|
public synchronized void leave() {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
stopMusic();
|
player.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduler.resetTopic();
|
scheduler.resetTopic();
|
||||||
|
|
||||||
Guild guild = MusicBot.getJDA().getGuildById(guildId);
|
|
||||||
if (guild != null) {
|
if (guild != null) {
|
||||||
guild.getAudioManager().closeAudioConnection();
|
guild.getAudioManager().closeAudioConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void stopMusic() {
|
public static void disconnectPlayers() {
|
||||||
scheduler.resetTopic();
|
|
||||||
player.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized static void disconnectPlayers() {
|
|
||||||
for (MusicManager mm : managers.values()) {
|
for (MusicManager mm : managers.values()) {
|
||||||
mm.leave();
|
mm.leave();
|
||||||
}
|
}
|
||||||
@@ -119,43 +105,7 @@ public class MusicManager {
|
|||||||
scheduler.setTextChannel(channel);
|
scheduler.setTextChannel(channel);
|
||||||
|
|
||||||
if (identifier != null) {
|
if (identifier != null) {
|
||||||
playerManager.loadItem(identifier, new AudioLoadResultHandler() {
|
playerManager.loadItem(identifier, new LoadResultHandler(identifier, channel, user, scheduler, silent));
|
||||||
@Override
|
|
||||||
public void trackLoaded(AudioTrack audioTrack) {
|
|
||||||
|
|
||||||
if (!silent) {
|
|
||||||
channel.sendMessage(MessageFunction.buildAddingTrackMessage(audioTrack, user)).queue();
|
|
||||||
}
|
|
||||||
|
|
||||||
scheduler.queue(audioTrack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void playlistLoaded(AudioPlaylist playlist) {
|
|
||||||
|
|
||||||
if (identifier.startsWith("ytsearch:")) {
|
|
||||||
AudioTrack track = playlist.getTracks().get(0);
|
|
||||||
|
|
||||||
channel.sendMessage(MessageFunction.buildAddingTrackMessage(track, user)).queue();
|
|
||||||
scheduler.queue(track);
|
|
||||||
} else {
|
|
||||||
for (AudioTrack track : playlist.getTracks()) {
|
|
||||||
scheduler.queue(track);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void noMatches() {
|
|
||||||
channel.sendMessage("No matches found").queue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void loadFailed(FriendlyException e) {
|
|
||||||
LogHandler.log(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
channel.sendMessage("No source found to play the given url").queue();
|
channel.sendMessage("No source found to play the given url").queue();
|
||||||
@@ -167,7 +117,6 @@ public class MusicManager {
|
|||||||
if (!scheduler.queue.isEmpty()) {
|
if (!scheduler.queue.isEmpty()) {
|
||||||
scheduler.nextTrack();
|
scheduler.nextTrack();
|
||||||
} else {
|
} else {
|
||||||
stopMusic();
|
|
||||||
leave();
|
leave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,6 +132,7 @@ public class MusicManager {
|
|||||||
public List<String> getAllQueuedTrack() {
|
public List<String> getAllQueuedTrack() {
|
||||||
List<String> queuedTracks = new LinkedList<>();
|
List<String> queuedTracks = new LinkedList<>();
|
||||||
scheduler.queue.forEach((a) -> queuedTracks.add(a.getInfo().title));
|
scheduler.queue.forEach((a) -> queuedTracks.add(a.getInfo().title));
|
||||||
|
|
||||||
return queuedTracks;
|
return queuedTracks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ public class ChannelFunction {
|
|||||||
private synchronized static void deleteFromList(List<Message> messages, TextChannel channel) {
|
private synchronized static void deleteFromList(List<Message> messages, TextChannel channel) {
|
||||||
try {
|
try {
|
||||||
channel.deleteMessages(messages).complete();
|
channel.deleteMessages(messages).complete();
|
||||||
logger.debug("Deleted " + messages.size() + " messages");
|
logger.debug("Deleted " + messages.size() + " messages from channel ["+ channel.getName() + "] in guild [" + channel.getGuild().getName() + "]");
|
||||||
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
messages.forEach(m -> {
|
messages.forEach(m -> {
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ package netneutrality.utils;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.*;
|
||||||
@@ -58,10 +61,26 @@ public class MessageFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized static MessageEmbed buildAddingTrackMessage(AudioTrack track, Member user) {
|
public synchronized static MessageEmbed buildAddingTrackMessage(AudioTrack track, Member user) {
|
||||||
|
Duration d = Duration.ofMillis(track.getDuration());
|
||||||
|
|
||||||
EmbedBuilder message = new EmbedBuilder();
|
EmbedBuilder message = new EmbedBuilder();
|
||||||
message.setTitle("Adding track to queue..");
|
message.setTitle("Adding track to queue..");
|
||||||
message.setColor(Color.BLUE);
|
message.setColor(Color.BLUE);
|
||||||
message.addField("Track title: ", track.getInfo().title, false);
|
message.addField("Track title: ", track.getInfo().title, false);
|
||||||
|
message.addField("Duration: ", d.toMinutesPart() + ":" + d.toSecondsPart(), false);
|
||||||
|
message.setFooter("Requested by " + user.getUser().getName(), user.getUser().getAvatarUrl());
|
||||||
|
message.setTimestamp(OffsetDateTime.now());
|
||||||
|
|
||||||
|
|
||||||
|
return message.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized static MessageEmbed buildAddingPlaylistMessage(AudioPlaylist playlist, Member user) {
|
||||||
|
EmbedBuilder message = new EmbedBuilder();
|
||||||
|
message.setTitle("Adding playlist to queue..");
|
||||||
|
message.setColor(Color.BLUE);
|
||||||
|
message.addField("Playlist: ", playlist.getName(), false);
|
||||||
|
message.addField("Number of tracks: ", String.valueOf(playlist.getTracks().size()), false);
|
||||||
message.setFooter("Requested by " + user.getUser().getName(), user.getUser().getAvatarUrl());
|
message.setFooter("Requested by " + user.getUser().getName(), user.getUser().getAvatarUrl());
|
||||||
message.setTimestamp(OffsetDateTime.now());
|
message.setTimestamp(OffsetDateTime.now());
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user