Exemplo n.º 1
0
        public static async Task <Message> SendDocumentAsync(this BotClient bot, SendDocumentArgs args, [Optional] CancellationToken cancellationToken)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

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

            return(await bot.RPCAF <Message>(MethodNames.SendDocument, args, cancellationToken).ConfigureAwait(false));
        }
Exemplo n.º 2
0
        public static Message SendDocument(this BotClient bot, SendDocumentArgs args)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

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

            return(bot.RPCF <Message>(MethodNames.SendDocument, args));
        }
Exemplo n.º 3
0
        public static Message SendDocument(this BotClient api, long chatId, InputFile document, [Optional] InputFile?thumb, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] bool?disableContentTypeDetection, [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 SendDocumentArgs(chatId, document)
            {
                Thumb                       = thumb,
                Caption                     = caption,
                ParseMode                   = parseMode,
                CaptionEntities             = captionEntities,
                DisableContentTypeDetection = disableContentTypeDetection,
                DisableNotification         = disableNotification,
                ProtectContent              = protectContent,
                ReplyToMessageId            = replyToMessageId,
                AllowSendingWithoutReply    = allowSendingWithoutReply,
                ReplyMarkup                 = replyMarkup
            };

            return(api.RPCF <Message>(MethodNames.SendDocument, args));
        }
Exemplo n.º 4
0
        public static async Task <Message> SendDocumentAsync(this BotClient api, string chatId, string document, [Optional] string?thumb, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] bool?disableContentTypeDetection, [Optional] bool?disableNotification, [Optional] bool?protectContent, [Optional] int?replyToMessageId, [Optional] bool?allowSendingWithoutReply, [Optional] ReplyMarkup?replyMarkup, [Optional] IEnumerable <AttachedFile>?attachedFiles, [Optional] CancellationToken cancellationToken)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            var args = new SendDocumentArgs(chatId, document)
            {
                Thumb                       = thumb,
                Caption                     = caption,
                ParseMode                   = parseMode,
                CaptionEntities             = captionEntities,
                DisableContentTypeDetection = disableContentTypeDetection,
                DisableNotification         = disableNotification,
                ProtectContent              = protectContent,
                ReplyToMessageId            = replyToMessageId,
                AllowSendingWithoutReply    = allowSendingWithoutReply,
                ReplyMarkup                 = replyMarkup,
                AttachedFiles               = attachedFiles == null ? new List <AttachedFile>() : new List <AttachedFile>(attachedFiles)
            };

            return(await api.RPCAF <Message>(MethodNames.SendDocument, args, cancellationToken).ConfigureAwait(false));
        }