diff --git a/NadekoBot/Classes/Music/MusicControls.cs b/NadekoBot/Classes/Music/MusicControls.cs index 8530c57e..f9b3e69a 100644 --- a/NadekoBot/Classes/Music/MusicControls.cs +++ b/NadekoBot/Classes/Music/MusicControls.cs @@ -9,20 +9,20 @@ using MusicModule = NadekoBot.Modules.Music; namespace NadekoBot.Classes.Music { public class MusicControls { private CommandEventArgs _e; - public bool NextSong = false; - public IAudioClient Voice; + public bool NextSong { get; set; } = false; + public IAudioClient Voice { get; set; } - public bool Pause = false; - public List SongQueue = new List(); - public StreamRequest CurrentSong = null; + public bool Pause { get; set; } = false; + public List SongQueue { get; set; } = new List(); + public StreamRequest CurrentSong { get; set; } = null; public float Volume { get; set; } = .5f; public bool IsPaused { get; internal set; } = false; public bool Stopped { get; private set; } - public Channel VoiceChannel = null; + public Channel VoiceChannel { get; set; } = null; - public IAudioClient VoiceClient = null; + public IAudioClient VoiceClient { get; set; } = null; private readonly object _voiceLock = new object(); diff --git a/NadekoBot/Modules/Music.cs b/NadekoBot/Modules/Music.cs index b7483d48..1c6526a7 100644 --- a/NadekoBot/Modules/Music.cs +++ b/NadekoBot/Modules/Music.cs @@ -9,6 +9,7 @@ using NadekoBot.Classes.Music; using Timer = System.Timers.Timer; using System.Threading.Tasks; using NadekoBot.Classes; +using Discord.Audio; namespace NadekoBot.Modules { class Music : DiscordModule { @@ -196,6 +197,16 @@ namespace NadekoBot.Modules { await QueueSong(e, e.GetArg("radio_link"), radio: true); }); + cgb.CreateCommand("mv") + .Description("Moves the bot to your voice channel. (works only if music is already playing)") + .Do(async e => { + MusicControls mc; + if (e.User.VoiceChannel == null || e.User.VoiceChannel.Server != e.Server || !musicPlayers.TryGetValue(e.Server,out mc)) + return; + mc.VoiceChannel = e.User.VoiceChannel; + mc.VoiceClient = await mc.VoiceChannel.JoinAudio(); + }); + cgb.CreateCommand("debug") .Description("Writes some music data to console. **BOT OWNER ONLY**") .Do(e => {