!m mv moves the bot to your voice channel (works only if music is playing)

This commit is contained in:
Master Kwoth 2016-02-14 19:35:00 +01:00
parent f62d9d0d79
commit 5901e25c42
2 changed files with 18 additions and 7 deletions

View File

@ -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<StreamRequest> SongQueue = new List<StreamRequest>();
public StreamRequest CurrentSong = null;
public bool Pause { get; set; } = false;
public List<StreamRequest> SongQueue { get; set; } = new List<StreamRequest>();
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();

View File

@ -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 => {