Revert "Add config for song limit per playlist"

This reverts commit 296a0a8178.
This commit is contained in:
Thongrapee Panyapatiphan 2021-10-01 20:48:32 +07:00
parent 296a0a8178
commit 96dcc4a536
No known key found for this signature in database
GPG key ID: 4B08AEC7F50F1967
3 changed files with 11 additions and 31 deletions

View file

@ -10,7 +10,6 @@ import LoadingMessage from '../utils/loading-message.js';
import errorMsg from '../utils/error-msg.js';
import Command from '.';
import GetSongs from '../services/get-songs.js';
import Config from '../services/config.js';
@injectable()
export default class implements Command {
@ -32,16 +31,10 @@ export default class implements Command {
private readonly playerManager: PlayerManager;
private readonly getSongs: GetSongs;
private readonly playlistLimit: number;
constructor(
@inject(TYPES.Managers.Player) playerManager: PlayerManager,
@inject(TYPES.Services.GetSongs) getSongs: GetSongs,
@inject(TYPES.Config) config: Config,
) {
constructor(@inject(TYPES.Managers.Player) playerManager: PlayerManager, @inject(TYPES.Services.GetSongs) getSongs: GetSongs) {
this.playerManager = playerManager;
this.getSongs = getSongs;
this.playlistLimit = config.getPlaylistLimit();
}
public async execute(msg: Message, args: string[]): Promise<void> {
@ -110,11 +103,11 @@ export default class implements Command {
} else if (url.protocol === 'spotify:' || url.host === 'open.spotify.com') {
const [convertedSongs, nSongsNotFound, totalSongs] = await this.getSongs.spotifySource(args[0]);
if (totalSongs > this.playlistLimit) {
extraMsg = `a random sample of ${this.playlistLimit} songs was taken`;
if (totalSongs > 50) {
extraMsg = 'a random sample of 50 songs was taken';
}
if (totalSongs > this.playlistLimit && nSongsNotFound !== 0) {
if (totalSongs > 50 && nSongsNotFound !== 0) {
extraMsg += ' and ';
}