Esempio n. 1
0
        //TODO thinking this should be moved to the GuildData class
        async Task <DiscordChannel> CreateChannelAndMoveMemberAsync(DiscordGuild guild, DiscordMember channelCreator, int?maxUsers, int?bitrate, VoiceRegion region /*TODO not yet supported by D#+ but will be soon (hopefully)*/, IEnumerable <DiscordOverwriteBuilder> permissions)
        {
            DiscordChannel createdChannel = null;

            try
            {
                createdChannel = await guild.CreateVoiceChannelAsync(channelCreator.Nickname ?? $"{channelCreator.DisplayName}'s VC", registeredGuildData[guild].ParentCategory, bitrate, maxUsers, permissions, $"Channel created via command by member {channelCreator.DisplayName}#{channelCreator.Discriminator}:{channelCreator.Id}");

                registeredGuildData[guild].AddChannel(channelCreator, createdChannel);                 //Add the channel to the registerred guild's data container
            }
            catch (Exception)
            {
                //TODO log, respond letting the creator know the issue that occurred
                return(null);
            }

            await channelCreator.ModifyAsync(m => m.VoiceChannel = createdChannel);

            return(createdChannel);
        }