Change music message

This commit is contained in:
SebClem 2022-05-16 12:14:07 +02:00
parent 79c6f1b5ae
commit 32ba05bf99
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
2 changed files with 57 additions and 11 deletions

View File

@ -37,7 +37,7 @@ public class EmbedMessageUtils {
}
public static MessageEmbed getMusicInfo(AudioTrackInfo info, UserAudioTrack userAudioTrack) {
EmbedBuilder temp = new EmbedBuilder().setTitle(":loud_sound: Currently playing")
EmbedBuilder temp = new EmbedBuilder().setTitle(":information_source: Currently playing")
.addField("Title", info.title, false)
.addField("Author", info.author, false)
.addField("URL", info.uri, false)

View File

@ -21,6 +21,7 @@ import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.awt.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@ -214,7 +215,12 @@ public class AudioM {
public void skipTrack(SlashCommandEvent event) {
GuildMusicManager musicManager = getGuildAudioPlayer();
musicManager.scheduler.nextTrack();
Message message = new MessageBuilder().setEmbeds(EmbedMessageUtils.getMusicOk("Next music !")).build();
Message message = new MessageBuilder().setEmbeds(
EmbedMessageUtils.buildStandar(
new EmbedBuilder()
.setTitle(":track_next: Next Track")
.setColor(Color.green)
)).build();
event.getHook().sendMessage(message).queue();
}
@ -226,7 +232,12 @@ public class AudioM {
public void pause(SlashCommandEvent event) {
GuildMusicManager musicManager = getGuildAudioPlayer();
musicManager.scheduler.pause();
Message message = new MessageBuilder().setEmbeds(EmbedMessageUtils.getMusicOk("Playback paused")).build();
Message message = new MessageBuilder().setEmbeds(
EmbedMessageUtils.buildStandar(
new EmbedBuilder()
.setTitle(":pause_button: Playback paused")
.setColor(Color.green)
)).build();
event.getHook().sendMessage(message).queue();
@ -240,7 +251,12 @@ public class AudioM {
public void resume(SlashCommandEvent event) {
GuildMusicManager musicManager = getGuildAudioPlayer();
musicManager.scheduler.resume();
Message message = new MessageBuilder().setEmbeds(EmbedMessageUtils.getMusicOk("Playback resumed")).build();
Message message = new MessageBuilder().setEmbeds(
EmbedMessageUtils.buildStandar(
new EmbedBuilder()
.setTitle(":arrow_forward: Playback resumed")
.setColor(Color.green)
)).build();
event.getHook().sendMessage(message).queue();
}
@ -260,7 +276,12 @@ public class AudioM {
public void flush(SlashCommandEvent event) {
GuildMusicManager musicManager = getGuildAudioPlayer();
musicManager.scheduler.flush();
Message message = new MessageBuilder().setEmbeds(EmbedMessageUtils.getMusicOk("Flush playlist!")).build();
Message message = new MessageBuilder().setEmbeds(
EmbedMessageUtils.buildStandar(
new EmbedBuilder()
.setTitle(":wastebasket: Playlist flushed")
.setColor(Color.green)
)).build();
event.getHook().sendMessage(message).queue();
}
@ -272,18 +293,43 @@ public class AudioM {
public void list(SlashCommandEvent event) {
GuildMusicManager musicManager = getGuildAudioPlayer();
List<UserAudioTrackData> list = musicManager.scheduler.getList();
StringBuilder resp = new StringBuilder();
if (list.size() == 0) {
resp.append("Oh my god!\nThe playlist is empty ! \n:astonished: ");
} else {
for (UserAudioTrackData trackInfo : list) {
resp.append("- ");
resp.append(trackInfo.getAudioTrackInfo().title);
resp.append("\n");
}
}
Message message = new MessageBuilder().setEmbeds(EmbedMessageUtils.getMusicOk("Playlist:\n\n" + resp.toString())).build();
Message message = new MessageBuilder().setEmbeds(
EmbedMessageUtils.buildStandar(
new EmbedBuilder()
.setTitle(":scroll: Playlist")
.setColor(Color.green)
.setDescription("Oh no ! The playlist is empty !")
)).build();
event.getHook().sendMessage(message).queue();
} else {
StringBuilder resp = new StringBuilder();
int i = 0;
for (UserAudioTrackData trackInfo : list) {
resp.append(":arrow_right: ");
resp.append(trackInfo.getAudioTrackInfo().title);
resp.append(" - ");
resp.append(trackInfo.getAudioTrackInfo().author);
resp.append("\n\n");
if (i >= 5){
resp.append(":arrow_forward: And ");
resp.append(list.size() - 5);
resp.append(" other tracks ...");
break;
}
i++;
}
Message message = new MessageBuilder().setEmbeds(
EmbedMessageUtils.buildStandar(
new EmbedBuilder()
.setTitle(":scroll: Playlist")
.setColor(Color.green)
.setDescription(resp.toString())
)).build();
event.getHook().sendMessage(message).queue();
}
}
/**