Example #1
0
        /// <summary>
        /// Forwards single messages.
        /// </summary>
        /// <param name="peer">User or chat where a message will be forwarded</param>
        /// <param name="messageId">Forwarded message ID</param>
        /// <returns>Returns a <see cref="IUpdates"/> object containing a service message sent during an action.</returns>
        public async Task <IUpdates> ForwardMessageAsync(IInputPeer peer, int messageId)
        {
            EnsureUserAuthorized();

            var forwardMessage = new RequestForwardMessage
            {
                Peer     = peer,
                Id       = messageId,
                RandomId = TlHelpers.GenerateRandomLong()
            };

            return(await SenderService.SendRequestAsync(forwardMessage).ConfigureAwait(false));
        }
Example #2
0
        /// <summary>Forwards single messages.</summary>
        /// <param name="peer">User or chat where a message will be forwarded</param>
        /// <param name="messageId">Forwarded message ID</param>
        /// <returns>Returns a <see cref="IUpdates" /> object containing a service message sent during an action.</returns>
        public async Task <IUpdates> ForwardMessageAsync(IInputPeer peer, int messageId, CancellationToken cancellationToken = default(CancellationToken))
        {
            AuthApiService.EnsureUserAuthorized();

            var forwardMessage = new RequestForwardMessage
            {
                Peer     = peer,
                Id       = messageId,
                RandomId = TlHelpers.GenerateRandomLong()
            };

            return(await SenderService.SendRequestAsync(forwardMessage, cancellationToken).ConfigureAwait(false));
        }