Example #1
0
 internal RestInvite(RestDiscordClient client, InviteModel model) : base(client)
 {
     Code  = model.Code;
     Guild = new RestGuild(client, model.Guild);
     model.Channel.GuildId = model.Guild.Id;
     Channel = RestChannel.Create(client, model.Channel);
     Update(model);
 }
Example #2
0
        public async Task <T> GetChannelAsync <T>(Snowflake channelId, RestRequestOptions options = null) where T : RestChannel
        {
            try
            {
                var model = await ApiClient.GetChannelAsync(channelId, options).ConfigureAwait(false);

                return((T)RestChannel.Create(this, model));
            }
            catch (SkyDiscordHttpException ex) when(ex.HttpStatusCode == HttpStatusCode.NotFound)
            {
                return(null);
            }
        }