Example #1
0
        /// <summary>
        /// Forwards messages by their IDs.
        /// </summary>
        /// <param name="fromPeer">User or chat from where a message will be forwarded</param>
        /// <param name="toPeer">User or chat where a message will be forwarded</param>
        /// <param name="ids">Forwarded message IDs</param>
        /// <param name="silent"></param>
        /// <param name="withMyScore"></param>
        /// <returns>Returns a <see cref="IUpdates"/> object containing a service message sent during an action.</returns>
        public async Task <IUpdates> ForwardMessagesAsync(IInputPeer fromPeer, IInputPeer toPeer, TVector <int> ids, bool silent, bool withMyScore)
        {
            EnsureUserAuthorized();

            var forwardMessages = new RequestForwardMessages
            {
                FromPeer    = fromPeer,
                ToPeer      = toPeer,
                Id          = ids,
                Background  = false,
                Silent      = silent,
                WithMyScore = withMyScore,
                RandomId    = TlHelpers.GenerateRandomTVectorLong(ids.Items.Count)
            };

            return(await SenderService.SendRequestAsync(forwardMessages));
        }
        /// <inheritdoc />
        public async Task <IUpdates> ForwardMessagesAsync(IInputPeer fromPeer,
                                                          IInputPeer toPeer,
                                                          IReadOnlyList <int> ids,
                                                          bool silent,
                                                          bool withMyScore,
                                                          CancellationToken cancellationToken = default(CancellationToken))
        {
            ClientSettings.EnsureUserAuthorized();

            var forwardMessages = new RequestForwardMessages
            {
                FromPeer    = fromPeer,
                ToPeer      = toPeer,
                Id          = new TVector <int>(ids.ToArray()),
                Background  = false,
                Silent      = silent,
                WithMyScore = withMyScore,
                RandomId    = new TVector <long>(Random.NextLong())
            };

            return(await RequestSender.SendRequestAsync(forwardMessages, cancellationToken));
        }