Merge remote-tracking branch 'refs/remotes/Kwoth/dev' into dev
This commit is contained in:
commit
1453cabda2
@ -77,7 +77,7 @@ namespace NadekoBot.Modules.Music.Classes
|
||||
|
||||
public string PrettyVolume => $"🔉 {(int)(Volume * 100)}%";
|
||||
|
||||
public event Action<Song> SongRemoved = delegate { };
|
||||
public event Action<Song, int> SongRemoved = delegate { };
|
||||
|
||||
public MusicPlayer(IVoiceChannel startingVoiceChannel, float? defaultVolume)
|
||||
{
|
||||
@ -282,7 +282,7 @@ namespace NadekoBot.Modules.Music.Classes
|
||||
var song = playlist.ElementAtOrDefault(index);
|
||||
if (playlist.Remove(song) && !silent)
|
||||
{
|
||||
SongRemoved(song);
|
||||
SongRemoved(song, index);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -99,16 +99,16 @@ namespace NadekoBot.Modules.Music
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Destroy()
|
||||
public Task Destroy()
|
||||
{
|
||||
//await Context.Channel.SendErrorAsync("This command is temporarily disabled.").ConfigureAwait(false);
|
||||
|
||||
MusicPlayer musicPlayer;
|
||||
if (!MusicPlayers.TryGetValue(Context.Guild.Id, out musicPlayer)) return;
|
||||
if (!MusicPlayers.TryGetValue(Context.Guild.Id, out musicPlayer)) return Task.CompletedTask;
|
||||
if (((IGuildUser)Context.User).VoiceChannel == musicPlayer.PlaybackVoiceChannel)
|
||||
if (MusicPlayers.TryRemove(Context.Guild.Id, out musicPlayer))
|
||||
musicPlayer.Destroy();
|
||||
|
||||
return Task.CompletedTask;
|
||||
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
@ -458,31 +458,16 @@ $"{("tracks".SnPl(musicPlayer.Playlist.Count))} | {(int)total.TotalHours}h {tota
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public async Task Remove(int num)
|
||||
public Task Remove(int num)
|
||||
{
|
||||
MusicPlayer musicPlayer;
|
||||
if (!MusicPlayers.TryGetValue(Context.Guild.Id, out musicPlayer))
|
||||
return;
|
||||
return Task.CompletedTask;
|
||||
if (((IGuildUser)Context.User).VoiceChannel != musicPlayer.PlaybackVoiceChannel)
|
||||
return;
|
||||
|
||||
musicPlayer.SongRemoved += async (song) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var embed = new EmbedBuilder()
|
||||
.WithAuthor(eab => eab.WithName("Removed song #" + num).WithMusicIcon())
|
||||
.WithDescription(song.PrettyName)
|
||||
.WithFooter(ef => ef.WithText(song.PrettyInfo))
|
||||
.WithErrorColor();
|
||||
|
||||
await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
|
||||
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
return Task.CompletedTask;
|
||||
|
||||
musicPlayer.RemoveSongAt(num - 1);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
@ -490,8 +475,6 @@ $"{("tracks".SnPl(musicPlayer.Playlist.Count))} | {(int)total.TotalHours}h {tota
|
||||
[Priority(1)]
|
||||
public async Task Remove(string all)
|
||||
{
|
||||
|
||||
|
||||
if (all.Trim().ToUpperInvariant() != "ALL")
|
||||
return;
|
||||
MusicPlayer musicPlayer;
|
||||
@ -868,6 +851,23 @@ $"{("tracks".SnPl(musicPlayer.Playlist.Count))} | {(int)total.TotalHours}h {tota
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
|
||||
|
||||
mp.SongRemoved += async (song, index) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var embed = new EmbedBuilder()
|
||||
.WithAuthor(eab => eab.WithName("Removed song #" + (index + 1)).WithMusicIcon())
|
||||
.WithDescription(song.PrettyName)
|
||||
.WithFooter(ef => ef.WithText(song.PrettyInfo))
|
||||
.WithErrorColor();
|
||||
|
||||
await textCh.EmbedAsync(embed).ConfigureAwait(false);
|
||||
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
return mp;
|
||||
});
|
||||
Song resolvedSong;
|
||||
|
@ -28,7 +28,7 @@ namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
var channel = (ITextChannel)Context.Channel;
|
||||
|
||||
if (timeout < 0 || timeout > 3600)
|
||||
if ((timeout < 60 && timeout != 0) || timeout > 3600)
|
||||
return;
|
||||
|
||||
Timer t;
|
||||
|
@ -6063,7 +6063,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Rotates a roles color on an interval with a list of supplied colors. First argument is interval in seconds. Second argument is a role, followed by a space-separated list of colors in hex. Provide a rolename with a 0 interval to disable..
|
||||
/// Looks up a localized string similar to Rotates a roles color on an interval with a list of supplied colors. First argument is interval in seconds (Minimum 60). Second argument is a role, followed by a space-separated list of colors in hex. Provide a rolename with a 0 interval to disable..
|
||||
/// </summary>
|
||||
public static string rotaterolecolor_desc {
|
||||
get {
|
||||
@ -6072,7 +6072,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}rrc 1 MyLsdRole #ff0000 #00ff00 #0000ff` or `{0}rrc 0 MyLsdRole`.
|
||||
/// Looks up a localized string similar to `{0}rrc 60 MyLsdRole #ff0000 #00ff00 #0000ff` or `{0}rrc 0 MyLsdRole`.
|
||||
/// </summary>
|
||||
public static string rotaterolecolor_usage {
|
||||
get {
|
||||
|
@ -2866,9 +2866,9 @@
|
||||
<value>rotaterolecolor rrc</value>
|
||||
</data>
|
||||
<data name="rotaterolecolor_desc" xml:space="preserve">
|
||||
<value>Rotates a roles color on an interval with a list of supplied colors. First argument is interval in seconds. Second argument is a role, followed by a space-separated list of colors in hex. Provide a rolename with a 0 interval to disable.</value>
|
||||
<value>Rotates a roles color on an interval with a list of supplied colors. First argument is interval in seconds (Minimum 60). Second argument is a role, followed by a space-separated list of colors in hex. Provide a rolename with a 0 interval to disable.</value>
|
||||
</data>
|
||||
<data name="rotaterolecolor_usage" xml:space="preserve">
|
||||
<value>`{0}rrc 1 MyLsdRole #ff0000 #00ff00 #0000ff` or `{0}rrc 0 MyLsdRole`</value>
|
||||
<value>`{0}rrc 60 MyLsdRole #ff0000 #00ff00 #0000ff` or `{0}rrc 0 MyLsdRole`</value>
|
||||
</data>
|
||||
</root>
|
@ -80,7 +80,8 @@ namespace NadekoBot
|
||||
|
||||
private Task Client_Log(LogMessage arg)
|
||||
{
|
||||
_log.Warn(arg.Exception, arg.Message);
|
||||
_log.Warn(arg.Message);
|
||||
_log.Error(arg.Exception);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user