public async Task DeleteVoiceChannelAsync([Remainder] CachedVoiceChannel channel)
            {
                if (!ChannelExtensions.CheckViewChannelPermission(Context.CurrentMember !, channel))
                {
                    await ReplyErrorAsync(Localization.AdministrationVoiceChannelNoViewPermission);

                    return;
                }

                await channel.DeleteAsync();

                await ReplyConfirmationAsync(Localization.AdministrationVoiceChannelDeleted, channel.Name);
            }
Exemple #2
0
        public async ValueTask <LavalinkPlayer> ConnectAsync(CachedVoiceChannel channel)
        {
            if (Players.TryGetValue(channel.Guild.Id, out var player))
            {
                if (channel.Id != player.Channel.Id)
                {
                    await DiscordClient.UpdateVoiceStateAsync(channel.Guild.Id, channel.Id, isDeafened : SelfDeaf).ConfigureAwait(false);
                }

                return(player);
            }

            player = new LavalinkPlayer(this, channel);
            Players.TryAdd(channel.Guild.Id, player);

            await DiscordClient.UpdateVoiceStateAsync(channel.Guild.Id, channel.Id, isDeafened : SelfDeaf).ConfigureAwait(false);

            return(player);
        }