People who are not in a voice channel now have much less control, Thanks to Lepia for suggestion.
This commit is contained in:
parent
6dce6de9e6
commit
8a58c63bf1
@ -57,12 +57,13 @@ namespace NadekoBot.Modules.Music
|
|||||||
cgb.CreateCommand("n")
|
cgb.CreateCommand("n")
|
||||||
.Alias("next")
|
.Alias("next")
|
||||||
.Alias("skip")
|
.Alias("skip")
|
||||||
.Description("Goes to the next song in the queue.**Usage**: `!m n`")
|
.Description("Goes to the next song in the queue. You have to be in the same voice channel as the bot.\n**Usage**: `!m n`")
|
||||||
.Do(e =>
|
.Do(e =>
|
||||||
{
|
{
|
||||||
MusicPlayer musicPlayer;
|
MusicPlayer musicPlayer;
|
||||||
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) return;
|
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) return;
|
||||||
musicPlayer.Next();
|
if (musicPlayer.PlaybackVoiceChannel == e.User.VoiceChannel)
|
||||||
|
musicPlayer.Next();
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("s")
|
cgb.CreateCommand("s")
|
||||||
@ -74,7 +75,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
{
|
{
|
||||||
MusicPlayer musicPlayer;
|
MusicPlayer musicPlayer;
|
||||||
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) return;
|
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) return;
|
||||||
musicPlayer.Stop();
|
if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel)
|
||||||
|
musicPlayer.Stop();
|
||||||
}).ConfigureAwait(false);
|
}).ConfigureAwait(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,7 +90,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
{
|
{
|
||||||
MusicPlayer musicPlayer;
|
MusicPlayer musicPlayer;
|
||||||
if (!MusicPlayers.TryRemove(e.Server, out musicPlayer)) return;
|
if (!MusicPlayers.TryRemove(e.Server, out musicPlayer)) return;
|
||||||
musicPlayer.Destroy();
|
if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel)
|
||||||
|
musicPlayer.Destroy();
|
||||||
}).ConfigureAwait(false);
|
}).ConfigureAwait(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -99,6 +102,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
{
|
{
|
||||||
MusicPlayer musicPlayer;
|
MusicPlayer musicPlayer;
|
||||||
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) return;
|
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) return;
|
||||||
|
if (e.User.VoiceChannel != musicPlayer.PlaybackVoiceChannel)
|
||||||
|
return;
|
||||||
musicPlayer.TogglePause();
|
musicPlayer.TogglePause();
|
||||||
if (musicPlayer.Paused)
|
if (musicPlayer.Paused)
|
||||||
await e.Channel.SendMessage("🎵`Music Player paused.`").ConfigureAwait(false);
|
await e.Channel.SendMessage("🎵`Music Player paused.`").ConfigureAwait(false);
|
||||||
@ -172,6 +177,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
MusicPlayer musicPlayer;
|
MusicPlayer musicPlayer;
|
||||||
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
||||||
return;
|
return;
|
||||||
|
if (e.User.VoiceChannel != musicPlayer.PlaybackVoiceChannel)
|
||||||
|
return;
|
||||||
var arg = e.GetArg("val");
|
var arg = e.GetArg("val");
|
||||||
int volume;
|
int volume;
|
||||||
if (!int.TryParse(arg, out volume))
|
if (!int.TryParse(arg, out volume))
|
||||||
@ -208,6 +215,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
MusicPlayer musicPlayer;
|
MusicPlayer musicPlayer;
|
||||||
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
||||||
return;
|
return;
|
||||||
|
if (e.User.VoiceChannel != musicPlayer.PlaybackVoiceChannel)
|
||||||
|
return;
|
||||||
musicPlayer.SetVolume(0);
|
musicPlayer.SetVolume(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -218,6 +227,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
MusicPlayer musicPlayer;
|
MusicPlayer musicPlayer;
|
||||||
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
||||||
return;
|
return;
|
||||||
|
if (e.User.VoiceChannel != musicPlayer.PlaybackVoiceChannel)
|
||||||
|
return;
|
||||||
musicPlayer.SetVolume(100);
|
musicPlayer.SetVolume(100);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -228,6 +239,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
MusicPlayer musicPlayer;
|
MusicPlayer musicPlayer;
|
||||||
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
||||||
return;
|
return;
|
||||||
|
if (e.User.VoiceChannel != musicPlayer.PlaybackVoiceChannel)
|
||||||
|
return;
|
||||||
musicPlayer.SetVolume(50);
|
musicPlayer.SetVolume(50);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -238,6 +251,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
MusicPlayer musicPlayer;
|
MusicPlayer musicPlayer;
|
||||||
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
||||||
return;
|
return;
|
||||||
|
if (e.User.VoiceChannel != musicPlayer.PlaybackVoiceChannel)
|
||||||
|
return;
|
||||||
if (musicPlayer.Playlist.Count < 2)
|
if (musicPlayer.Playlist.Count < 2)
|
||||||
{
|
{
|
||||||
await e.Channel.SendMessage("💢 Not enough songs in order to perform the shuffle.").ConfigureAwait(false);
|
await e.Channel.SendMessage("💢 Not enough songs in order to perform the shuffle.").ConfigureAwait(false);
|
||||||
@ -352,6 +367,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (e.User.VoiceChannel != musicPlayer.PlaybackVoiceChannel)
|
||||||
|
return;
|
||||||
if (arg?.ToLower() == "all")
|
if (arg?.ToLower() == "all")
|
||||||
{
|
{
|
||||||
musicPlayer.ClearQueue();
|
musicPlayer.ClearQueue();
|
||||||
@ -545,7 +562,8 @@ namespace NadekoBot.Modules.Music
|
|||||||
MusicPlayer musicPlayer;
|
MusicPlayer musicPlayer;
|
||||||
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
||||||
return;
|
return;
|
||||||
|
if (e.User.VoiceChannel != musicPlayer.PlaybackVoiceChannel)
|
||||||
|
return;
|
||||||
int skipTo;
|
int skipTo;
|
||||||
if (!int.TryParse(skipToStr, out skipTo) || skipTo < 0)
|
if (!int.TryParse(skipToStr, out skipTo) || skipTo < 0)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user