DSharpPlus/Clients/DiscordClient.cs
/// <summary>
/// Creates a guild. This requires the bot to be in less than 10 guilds total.
/// </summary>
/// <param name="name">Name of the guild.</param>
/// <param name="region">Voice region of the guild.</param>
/// <param name="icon">Stream containing the icon for the guild.</param>
/// <param name="verificationLevel">Verification level for the guild.</param>
/// <param name="defaultMessageNotifications">Default message notification settings for the guild.</param>
/// <returns>The created guild.</returns>
/// <exception cref="Exceptions.NotFoundException">Thrown when the channel does not exist.</exception>
/// <exception cref="Exceptions.BadRequestException">Thrown when an invalid parameter was provided.</exception>
/// <exception cref="Exceptions.ServerErrorException">Thrown when Discord is unable to process the request.</exception>
Creates a guild. This requires the bot to be in less than 10 guilds total.
Creates a guild . This requires the bot to be in less than 10 guilds total .
public Task<DiscordGuild> CreateGuildAsync(string name, string region = null, Optional<Stream> icon = default, VerificationLevel? verificationLevel = null,
            DefaultMessageNotifications? defaultMessageNotifications = null)
        {
            var iconb64 = Optional.FromNoValue<string>();
            if (icon.HasValue && icon.Value != null)
                using (var imgtool = new ImageTool(icon.Value))
                    iconb64 = imgtool.GetBase64();
            else if (icon.HasValue)
                iconb64 = null;
            return this.ApiClient.CreateGuildAsync(name, region, iconb64, verificationLevel, defaultMessageNotifications);
        }
public Task < DiscordGuild > CreateGuildAsync ( string name , string region = null , Optional < Stream > icon = default , VerificationLevel ? verificationLevel = null , DefaultMessageNotifications ? defaultMessageNotifications = null ) { var iconb64 = Optional . FromNoValue < string > ( ) ; if ( icon . HasValue && icon . Value != null ) using ( var imgtool = new ImageTool ( icon . Value ) ) iconb64 = imgtool . GetBase64 ( ) ; else if ( icon . HasValue ) iconb64 = null ; return this . ApiClient . CreateGuildAsync ( name , region , iconb64 , verificationLevel , defaultMessageNotifications ) ; }
Creates a guild.
Creates a guild .
The created guild.
The created guild .
Thrown when the channel does not exist.
Thrown when the channel does not exist .
Thrown when an invalid parameter was provided.
Thrown when an invalid parameter was provided .
Thrown when Discord is unable to process the request.
Thrown when Discord is unable to process the request .
name
string
Name of the guild.
Name of the guild .
region
string
Voice region of the guild.
Voice region of the guild .
icon
Optional<Stream>
Stream containing the icon for the guild.
Stream containing the icon for the guild .
verificationLevel
VerificationLevel?
Verification level for the guild.
Verification level for the guild .
defaultMessageNotifications
DefaultMessageNotifications?
Default message notification settings for the guild.
Default message notification settings for the guild .