Esempio n. 1
0
        public async Task <RestMessage> GetMessageAsync(Snowflake channelId, Snowflake messageId, RestRequestOptions options = null)
        {
            try
            {
                var model = await ApiClient.GetChannelMessageAsync(channelId, messageId, options).ConfigureAwait(false);

                return(RestMessage.Create(this, model));
            }
            catch (SkyDiscordHttpException ex) when(ex.HttpStatusCode == HttpStatusCode.NotFound && ex.JsonErrorCode == JsonErrorCode.UnknownMessage)
            {
                return(null);
            }
        }
Esempio n. 2
0
        internal async Task <IReadOnlyList <RestMessage> > InternalGetMessagesAsync(Snowflake channelId, int limit = 100, RetrievalDirection direction = RetrievalDirection.Before, Snowflake?startFromId = null, RestRequestOptions options = null)
        {
            var models = await ApiClient.GetChannelMessagesAsync(channelId, limit, direction, startFromId, options).ConfigureAwait(false);

            return(models.ToReadOnlyList(this, (x, @this) => RestMessage.Create(@this, x)));
        }