예제 #1
0
        /// <summary>
        /// Adds a user to a chat and sends a service message on it.
        /// </summary>
        /// <param name="chatId">Chat's identifier</param>
        /// <param name="user">User ID to be added</param>
        /// <param name="limit">Number of last messages to be forwarded</param>
        /// <returns>
        /// Returns a <see cref="IUpdates"/> object contains info on one message with auxiliary data and data on the current state of updates.
        /// </returns>
        public async Task <IUpdates> AddChatUserAsync(int chatId, IInputUser user, int limit)
        {
            EnsureUserAuthorized();

            var request = new RequestAddChatUser
            {
                ChatId   = chatId,
                UserId   = user,
                FwdLimit = limit
            };

            return(await SenderService.SendRequestAsync(request).ConfigureAwait(false));
        }
예제 #2
0
        /// <inheritdoc />
        public async Task <IUpdates> AddChatUserAsync(int chatId, IInputUser user, int limit, CancellationToken cancellationToken = default(CancellationToken))
        {
            ClientSettings.EnsureUserAuthorized();

            var request = new RequestAddChatUser
            {
                ChatId   = chatId,
                UserId   = user,
                FwdLimit = limit
            };

            return(await RequestSender.SendRequestAsync(request, cancellationToken).ConfigureAwait(false));
        }