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 { }
|
try { await msg.DeleteAsync().ConfigureAwait(false); } catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo, page should default to the page the current song is on
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task ListQueue(int page = 1)
|
public async Task ListQueue(int page = 0)
|
||||||
{
|
{
|
||||||
var mp = await _music.GetOrCreatePlayer(Context);
|
var mp = await _music.GetOrCreatePlayer(Context);
|
||||||
var (current, songs) = mp.QueueArray();
|
var (current, songs) = mp.QueueArray();
|
||||||
@ -195,14 +194,18 @@ namespace NadekoBot.Modules.Music
|
|||||||
await ReplyErrorLocalized("no_player").ConfigureAwait(false);
|
await ReplyErrorLocalized("no_player").ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (--page < 0)
|
if (--page < -1)
|
||||||
return;
|
return;
|
||||||
//todo say whether music player is stopped
|
|
||||||
//try { await musicPlayer.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { }
|
//try { await musicPlayer.UpdateSongDurationsAsync().ConfigureAwait(false); } catch { }
|
||||||
|
|
||||||
const int itemsPerPage = 10;
|
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 total = musicPlayer.TotalPlaytime;
|
||||||
//var totalStr = total == TimeSpan.MaxValue ? "∞" : GetText("time_format",
|
//var totalStr = total == TimeSpan.MaxValue ? "∞" : GetText("time_format",
|
||||||
// (int)total.TotalHours,
|
// (int)total.TotalHours,
|
||||||
@ -228,6 +231,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
desc = $"`🔊` {songs[current].PrettyFullName}\n\n" + desc;
|
desc = $"`🔊` {songs[current].PrettyFullName}\n\n" + desc;
|
||||||
|
|
||||||
var add = "";
|
var add = "";
|
||||||
|
if (mp.Stopped)
|
||||||
|
add += Format.Bold(GetText("queue_stopped", Format.Code(Prefix + "play"))) + "\n";
|
||||||
if (mp.RepeatCurrentSong)
|
if (mp.RepeatCurrentSong)
|
||||||
add += "🔂 " + GetText("repeating_cur_song") + "\n";
|
add += "🔂 " + GetText("repeating_cur_song") + "\n";
|
||||||
else if (mp.Shuffle)
|
else if (mp.Shuffle)
|
||||||
@ -345,7 +350,7 @@ namespace NadekoBot.Modules.Music
|
|||||||
}
|
}
|
||||||
catch (ArgumentOutOfRangeException)
|
catch (ArgumentOutOfRangeException)
|
||||||
{
|
{
|
||||||
//todo error message
|
await ReplyErrorLocalized("removed_song_error").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,6 @@ namespace NadekoBot.Services.Games
|
|||||||
{
|
{
|
||||||
if (pc.Verbose)
|
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)));
|
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 { }
|
try { await usrMsg.Channel.SendErrorAsync(returnMsg).ConfigureAwait(false); } catch { }
|
||||||
_log.Info(returnMsg);
|
_log.Info(returnMsg);
|
||||||
|
@ -174,7 +174,6 @@ namespace NadekoBot.Services.Music
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_log.Info("Loading related song");
|
_log.Info("Loading related song");
|
||||||
//todo test autoplay
|
|
||||||
await _musicService.TryQueueRelatedSongAsync(data.Song.Query, OutputTextChannel, VoiceChannel);
|
await _musicService.TryQueueRelatedSongAsync(data.Song.Query, OutputTextChannel, VoiceChannel);
|
||||||
Queue.Next();
|
Queue.Next();
|
||||||
}
|
}
|
||||||
@ -245,6 +244,8 @@ namespace NadekoBot.Services.Music
|
|||||||
manualSkip = true;
|
manualSkip = true;
|
||||||
// if player is stopped, and user uses .n, it should play current song.
|
// 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
|
// It's a bit weird, but that's the least annoying solution
|
||||||
|
if (!Stopped)
|
||||||
|
Queue.Next(skipCount - 1);
|
||||||
Stopped = false;
|
Stopped = false;
|
||||||
Unpause();
|
Unpause();
|
||||||
CancelCurrentSong();
|
CancelCurrentSong();
|
||||||
|
@ -108,18 +108,6 @@ namespace NadekoBot.Services.Music
|
|||||||
{
|
{
|
||||||
// ignored
|
// 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
|
catch
|
||||||
{
|
{
|
||||||
|
@ -440,6 +440,7 @@
|
|||||||
"music_queue_full": "Queue is full at {0}/{0}.",
|
"music_queue_full": "Queue is full at {0}/{0}.",
|
||||||
"music_queue_stopped": "Player is stopped. Use {0} command to start playing.",
|
"music_queue_stopped": "Player is stopped. Use {0} command to start playing.",
|
||||||
"music_removed_song": "Removed song",
|
"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_cur_song": "Repeating current song",
|
||||||
"music_repeating_playlist": "Repeating playlist",
|
"music_repeating_playlist": "Repeating playlist",
|
||||||
"music_repeating_track": "Repeating track",
|
"music_repeating_track": "Repeating track",
|
||||||
|
Loading…
Reference in New Issue
Block a user