0

Adjusted error messages and their deletion delays.

This commit is contained in:
Logan Fick
2019-05-30 12:33:49 -04:00
parent ae2d51e419
commit cb184967cb
16 changed files with 137 additions and 145 deletions

View File

@@ -58,26 +58,26 @@ public final class TrackLoadHandler implements AudioLoadResultHandler {
final AudioTrackInfo info = track.getInfo();
if (info.isStream) {
response = new CommandResponse("no_entry_sign",
response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention() + ", but streams cannot be added to the queue.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
response.sendResponse(this.channel);
return;
}
if (!(info.length >= 60000 && info.length <= 900000) && !PermissionManager.isWhitelisted(this.requester)) {
response = new CommandResponse("no_entry_sign",
response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention()
+ ", but you can only add tracks between 1 and 15 minutes in length.").setDeletionDelay(10,
TimeUnit.SECONDS);
+ ", but you can only add tracks between 1 and 15 minutes in length to the queue.")
.setDeletionDelay(30, TimeUnit.SECONDS);
response.sendResponse(this.channel);
return;
}
if (scheduler.isQueued(track)) {
response = new CommandResponse("no_entry_sign",
"Sorry " + this.requester.getAsMention() + ", but that track is already queued.")
.setDeletionDelay(10, TimeUnit.SECONDS);
response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention() + ", but that track is already in the queue.")
.setDeletionDelay(30, TimeUnit.SECONDS);
response.sendResponse(this.channel);
return;
}
@@ -109,18 +109,18 @@ public final class TrackLoadHandler implements AudioLoadResultHandler {
if (track != null) {
if (scheduler.isQueued(track)) {
response = new CommandResponse("no_entry_sign",
"Sorry " + this.requester.getAsMention() + ", but that track is already queued.")
.setDeletionDelay(10, TimeUnit.SECONDS);
response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention() + ", but that track is already in the queue.")
.setDeletionDelay(30, TimeUnit.SECONDS);
response.sendResponse(this.channel);
return;
}
final AudioTrackInfo info = track.getInfo();
if (info.isStream) {
response = new CommandResponse("no_entry_sign",
response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention() + ", but streams cannot be added to the queue.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
response.sendResponse(this.channel);
return;
}
@@ -133,9 +133,10 @@ public final class TrackLoadHandler implements AudioLoadResultHandler {
response.attachEmbed(TrackUtil.trackInfoEmbed(requestedTrack));
response.sendResponse(this.channel);
} else {
response = new CommandResponse("no_entry_sign", "Sorry " + this.requester.getAsMention()
+ ", but you are not allowed to add tracks less than 1 minute or greater than 15 minutes in length.")
.setDeletionDelay(10, TimeUnit.SECONDS);
response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention()
+ ", but you can only request tracks between 1 and 15 minutes in length.")
.setDeletionDelay(30, TimeUnit.SECONDS);
response.sendResponse(this.channel);
}
} else {
@@ -154,21 +155,21 @@ public final class TrackLoadHandler implements AudioLoadResultHandler {
}
if (addedTracks.size() == 0) {
response = new CommandResponse("no_entry_sign",
response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention()
+ ", but none of the tracks in that playlist could be added.").setDeletionDelay(10,
TimeUnit.SECONDS);
+ ", but none of the tracks in that playlist could be added to the queue.")
.setDeletionDelay(30, TimeUnit.SECONDS);
response.sendResponse(this.channel);
}
response = new CommandResponse("notes",
this.requester.getAsMention() + " added the following tracks to the queue:");
this.requester.getAsMention() + " added the following tracks from a playlist to the queue:");
response.attachEmbed(TrackUtil.trackListInfoEmbed(addedTracks, false));
response.sendResponse(this.channel);
} else {
response = new CommandResponse("no_entry_sign",
response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention()
+ ", but you are not allowed to add playlists to the queue.").setDeletionDelay(10,
+ ", but you are not allowed to add playlists to the queue.").setDeletionDelay(30,
TimeUnit.SECONDS);
response.sendResponse(this.channel);
}
@@ -177,9 +178,9 @@ public final class TrackLoadHandler implements AudioLoadResultHandler {
@Override
public final void noMatches() {
final CommandResponse response = new CommandResponse("map",
final CommandResponse response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention() + ", but I was not able to find that track.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
response.sendResponse(this.channel);
}
@@ -190,12 +191,12 @@ public final class TrackLoadHandler implements AudioLoadResultHandler {
final CommandResponse response;
final String message = exception.getMessage();
if (message.equals("Unknown file format.")) {
response = new CommandResponse("question",
response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention() + ", but I do not recognize the format of that track.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
} else if (message.equals("The playlist is private.")) {
response = new CommandResponse("no_entry_sign",
"Sorry " + this.requester.getAsMention() + ", but that playlist is private.").setDeletionDelay(10,
response = new CommandResponse("x",
"Sorry " + this.requester.getAsMention() + ", but that playlist is private.").setDeletionDelay(30,
TimeUnit.SECONDS);
} else {
final Guild guild = this.channel.getGuild();
@@ -203,7 +204,7 @@ public final class TrackLoadHandler implements AudioLoadResultHandler {
+ ") while trying to load a track!", exception);
response = new CommandResponse("sos",
"Sorry " + this.requester.getAsMention()
+ ", but an error occurred while trying to get that track!").setDeletionDelay(10,
+ ", but an error occurred while trying to get that track!").setDeletionDelay(30,
TimeUnit.SECONDS);
}
response.sendResponse(this.channel);

View File

@@ -70,9 +70,9 @@ public final class Settings implements Command {
} else {
final char[] input = arguments[1].replaceAll("\n", "").toCharArray();
if (input.length > 1) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but the command character must be a single character.").setDeletionDelay(10,
+ ", but the command character must be a single character.").setDeletionDelay(30,
TimeUnit.SECONDS);
} else if (input.length == 0) {
DataManager.deleteGuildKey(guild, "commandCharacter");
@@ -97,9 +97,9 @@ public final class Settings implements Command {
try {
volume = Integer.parseInt(arguments[1]);
} catch (final NumberFormatException exception) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but the default volume must be an integer.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (volume == 10) {
@@ -116,9 +116,9 @@ public final class Settings implements Command {
return new CommandResponse("white_check_mark",
executor.getAsMention() + ", the default volume has been set to `" + volume + "%`.");
} else {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but the default volume must be between 1% and 150%.").setDeletionDelay(10,
+ ", but the default volume must be between 1% and 150%.").setDeletionDelay(30,
TimeUnit.SECONDS);
}
}
@@ -127,10 +127,10 @@ public final class Settings implements Command {
try {
maxSlots = Integer.parseInt(arguments[1]);
} catch (final NumberFormatException exception) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but the maximum amount of queue slots per user must be an integer.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (maxSlots == 0) {
@@ -144,15 +144,14 @@ public final class Settings implements Command {
return new CommandResponse("white_check_mark", executor.getAsMention()
+ ", the maximum amount of queue slots per user has been set to `" + maxSlots + "`.");
} else {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but the maximum amount of queue slots per user must be between 1 and 249.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
} else {
return new CommandResponse("no_entry_sign",
"Sorry " + executor.getAsMention() + ", but I do not know what that setting is.")
.setDeletionDelay(10, TimeUnit.SECONDS);
return new CommandResponse("x", "Sorry " + executor.getAsMention() + ", but that setting is unknown.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
}
}

View File

@@ -29,44 +29,43 @@ public final class Whitelist implements Command {
public final CommandResponse execute(final String[] arguments, final Member executor, final TextChannel channel) {
final Guild guild = channel.getGuild();
if (!executor.hasPermission(Permission.ADMINISTRATOR)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but you are not allowed to use this command.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (arguments.length == 0) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but you need to specify a user to add or remove from the whitelist.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
final String userID = arguments[0].replaceFirst("<@[!]?([0-9]*)>", "$1");
final Member member;
try {
member = guild.getMemberById(userID);
} catch (final Throwable exception) {
return new CommandResponse("no_entry_sign",
} catch (final NumberFormatException exception) {
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but that doesn't appear to be a valid user.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (member == null) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but that doesn't appear to be a valid user.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (member.hasPermission(Permission.ADMINISTRATOR)) {
return new CommandResponse("no_entry_sign", "Sorry " + executor.getAsMention()
+ ", but you cannot remove that user from the whitelist due to them being a guild administrator.")
.setDeletionDelay(10, TimeUnit.SECONDS);
return new CommandResponse("x", "Sorry " + executor.getAsMention()
+ ", but you cannot remove that user from the whitelist because they are a guild administrator.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (member.getUser().isBot()) {
return new CommandResponse("no_entry_sign",
"Sorry " + executor.getAsMention() + ", but you cannot whitelist bots.").setDeletionDelay(10,
TimeUnit.SECONDS);
return new CommandResponse("x", "Sorry " + executor.getAsMention() + ", but you cannot whitelist bots.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (PermissionManager.isWhitelisted(member)) {

View File

@@ -31,17 +31,16 @@ public final class ForceSkip implements Command {
public final CommandResponse execute(final String[] arguments, final Member executor, final TextChannel channel) {
final Guild guild = channel.getGuild();
if (!AudioUtil.isTrackLoaded(guild)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but there must be a track playing in order to force skip it.").setDeletionDelay(10,
+ ", but there must be a track playing in order to force skip it.").setDeletionDelay(30,
TimeUnit.SECONDS);
}
if (!VoiceChannelUtil.isInCurrentVoiceChannel(executor)) {
return new CommandResponse("no_entry_sign",
"Sorry " + executor.getAsMention() + ", but you must be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(guild).getName()
+ "` in order to force skip tracks.").setDeletionDelay(10, TimeUnit.SECONDS);
return new CommandResponse("x", "Sorry " + executor.getAsMention() + ", but you must be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(guild).getName() + "` in order to force skip tracks.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
final RequestedTrack skippedTrack = AudioUtil.getLoadedTrack(guild);

View File

@@ -30,17 +30,16 @@ public final class Lock implements Command {
public final CommandResponse execute(final String[] arguments, final Member executor, final TextChannel channel) {
final Guild guild = channel.getGuild();
if (!AudioUtil.isTrackLoaded(guild)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but there must be a track playing in order to lock or unlock the queue.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (!VoiceChannelUtil.isInCurrentVoiceChannel(executor)) {
return new CommandResponse("no_entry_sign",
"Sorry " + executor.getAsMention() + ", but you must be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(guild).getName()
+ "` in order to lock or unlock the queue.").setDeletionDelay(10, TimeUnit.SECONDS);
return new CommandResponse("x", "Sorry " + executor.getAsMention() + ", but you must be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(guild).getName() + "` in order to lock or unlock the queue.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
final TrackScheduler scheduler = AudioUtil.getTrackScheduler(guild);

View File

@@ -29,17 +29,17 @@ public final class Pause implements Command {
public final CommandResponse execute(final String[] arguments, final Member executor, final TextChannel channel) {
final Guild guild = channel.getGuild();
if (!AudioUtil.isTrackLoaded(guild)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but there must be a track playing in order to pause or resume the track player.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (!VoiceChannelUtil.isInCurrentVoiceChannel(executor)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but you must be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(guild).getName()
+ "` in order to pause or resume the track player.").setDeletionDelay(10, TimeUnit.SECONDS);
+ "` in order to pause or resume the track player.").setDeletionDelay(30, TimeUnit.SECONDS);
}
if (AudioUtil.isPlayerPaused(guild)) {

View File

@@ -36,54 +36,53 @@ public final class Play implements Command {
public final CommandResponse execute(final String[] arguments, final Member executor, final TextChannel channel) {
final Guild guild = channel.getGuild();
if (AudioUtil.isTrackLoaded(guild) && !VoiceChannelUtil.isInCurrentVoiceChannel(executor)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but you need to be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(guild).getName()
+ "` in order to add songs to the queue.").setDeletionDelay(10, TimeUnit.SECONDS);
+ "` in order to add songs to the queue.").setDeletionDelay(30, TimeUnit.SECONDS);
}
final VoiceChannel targetChannel = VoiceChannelUtil.getVoiceChannelMemberIsConnectedTo(executor);
if (targetChannel == null) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but you need to be in a voice channel in order to add songs to the queue.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
final Member selfMember = guild.getSelfMember();
if (!selfMember.hasPermission(targetChannel, Permission.VOICE_CONNECT)
|| !selfMember.hasPermission(targetChannel, Permission.VOICE_SPEAK)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but I do not have the required permissions to use your current voice channel.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (arguments.length == 0) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but you need to provide a search query or a link to a specific track or playlist.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
final TrackScheduler scheduler = AudioUtil.getTrackScheduler(guild);
if (scheduler.isQueueLocked() && !PermissionManager.isWhitelisted(executor)) {
return new CommandResponse("lock", "Sorry " + executor.getAsMention() + ", but the queue is locked.")
.setDeletionDelay(10, TimeUnit.SECONDS);
return new CommandResponse("x", "Sorry " + executor.getAsMention() + ", but the queue is locked.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (scheduler.isQueueFull()) {
return new CommandResponse("card_box", "Sorry " + executor.getAsMention() + ", but the queue is full.")
.setDeletionDelay(10, TimeUnit.SECONDS);
return new CommandResponse("x", "Sorry " + executor.getAsMention() + ", but the queue is full.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
try {
final int maxSlots = Integer.parseInt(DataManager.getGuildValue(guild, "maximumSlots"));
if ((scheduler.occupiedSlotCount(executor) >= maxSlots) && !PermissionManager.isWhitelisted(executor)) {
return new CommandResponse("no_entry_sign", "Sorry " + executor.getAsMention()
+ ", you cannot request more than " + maxSlots + " tracks at the same time.")
.setDeletionDelay(10, TimeUnit.SECONDS);
return new CommandResponse("x", "Sorry " + executor.getAsMention() + ", you cannot request more than "
+ maxSlots + " tracks at the same time.").setDeletionDelay(30, TimeUnit.SECONDS);
}
} catch (final NumberFormatException exception) {
}

View File

@@ -46,9 +46,9 @@ public final class Queue implements Command {
try {
page = Integer.parseInt(arguments[0]);
} catch (final NumberFormatException exception) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but the page number must be an integer.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
}
@@ -68,7 +68,7 @@ public final class Queue implements Command {
}
response.setReactionCallbackTarget(executor);
response.setReactionCallbackExpireDelay(15, TimeUnit.SECONDS);
response.setReactionCallbackExpireDelay(1, TimeUnit.MINUTES);
response.attachEmbed(TrackUtil.pagedTrackListInfoEmbed(queue, page));
return response;
}

View File

@@ -36,24 +36,24 @@ public final class Remove implements Command {
public final CommandResponse execute(final String[] arguments, final Member executor, final TextChannel channel) {
final TrackScheduler scheduler = AudioUtil.getTrackScheduler(channel.getGuild());
if (scheduler.isQueueEmpty()) {
return new CommandResponse("no_entry_sign",
"Sorry " + executor.getAsMention() + ", but there are no tracks in the queue.").setDeletionDelay(10,
TimeUnit.SECONDS);
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but there are no tracks in the queue to remove.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
final Guild guild = channel.getGuild();
if (AudioUtil.isTrackLoaded(guild) && !VoiceChannelUtil.isInCurrentVoiceChannel(executor)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but you need to be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(guild).getName()
+ "` in order to remove tracks from the queue.").setDeletionDelay(10, TimeUnit.SECONDS);
+ "` in order to remove tracks from the queue.").setDeletionDelay(30, TimeUnit.SECONDS);
}
if (arguments.length == 0) {
if (!guild.getSelfMember().hasPermission(channel, Permission.MESSAGE_ADD_REACTION)) {
return new CommandResponse("no_entry_sign", "Sorry " + executor.getAsMention()
return new CommandResponse("x", "Sorry " + executor.getAsMention()
+ ", but I do not have the required permissions to create a reaction selection dialog in this text channel.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
final CommandResponse response = new CommandResponse("question",
@@ -74,7 +74,7 @@ public final class Remove implements Command {
}
response.setReactionCallbackTarget(executor);
response.setDeletionDelay(30, TimeUnit.SECONDS);
response.setDeletionDelay(1, TimeUnit.MINUTES);
return response;
}
@@ -82,9 +82,8 @@ public final class Remove implements Command {
try {
index = Integer.parseInt(arguments[0]);
} catch (final NumberFormatException exception) {
return new CommandResponse("no_entry_sign",
"Sorry " + executor.getAsMention() + ", but the index must be an integer.").setDeletionDelay(10,
TimeUnit.SECONDS);
return new CommandResponse("x", "Sorry " + executor.getAsMention() + ", but the index must be an integer.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
try {
@@ -96,9 +95,9 @@ public final class Remove implements Command {
response.attachEmbed(TrackUtil.trackInfoEmbed(removedTrack));
return response;
} catch (final IndexOutOfBoundsException exception) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but that index is outside the bounds of the queue.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
}
}

View File

@@ -29,10 +29,10 @@ public final class Reset implements Command {
public final CommandResponse execute(final String[] arguments, final Member executor, final TextChannel channel) {
final Guild guild = channel.getGuild();
if (AudioUtil.isTrackLoaded(guild) && !VoiceChannelUtil.isInCurrentVoiceChannel(executor)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but you need to be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(guild).getName()
+ "` in order to reset the audio player.").setDeletionDelay(10, TimeUnit.SECONDS);
+ "` in order to reset the audio player.").setDeletionDelay(30, TimeUnit.SECONDS);
}
AudioUtil.getTrackScheduler(guild).clearQueue();

View File

@@ -31,16 +31,16 @@ public final class Shuffle implements Command {
final Guild guild = channel.getGuild();
final TrackScheduler scheduler = AudioUtil.getTrackScheduler(guild);
if (scheduler.isQueueEmpty()) {
return new CommandResponse("no_entry_sign",
"Sorry " + executor.getAsMention() + ", but there are no tracks in the queue.").setDeletionDelay(10,
TimeUnit.SECONDS);
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but there are no tracks in the queue to shuffle.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (AudioUtil.isTrackLoaded(guild) && !VoiceChannelUtil.isInCurrentVoiceChannel(executor)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but you need to be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(guild).getName()
+ "` in order to shuffle the queue.").setDeletionDelay(10, TimeUnit.SECONDS);
+ "` in order to shuffle the queue.").setDeletionDelay(30, TimeUnit.SECONDS);
}
scheduler.shuffleQueue();

View File

@@ -32,23 +32,23 @@ public final class Skip implements Command {
public final CommandResponse execute(final String[] arguments, final Member executor, final TextChannel channel) {
final Guild guild = channel.getGuild();
if (!AudioUtil.isTrackLoaded(guild)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but there must be a track playing in order to vote to skip it.").setDeletionDelay(10,
+ ", but there must be a track playing in order to vote to skip it.").setDeletionDelay(30,
TimeUnit.SECONDS);
}
if (!VoiceChannelUtil.isInCurrentVoiceChannel(executor)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but you must be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(channel.getGuild()).getName()
+ "` in order to vote to skip the current track.").setDeletionDelay(10, TimeUnit.SECONDS);
+ "` in order to vote to skip the current track.").setDeletionDelay(30, TimeUnit.SECONDS);
}
if (SkipTracker.hasVoted(executor)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"You have already voted to skip the current track " + executor.getAsMention() + ".")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
SkipTracker.registerVote(executor);
@@ -61,11 +61,13 @@ public final class Skip implements Command {
return response;
} else {
if (SkipTracker.getRemainingRequired(guild) == 1) {
return new CommandResponse("x", executor.getAsMention() + " has voted to skip the current track. "
+ SkipTracker.getRemainingRequired(guild) + " more vote is needed.");
return new CommandResponse("exclamation",
executor.getAsMention() + " has voted to skip the current track. "
+ SkipTracker.getRemainingRequired(guild) + " more vote is needed.");
} else {
return new CommandResponse("x", executor.getAsMention() + " has voted to skip the current track. "
+ SkipTracker.getRemainingRequired(guild) + " more votes are needed.");
return new CommandResponse("exclamation",
executor.getAsMention() + " has voted to skip the current track. "
+ SkipTracker.getRemainingRequired(guild) + " more votes are needed.");
}
}
}

View File

@@ -29,17 +29,17 @@ public final class Volume implements Command {
public final CommandResponse execute(final String[] arguments, final Member executor, final TextChannel channel) {
final Guild guild = channel.getGuild();
if (!AudioUtil.isTrackLoaded(guild)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention()
+ ", but there must be a track playing in order to change the volume of the track player.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (!VoiceChannelUtil.isInCurrentVoiceChannel(executor)) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but you must be in voice channel `"
+ AudioUtil.getVoiceChannelConnectedTo(guild).getName()
+ "` in order to change the volume of the track player.").setDeletionDelay(10,
+ "` in order to change the volume of the track player.").setDeletionDelay(30,
TimeUnit.SECONDS);
}
@@ -57,9 +57,8 @@ public final class Volume implements Command {
try {
volume = Integer.parseInt(arguments[0]);
} catch (final NumberFormatException exception) {
return new CommandResponse("no_entry_sign",
"Sorry " + executor.getAsMention() + ", but the volume must be an integer.").setDeletionDelay(10,
TimeUnit.SECONDS);
return new CommandResponse("x", "Sorry " + executor.getAsMention() + ", but the volume must be an integer.")
.setDeletionDelay(30, TimeUnit.SECONDS);
}
if (volume <= 150 && volume >= 1) {
@@ -73,9 +72,9 @@ public final class Volume implements Command {
executor.getAsMention() + " set the volume from `" + oldVolume + "%` to `" + volume + "%`.");
}
} else {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but the volume must be between 1% and 150%.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
}
}

View File

@@ -58,9 +58,9 @@ public final class EightBall implements Command {
@Override
public final CommandResponse execute(final String[] arguments, final Member executor, final TextChannel channel) {
if (arguments.length == 0) {
return new CommandResponse("no_entry_sign",
return new CommandResponse("x",
"Sorry, " + executor.getAsMention() + ", but you need to supply a question for the Magic 8 Ball.")
.setDeletionDelay(10, TimeUnit.SECONDS);
.setDeletionDelay(30, TimeUnit.SECONDS);
}
final String question = StringUtil.sanitizeCodeBlock(String.join(" ", arguments));

View File

@@ -58,9 +58,8 @@ public final class CommandManager {
+ commandName + "' with arguments '" + String.join(" ", arguments) + "' in " + guild.getName() + " ("
+ guild.getId() + ").");
if (!commandMap.containsKey(commandName)) {
response = new CommandResponse("question",
"Sorry " + executor.getAsMention() + ", but I do not know what that command is.");
response.setDeletionDelay(10, TimeUnit.SECONDS);
response = new CommandResponse("x", "Sorry " + executor.getAsMention() + ", but that command is unknown.");
response.setDeletionDelay(30, TimeUnit.SECONDS);
response.sendResponse(channel);
return;
}
@@ -69,9 +68,9 @@ public final class CommandManager {
logger.info(executor.getEffectiveName() + " (" + executor.getUser().getId()
+ ") was denied access to a command due to not being whitelisted in " + guild.getName() + " ("
+ guild.getId() + ").");
response = new CommandResponse("no_entry_sign",
"Sorry " + executor.getAsMention() + ", but you are not allowed to use this command.");
response.setDeletionDelay(10, TimeUnit.SECONDS);
response = new CommandResponse("x",
"Sorry " + executor.getAsMention() + ", but you are not allowed to use that command.");
response.setDeletionDelay(30, TimeUnit.SECONDS);
response.sendResponse(channel);
return;
}
@@ -84,10 +83,7 @@ public final class CommandManager {
+ executor.getUser().getId() + ") in " + guild.getName() + " (" + guild.getId() + ").",
exception);
response = new CommandResponse("sos",
"Sorry " + executor.getAsMention() + ", but an error occurred while executing your command!!");
response.setDeletionDelay(10, TimeUnit.SECONDS);
response.sendResponse(channel);
return;
"Sorry " + executor.getAsMention() + ", but an error occurred while executing your command.");
}
if (response != null) {

View File

@@ -1,8 +1,5 @@
package dev.logal.logalbot.utils;
import com.vdurmont.emoji.Emoji;
import com.vdurmont.emoji.EmojiManager;
// Copyright 2019 Logan Fick
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,6 +14,9 @@ import com.vdurmont.emoji.EmojiManager;
// See the License for the specific language governing permissions and
// limitations under the License.
import com.vdurmont.emoji.Emoji;
import com.vdurmont.emoji.EmojiManager;
import net.dv8tion.jda.core.utils.Checks;
public final class StringUtil {