!!fp added

This commit is contained in:
Kwoth 2016-12-25 06:39:04 +01:00
parent 824916a41e
commit 3526f956c3
4 changed files with 58 additions and 8 deletions

View File

@ -34,7 +34,7 @@ namespace NadekoBot.Modules.Music.Classes
/// Player will prioritize different queuer name /// Player will prioritize different queuer name
/// over the song position in the playlist /// over the song position in the playlist
/// </summary> /// </summary>
public bool FairPlay { get; set; } = false; public bool FairPlay { get; set; } = true;
/// <summary> /// <summary>
/// Users who recently got their music wish /// Users who recently got their music wish
@ -214,7 +214,7 @@ namespace NadekoBot.Modules.Music.Classes
} }
recentlyPlayedUsers.Add(song.QueuerName); recentlyPlayedUsers.Add(song.QueuerName);
return song ?? playlist.FirstOrDefault(); return song;
} }
public void Shuffle() public void Shuffle()

View File

@ -126,6 +126,20 @@ namespace NadekoBot.Modules.Music
return Task.CompletedTask; return Task.CompletedTask;
} }
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task Fairplay(IUserMessage umsg)
{
var channel = (ITextChannel)umsg.Channel;
MusicPlayer musicPlayer;
if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) return;
if (((IGuildUser)umsg.Author).VoiceChannel != musicPlayer.PlaybackVoiceChannel)
return;
var val = musicPlayer.FairPlay = !musicPlayer.FairPlay;
await channel.SendConfirmAsync("Fair play " + (val ? "enabled" : "disabled") + ".").ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task Queue(IUserMessage umsg, [Remainder] string query) public async Task Queue(IUserMessage umsg, [Remainder] string query)

View File

@ -1374,7 +1374,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to `{0}cm &quot;module name&quot; enable SomeChannel`. /// Looks up a localized string similar to `{0}cm ModuleName enable SomeChannel`.
/// </summary> /// </summary>
public static string chnlmdl_usage { public static string chnlmdl_usage {
get { get {
@ -2435,6 +2435,33 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to fairplay fp.
/// </summary>
public static string fairplay_cmd {
get {
return ResourceManager.GetString("fairplay_cmd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Toggles fairplay. While enabled, music player will prioritize songs from users who didn&apos;t have their song recently played instead of the song&apos;s position in the queue..
/// </summary>
public static string fairplay_desc {
get {
return ResourceManager.GetString("fairplay_desc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to `{0}fp`.
/// </summary>
public static string fairplay_usage {
get {
return ResourceManager.GetString("fairplay_usage", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to fw. /// Looks up a localized string similar to fw.
/// </summary> /// </summary>
@ -5856,7 +5883,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to `{0}rm &quot;module name&quot; enable MyRole`. /// Looks up a localized string similar to `{0}rm ModuleName enable MyRole`.
/// </summary> /// </summary>
public static string rolemdl_usage { public static string rolemdl_usage {
get { get {
@ -5901,7 +5928,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Rolls 0-100. If you supply a number [x] it rolls up to 30 normal dice. If you split 2 numbers with letter d (xdy) it will roll x dice from 1 to y.. /// Looks up a localized string similar to Rolls 0-100. If you supply a number [x] it rolls up to 30 normal dice. If you split 2 numbers with letter d (xdy) it will roll x dice from 1 to y. Y can be a letter &apos;F&apos; if you want to roll fate dice instead of dnd..
/// </summary> /// </summary>
public static string roll_desc { public static string roll_desc {
get { get {
@ -5910,7 +5937,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to `{0}roll` or `{0}roll 7` or `{0}roll 3d5`. /// Looks up a localized string similar to `{0}roll` or `{0}roll 7` or `{0}roll 3d5` or `{0}roll 5dF`.
/// </summary> /// </summary>
public static string roll_usage { public static string roll_usage {
get { get {
@ -6909,7 +6936,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to `{0}sm &quot;module name&quot; enable`. /// Looks up a localized string similar to `{0}sm ModuleName enable`.
/// </summary> /// </summary>
public static string srvrmdl_usage { public static string srvrmdl_usage {
get { get {
@ -7692,7 +7719,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to `{0}um &quot;module name&quot; enable SomeUsername`. /// Looks up a localized string similar to `{0}um ModuleName enable SomeUsername`.
/// </summary> /// </summary>
public static string usrmdl_usage { public static string usrmdl_usage {
get { get {

View File

@ -2817,4 +2817,13 @@
<data name="log_usage" xml:space="preserve"> <data name="log_usage" xml:space="preserve">
<value>`{0}log userpresence` or `{0}log userbanned`</value> <value>`{0}log userpresence` or `{0}log userbanned`</value>
</data> </data>
<data name="fairplay_cmd" xml:space="preserve">
<value>fairplay fp</value>
</data>
<data name="fairplay_desc" xml:space="preserve">
<value>Toggles fairplay. While enabled, music player will prioritize songs from users who didn't have their song recently played instead of the song's position in the queue.</value>
</data>
<data name="fairplay_usage" xml:space="preserve">
<value>`{0}fp`</value>
</data>
</root> </root>