예제 #1
0
        public static async Task <Message> SendVoiceAsync(this BotClient bot, SendVoiceArgs 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.SendVoice, args, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
예제 #2
0
        public static Message SendVoice(this BotClient bot, SendVoiceArgs args)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

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

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

            return(api.RPCF <Message>(MethodNames.SendVoice, args));
        }
예제 #4
0
        public static async Task <Message> SendVoiceAsync(this BotClient api, string chatId, string voice, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] uint?duration, [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 SendVoiceArgs(chatId, voice)
            {
                Caption                  = caption,
                ParseMode                = parseMode,
                CaptionEntities          = captionEntities,
                Duration                 = duration,
                DisableNotification      = disableNotification,
                ProtectContent           = protectContent,
                ReplyToMessageId         = replyToMessageId,
                AllowSendingWithoutReply = allowSendingWithoutReply,
                ReplyMarkup              = replyMarkup
            };

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