예제 #1
0
        public static async Task <Message> SendAudioAsync(this BotClient api, string chatId, string audio, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] uint?duration, [Optional] string?performer, [Optional] string?title, [Optional] string?thumb, [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 SendAudioArgs(chatId, audio)
            {
                Caption                  = caption,
                ParseMode                = parseMode,
                CaptionEntities          = captionEntities,
                Duration                 = duration,
                Performer                = performer,
                Title                    = title,
                Thumb                    = thumb,
                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.SendAudio, args, cancellationToken).ConfigureAwait(false));
        }
예제 #2
0
        public static async Task <Message> SendAudioAsync(this BotClient bot, SendAudioArgs 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.SendAudio, args, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
예제 #3
0
        public static Message SendAudio(this BotClient bot, SendAudioArgs args)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

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

            return(bot.RPCF <Message>(MethodNames.SendAudio, args));
        }
예제 #4
0
        public static Message SendAudio(this BotClient api, long chatId, InputFile audio, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] uint?duration, [Optional] string?performer, [Optional] string?title, [Optional] InputFile?thumb, [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 SendAudioArgs(chatId, audio)
            {
                Caption                  = caption,
                ParseMode                = parseMode,
                CaptionEntities          = captionEntities,
                Duration                 = duration,
                Performer                = performer,
                Title                    = title,
                Thumb                    = thumb,
                DisableNotification      = disableNotification,
                ProtectContent           = protectContent,
                ReplyToMessageId         = replyToMessageId,
                AllowSendingWithoutReply = allowSendingWithoutReply,
                ReplyMarkup              = replyMarkup
            };

            return(api.RPCF <Message>(MethodNames.SendAudio, args));
        }