Beispiel #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);
        }
Beispiel #2
0
 public TextChannel CreateTextChannel(ChannelCreationProperties properties)
 {
     return(Client.CreateTextChannel(Id, properties));
 }
Beispiel #3
0
 public VoiceChannel CreateVoiceChannel(ChannelCreationProperties properties)
 {
     return(Client.CreateVoiceChannel(Id, properties));
 }
Beispiel #4
0
 public GuildChannel CreateChannel(ChannelCreationProperties properties)
 {
     return(Client.CreateGuildChannel(Id, properties));
 }
Beispiel #5
0
 public static VoiceChannel CreateVoiceChannel(this DiscordClient client, long guildId, ChannelCreationProperties properties)
 {
     properties.Type = ChannelType.Voice;
     return(client.createGuildChannel <VoiceChannel>(guildId, properties));
 }
Beispiel #6
0
 public static TextChannel CreateTextChannel(this DiscordClient client, long guildId, ChannelCreationProperties properties)
 {
     properties.Type = ChannelType.Text;
     return(client.createGuildChannel <TextChannel>(guildId, properties));
 }
Beispiel #7
0
 public static GuildChannel CreateGuildChannel(this DiscordClient client, long guildId, ChannelCreationProperties properties)
 {
     return(client.createGuildChannel <GuildChannel>(guildId, properties));
 }
Beispiel #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));
 }