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/TrackRequest.java

162 lines
3.4 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;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import moe.nekojimi.chords.commands.Invocation;
import moe.nekojimi.musicsearcher.Result;
/**
*
* @author jimj316
*/
public class TrackRequest
{
private Invocation invocation;
private String query;
private URL url;
private List<Result> searchResults;
private Result result;
private final List<Track> tracks = new ArrayList<>();
private String requestedBy;
private String requestedIn;
public List<Result> getSearchResults()
{
return searchResults;
}
public void setSearchResults(List<Result> searchResults)
{
this.searchResults = searchResults;
}
public Result getResult()
{
return result;
}
public void setResult(Result result)
{
this.result = result;
}
public Invocation getInvocation()
{
return invocation;
}
public void setInvocation(Invocation invocation)
{
this.invocation = invocation;
requestedBy = invocation.getRequestMessage().getAuthor().getName();
requestedIn = invocation.getRequestMessage().getChannel().getId();
}
// public Message getRequestMessage()
// {
// return requestMessage;
// }
//
// public void setRequestMessage(Message requestMessage)
// {
// this.requestMessage = requestMessage;
// }
//
// public Message getResponseMessage()
// {
// return responseMessage;
// }
//
// public void setResponseMessage(Message responseMessage)
// {
// this.responseMessage = responseMessage;
// }
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public URL getUrl()
{
return url;
}
public void setUrl(URL url)
{
this.url = url;
}
public List<Track> getTracks()
{
return tracks;
}
public void addTrack(Track track)
{
tracks.add(track);
}
public void clearTracks()
{
tracks.clear();
}
public String getRequestedBy()
{
return requestedBy;
}
public String getRequestedIn()
{
return requestedIn;
}
public String toString()
{
String trackName;
if (tracks.isEmpty())
trackName = "Request";
else
{
trackName = tracks.get(1).toString();
if (tracks.size() > 1)
trackName += " & " + (tracks.size() - 1) + " more tracks";
}
String requestName = "";
if (!requestedBy.isEmpty())
requestName = "for " + requestedBy;
return (trackName + " " + requestName).trim();
}
}