/// <summary> /// Creates a guild /// </summary> /// <param name="properties">Options for creating the guild</param> /// <returns>The created <see cref="DiscordGuild"/></returns> public static DiscordGuild CreateGuild(this DiscordClient client, string name, DiscordImage icon = null, string region = null) { return(client.CreateGuildAsync(name, icon, region).GetAwaiter().GetResult()); }
public static async Task <DiscordGuild> CreateGuildAsync(this DiscordClient client, string name, DiscordImage icon = null, string region = null) { return((await client.HttpClient.PostAsync("/guilds", new GuildCreationProperties() { Name = name, Icon = icon, Region = region })).Deserialize <DiscordGuild>().SetClient(client)); }
/// <summary> /// Creates a guild /// </summary> /// <param name="properties">Options for creating the guild</param> /// <returns>The created <see cref="DiscordGuild"/></returns> public static DiscordGuild CreateGuild(this DiscordClient client, string name, DiscordImage icon = null, string region = null) { GuildCreationProperties properties = new GuildCreationProperties() { Name = name, Icon = icon, Region = region }; return(client.HttpClient.Post("/guilds", properties).Deserialize <DiscordGuild>().SetClient(client)); }
public static async Task <IReadOnlyList <DiscordGuild> > CreateTemplatedGuildAsync(this DiscordClient client, string templateCode, string name, DiscordImage icon = null) { return((await client.HttpClient.PostAsync("/guilds/templates/" + templateCode, new GuildCreationProperties() { Name = name, Icon = icon })).Deserialize <IReadOnlyList <DiscordGuild> >().SetClientsInList(client)); }
/// <summary> /// Creates a guild from a template /// </summary> public static IReadOnlyList <DiscordGuild> CreateTemplatedGuild(this DiscordClient client, string templateCode, string name, DiscordImage icon = null) { return(client.CreateTemplatedGuildAsync(templateCode, name, icon).GetAwaiter().GetResult()); }
/// <summary> /// Creates a guild from a template /// </summary> public static IReadOnlyList <DiscordGuild> CreateTemplatedGuild(this DiscordClient client, string templateCode, string name, DiscordImage icon = null) { GuildCreationProperties properties = new GuildCreationProperties() { Name = name, Icon = icon }; return(client.HttpClient.Post("/guilds/templates/" + templateCode, properties).Deserialize <IReadOnlyList <DiscordGuild> >().SetClientsInList(client)); }