Fixes. .lq will say at the top if it's stopped. .lq will also default to the page current song is playing from
This commit is contained in:
parent
1d1b7de20a
commit
728aeab809
@ -181,11 +181,10 @@ namespace NadekoBot.Modules.Music
|
||||
try { await msg.DeleteAsync().ConfigureAwait(false); } catch { }
|
||||
}
|
||||
}
|
||||
|
||||
//todo, page should default to the page the current song is on
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ListQueue(int page = 1)
|
||||
public async Task ListQueue(int page = 0)
|
||||
{
|
||||
var mp = await _music.GetOrCreatePlayer(Context);
|
||||
var (current, songs) = mp.QueueArray();
|
||||
@ -195,14 +194,18 @@ namespace NadekoBot.Modules.Music
|
||||
await ReplyErrorLocalized("no_player").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (--page < 0)
|
||||
|
||||
if (--page < -1)
|
||||
return;
|
||||
//todo say whether music player is stopped
|
||||
//try { await musicPlayer.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { }
|
||||
|
||||
const int itemsPerPage = 10;
|
||||
|
||||
if (page == -1)
|
||||
page = current / itemsPerPage;
|
||||
|
||||
//if page is 0 (-1 after this decrement) that means default to the page current song is playing from
|
||||
|
||||
//var total = musicPlayer.TotalPlaytime;
|
||||
//var totalStr = total == TimeSpan.MaxValue ? "∞" : GetText("time_format",
|
||||
// (int)total.TotalHours,
|
||||
@ -228,6 +231,8 @@ namespace NadekoBot.Modules.Music
|
||||
desc = $"`🔊` {songs[current].PrettyFullName}\n\n" + desc;
|
||||
|
||||
var add = "";
|
||||
if (mp.Stopped)
|
||||
add += Format.Bold(GetText("queue_stopped", Format.Code(Prefix + "play"))) + "\n";
|
||||
if (mp.RepeatCurrentSong)
|
||||
add += "🔂 " + GetText("repeating_cur_song") + "\n";
|
||||
else if (mp.Shuffle)
|
||||
@ -345,7 +350,7 @@ namespace NadekoBot.Modules.Music
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
//todo error message
|
||||
await ReplyErrorLocalized("removed_song_error").ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,6 @@ namespace NadekoBot.Services.Games
|
||||
{
|
||||
if (pc.Verbose)
|
||||
{
|
||||
//todo move this to permissions
|
||||
var returnMsg = _strings.GetText("trigger", guild.Id, "Permissions".ToLowerInvariant(), index + 1, Format.Bold(pc.Permissions[index].GetCommand(_cmd.GetPrefix(guild), (SocketGuild)guild)));
|
||||
try { await usrMsg.Channel.SendErrorAsync(returnMsg).ConfigureAwait(false); } catch { }
|
||||
_log.Info(returnMsg);
|
||||
|
@ -174,7 +174,6 @@ namespace NadekoBot.Services.Music
|
||||
try
|
||||
{
|
||||
_log.Info("Loading related song");
|
||||
//todo test autoplay
|
||||
await _musicService.TryQueueRelatedSongAsync(data.Song.Query, OutputTextChannel, VoiceChannel);
|
||||
Queue.Next();
|
||||
}
|
||||
@ -245,6 +244,8 @@ namespace NadekoBot.Services.Music
|
||||
manualSkip = true;
|
||||
// if player is stopped, and user uses .n, it should play current song.
|
||||
// It's a bit weird, but that's the least annoying solution
|
||||
if (!Stopped)
|
||||
Queue.Next(skipCount - 1);
|
||||
Stopped = false;
|
||||
Unpause();
|
||||
CancelCurrentSong();
|
||||
|
@ -108,18 +108,6 @@ namespace NadekoBot.Services.Music
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
//todo autoplay should be independent from event handlers
|
||||
//if (mp.Autoplay && mp.Playlist.Count == 0 && song.SongInfo.ProviderType == MusicType.Normal)
|
||||
//{
|
||||
// var relatedVideos = (await _google.GetRelatedVideosAsync(song.SongInfo.Query, 4)).ToList();
|
||||
// if (relatedVideos.Count > 0)
|
||||
// await QueueSong(await textCh.Guild.GetCurrentUserAsync(),
|
||||
// textCh,
|
||||
// voiceCh,
|
||||
// relatedVideos[new NadekoRandom().Next(0, relatedVideos.Count)],
|
||||
// true).ConfigureAwait(false);
|
||||
//}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -440,6 +440,7 @@
|
||||
"music_queue_full": "Queue is full at {0}/{0}.",
|
||||
"music_queue_stopped": "Player is stopped. Use {0} command to start playing.",
|
||||
"music_removed_song": "Removed song",
|
||||
"music_removed_song_error": "Song on that index doesn't exist",
|
||||
"music_repeating_cur_song": "Repeating current song",
|
||||
"music_repeating_playlist": "Repeating playlist",
|
||||
"music_repeating_track": "Repeating track",
|
||||
|
Loading…
Reference in New Issue
Block a user