Exemplo n.º 1
0
        public static MessageID CopyMessage(
            this BotClient bot,
            CopyMessageArgs args)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

            if (args == default)
            {
                throw new ArgumentNullException(nameof(args));
            }

            return(bot.RPC <MessageID>(MethodNames.CopyMessage, args));
        }
Exemplo n.º 2
0
        public static async Task <MessageID> CopyMessageAsync(
            this BotClient bot,
            CopyMessageArgs args,
            [Optional] CancellationToken cancellationToken)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

            if (args == default)
            {
                throw new ArgumentNullException(nameof(args));
            }

            return(await bot.RPCA <MessageID>(MethodNames.CopyMessage, args, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Exemplo n.º 3
0
        public static MessageID CopyMessage(this BotClient api, long chatId, long fromChatId, int messageId, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] bool?disableNotification, [Optional] bool?protectContent, [Optional] int?replyToMessageId, [Optional] bool?allowSendingWithoutReply, [Optional] ReplyMarkup?replyMarkup)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            var args = new CopyMessageArgs(chatId, fromChatId, messageId)
            {
                Caption                  = caption,
                ParseMode                = parseMode,
                CaptionEntities          = captionEntities,
                DisableNotification      = disableNotification,
                ProtectContent           = protectContent,
                ReplyToMessageId         = replyToMessageId,
                AllowSendingWithoutReply = allowSendingWithoutReply,
                ReplyMarkup              = replyMarkup
            };

            return(api.RPC <MessageID>(MethodNames.CopyMessage, args));
        }
Exemplo n.º 4
0
        public static async Task <MessageID> CopyMessageAsync(this BotClient api, string chatId, string fromChatId, int messageId, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] bool?disableNotification, [Optional] bool?protectContent, [Optional] int?replyToMessageId, [Optional] bool?allowSendingWithoutReply, [Optional] ReplyMarkup?replyMarkup, [Optional] CancellationToken cancellationToken)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            var args = new CopyMessageArgs(chatId, fromChatId, messageId)
            {
                Caption                  = caption,
                ParseMode                = parseMode,
                CaptionEntities          = captionEntities,
                DisableNotification      = disableNotification,
                ProtectContent           = protectContent,
                ReplyToMessageId         = replyToMessageId,
                AllowSendingWithoutReply = allowSendingWithoutReply,
                ReplyMarkup              = replyMarkup
            };

            return(await api.RPCA <MessageID>(MethodNames.CopyMessage, args, cancellationToken).ConfigureAwait(false));
        }