Ejemplo n.º 1
0
        public async Task play([Remainder] string youtubevid = null)
        {
            var channel = (Context.Message.Author as IGuildUser)?.VoiceChannel;

            if (channel == null)
            {
                await Context.Channel.SendMessageAsync("You need to be in a voice channel!"); return;
            }
            Console.WriteLine(channel.Name);
            VoicemodEntity entity = _service.GetByGuildID(channel.GuildId);

            if (entity == null)
            {
                await Context.Channel.SendMessageAsync("I need to be in a voice channel first.");

                return;
            }

            await entity.Play(Context, youtubevid);
        }
Ejemplo n.º 2
0
        public async Task <VoicemodEntity> Join(IVoiceChannel channel)
        {
            VoicemodEntity entity = GetByGuildID(channel.GuildId);

            if (entity == null)
            {
                entity = new VoicemodEntity();
            }
            else if (entity.ChannelID != channel.Id && entity.GuildID == channel.GuildId)
            {
                await entity.aclient.StopAsync();

                VMODEntities.Remove(entity);
            }
            entity.ChannelID = channel.Id;
            entity.GuildID   = channel.GuildId;
            entity.aclient   = await channel.ConnectAsync();

            entity.Queue = new Queue <MusicQueueItem>();
            VMODEntities.Add(entity);
            return(entity);
        }