예제 #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);
        }
예제 #2
0
 public TextChannel CreateTextChannel(ChannelCreationProperties properties)
 {
     return(Client.CreateTextChannel(Id, properties));
 }
예제 #3
0
 public VoiceChannel CreateVoiceChannel(ChannelCreationProperties properties)
 {
     return(Client.CreateVoiceChannel(Id, properties));
 }
예제 #4
0
 public GuildChannel CreateChannel(ChannelCreationProperties properties)
 {
     return(Client.CreateGuildChannel(Id, properties));
 }
예제 #5
0
파일: Extensions.cs 프로젝트: ufgf/Anarchy
 public static VoiceChannel CreateVoiceChannel(this DiscordClient client, long guildId, ChannelCreationProperties properties)
 {
     properties.Type = ChannelType.Voice;
     return(client.createGuildChannel <VoiceChannel>(guildId, properties));
 }
예제 #6
0
파일: Extensions.cs 프로젝트: ufgf/Anarchy
 public static TextChannel CreateTextChannel(this DiscordClient client, long guildId, ChannelCreationProperties properties)
 {
     properties.Type = ChannelType.Text;
     return(client.createGuildChannel <TextChannel>(guildId, properties));
 }
예제 #7
0
파일: Extensions.cs 프로젝트: ufgf/Anarchy
 public static GuildChannel CreateGuildChannel(this DiscordClient client, long guildId, ChannelCreationProperties properties)
 {
     return(client.createGuildChannel <GuildChannel>(guildId, properties));
 }
예제 #8
0
파일: Extensions.cs 프로젝트: ufgf/Anarchy
 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));
 }