Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }