Ejemplo n.º 1
0
        /// <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));
        }
Ejemplo n.º 2
0
        public static Guild CreateGuild(this DiscordClient client, GuildCreationProperties properties)
        {
            var resp = client.HttpClient.Post("/guilds", JsonConvert.SerializeObject(properties));

            Guild guild = JsonConvert.DeserializeObject <Guild>(resp.Content.ReadAsStringAsync().Result);

            guild.Client = client;
            return(guild);
        }
Ejemplo n.º 3
0
        /// <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));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a guild
        /// </summary>
        /// <param name="properties">Options for creating the guild</param>
        /// <returns>The created <see cref="Guild"/></returns>
        public static Guild CreateGuild(this DiscordClient client, string name, Image icon = null, string region = null)
        {
            GuildCreationProperties properties = new GuildCreationProperties()
            {
                Name = name
            };

            properties.Icon = icon;
            if (region != null)
            {
                properties.Region = region;
            }

            return(client.HttpClient.Post("/guilds", properties).Deserialize <Guild>().SetClient(client));
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a guild
 /// </summary>
 /// <param name="properties">Options for creating the guild</param>
 /// <returns>The created <see cref="Guild"/></returns>
 public static Guild CreateGuild(this DiscordClient client, GuildCreationProperties properties)
 {
     return(client.HttpClient.Post("/guilds", JsonConvert.SerializeObject(properties))
            .Deserialize <Guild>().SetClient(client));
 }