Пример #1
0
        public Task <SendMessageResponse> SendFile(string channelId, string filePath)
        {
            if (channelId == null)
            {
                throw new ArgumentNullException(nameof(channelId));
            }
            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            return(_rest.PostFile <SendMessageResponse>(Endpoints.ChannelMessages(channelId), filePath));
        }
Пример #2
0
        public Task <GetMessagesResponse> GetMessages(string channelId, int count, string beforeMessageId = null)
        {
            if (channelId == null)
            {
                throw new ArgumentNullException(nameof(channelId));
            }

            if (beforeMessageId != null)
            {
                return(_rest.Get <GetMessagesResponse>(Endpoints.ChannelMessages(channelId, count, beforeMessageId)));
            }
            else
            {
                return(_rest.Get <GetMessagesResponse>(Endpoints.ChannelMessages(channelId, count)));
            }
        }
Пример #3
0
        //Messages
        public Task <SendMessageResponse> SendMessage(string channelId, string message, IEnumerable <string> mentionedUserIds = null, string nonce = null, bool isTTS = false)
        {
            if (channelId == null)
            {
                throw new ArgumentNullException(nameof(channelId));
            }
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            var request = new SendMessageRequest {
                Content = message, Mentions = mentionedUserIds ?? new string[0], Nonce = nonce, IsTTS = isTTS ? true : false
            };

            return(_rest.Post <SendMessageResponse>(Endpoints.ChannelMessages(channelId), request));
        }