Discord bot that plays music from every website ever via youtube-dl
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Chords/src/main/java/moe/nekojimi/chords/commands/QueueCommand.java

84 lines
2.7 KiB

/*
* Copyright (C) 2022 jimj316
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package moe.nekojimi.chords.commands;
import java.util.List;
import java.util.Queue;
import moe.nekojimi.chords.Chords;
import moe.nekojimi.chords.Track;
import moe.nekojimi.chords.TrackRequest;
public class QueueCommand extends Command
{
public QueueCommand(Chords bot)
{
super(bot, "queue");
}
@Override
public void call(Invocation invocation)
{
String message = ">>> ";
int i = 1;
final Track currentTrack = bot.getMusicHandler().getCurrentTrack();
if (currentTrack != null)
message += ":notes: **Now playing: " + currentTrack + "**\n";
else
message += ":mute: **Not playing anything right now.**\n";
final Queue<Track> trackQueue = bot.getQueueManager().getJukeboxQueue();
if (!trackQueue.isEmpty())
{
message += "__Ready to play:__\n";
for (Track track : trackQueue)
{
message += ":bread: **" + i + ":** " + track + "\n";
i++;
}
}
final List<TrackRequest> downloading = bot.getDownloader().getDownloadingTracks();
if (!downloading.isEmpty())
{
message += "__Downloading:__\n";
for (TrackRequest request : downloading)
{
message += ":satellite: **" + (i) + ":** " + request + "\n";
i++;
}
}
final List<TrackRequest> downloadQueue = bot.getDownloader().getDownloadQueue();
if (!downloadQueue.isEmpty())
{
message += "__In queue for download:__\n";
for (TrackRequest request : downloadQueue)
{
message += ":inbox_tray: **" + (i) + ":** " + request + "\n";
i++;
}
}
if (downloading.isEmpty() && trackQueue.isEmpty() && downloadQueue.isEmpty())
message += ":mailbox_with_no_mail: The track queue is empty.";
// :inbox_tray:
invocation.respond(message);
}
}