!!n can now skip multiple songs, with consequences

This commit is contained in:
Kwoth 2016-10-28 14:08:02 +02:00
parent 7606a20c7f
commit c111f4c864
3 changed files with 14 additions and 5 deletions

View File

@ -38,14 +38,23 @@ namespace NadekoBot.Modules.Music
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public Task Next(IUserMessage umsg) public Task Next(IUserMessage umsg, int skipCount = 1)
{ {
var channel = (ITextChannel)umsg.Channel; var channel = (ITextChannel)umsg.Channel;
if (skipCount < 1)
return Task.CompletedTask;
MusicPlayer musicPlayer; MusicPlayer musicPlayer;
if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) return Task.CompletedTask; if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) return Task.CompletedTask;
if (musicPlayer.PlaybackVoiceChannel == ((IGuildUser)umsg.Author).VoiceChannel) if (musicPlayer.PlaybackVoiceChannel == ((IGuildUser)umsg.Author).VoiceChannel)
{
while (--skipCount > 0)
{
musicPlayer.RemoveSongAt(0);
}
musicPlayer.Next(); musicPlayer.Next();
}
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@ -4119,7 +4119,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Goes to the next song in the queue. You have to be in the same voice channel as the bot.. /// Looks up a localized string similar to Goes to the next song in the queue. You have to be in the same voice channel as the bot. You can skip multiple songs, but in that case songs will not be requeued if {0}rcs or {0}rpl is enabled..
/// </summary> /// </summary>
public static string next_desc { public static string next_desc {
get { get {
@ -4128,7 +4128,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to `{0}n`. /// Looks up a localized string similar to `{0}n` or `{0}n 5`.
/// </summary> /// </summary>
public static string next_usage { public static string next_usage {
get { get {

View File

@ -1426,10 +1426,10 @@
<value>next n</value> <value>next n</value>
</data> </data>
<data name="next_desc" xml:space="preserve"> <data name="next_desc" xml:space="preserve">
<value>Goes to the next song in the queue. You have to be in the same voice channel as the bot.</value> <value>Goes to the next song in the queue. You have to be in the same voice channel as the bot. You can skip multiple songs, but in that case songs will not be requeued if {0}rcs or {0}rpl is enabled.</value>
</data> </data>
<data name="next_usage" xml:space="preserve"> <data name="next_usage" xml:space="preserve">
<value>`{0}n`</value> <value>`{0}n` or `{0}n 5`</value>
</data> </data>
<data name="stop_cmd" xml:space="preserve"> <data name="stop_cmd" xml:space="preserve">
<value>stop s</value> <value>stop s</value>