Ejemplo n.º 1
0
        public static Channel CreateChannel(this DiscordClient client, long guildId, ChannelCreationProperties properties)
        {
            var resp = client.HttpClient.Post($"/guilds/{guildId}/channels", JsonConvert.SerializeObject(properties));

            if (resp.StatusCode == HttpStatusCode.NotFound)
            {
                throw new GuildNotFoundException(client, guildId);
            }

            Channel channel = JsonConvert.DeserializeObject <Channel>(resp.Content.ReadAsStringAsync().Result);

            channel.Client = client;
            return(channel);
        }
Ejemplo n.º 2
0
 public TextChannel CreateTextChannel(ChannelCreationProperties properties)
 {
     return(Client.CreateTextChannel(Id, properties));
 }
Ejemplo n.º 3
0
 public VoiceChannel CreateVoiceChannel(ChannelCreationProperties properties)
 {
     return(Client.CreateVoiceChannel(Id, properties));
 }
Ejemplo n.º 4
0
 public GuildChannel CreateChannel(ChannelCreationProperties properties)
 {
     return(Client.CreateGuildChannel(Id, properties));
 }
Ejemplo n.º 5
0
 public static VoiceChannel CreateVoiceChannel(this DiscordClient client, long guildId, ChannelCreationProperties properties)
 {
     properties.Type = ChannelType.Voice;
     return(client.createGuildChannel <VoiceChannel>(guildId, properties));
 }
Ejemplo n.º 6
0
 public static TextChannel CreateTextChannel(this DiscordClient client, long guildId, ChannelCreationProperties properties)
 {
     properties.Type = ChannelType.Text;
     return(client.createGuildChannel <TextChannel>(guildId, properties));
 }
Ejemplo n.º 7
0
 public static GuildChannel CreateGuildChannel(this DiscordClient client, long guildId, ChannelCreationProperties properties)
 {
     return(client.createGuildChannel <GuildChannel>(guildId, properties));
 }
Ejemplo n.º 8
0
 private static T createGuildChannel <T>(this DiscordClient client, long guildId, ChannelCreationProperties properties) where T : GuildChannel
 {
     return(client.HttpClient.Post($"/guilds/{guildId}/channels",
                                   JsonConvert.SerializeObject(properties)).Deserialize <T>().SetClient(client));
 }