コード例 #1
0
 public static Message EditMessageCaption(this BotClient bot, EditMessageCaptionArgs args)
 {
     if (bot == default)
     {
         throw new ArgumentNullException(nameof(bot));
     }
     if (args == default)
     {
         throw new ArgumentNullException(nameof(args));
     }
     return(bot.RPC <Message>(MethodNames.EditMessageCaption, args));
 }
コード例 #2
0
 public static async Task <T> EditMessageCaptionAsync <T>(this BotClient bot, EditMessageCaptionArgs args, [Optional] CancellationToken cancellationToken)
 {
     if (bot == default)
     {
         throw new ArgumentNullException(nameof(bot));
     }
     if (args == default)
     {
         throw new ArgumentNullException(nameof(args));
     }
     if (typeof(T) != typeof(Message) && typeof(T) != typeof(bool))
     {
         throw new ArgumentException($"{nameof(T)} must be Telegram.BotAPI.AvailableTypes.Message or bool.");
     }
     return(await bot.RPCA <T>(MethodNames.EditMessageCaption, args, cancellationToken).ConfigureAwait(false));
 }
コード例 #3
0
 public static T EditMessageCaption <T>(this BotClient bot, EditMessageCaptionArgs args)
 {
     if (bot == default)
     {
         throw new ArgumentNullException(nameof(bot));
     }
     if (args == default)
     {
         throw new ArgumentNullException(nameof(args));
     }
     if (typeof(T) != typeof(Message) && typeof(T) != typeof(bool))
     {
         throw new ArgumentException($"{nameof(T)} must be Telegram.BotAPI.AvailableTypes.Message or bool.");
     }
     return(bot.RPC <T>(MethodNames.EditMessageCaption, args));
 }
コード例 #4
0
        public static async Task <Message> EditMessageCaptionAsync(this BotClient api, string inlineMessageId, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] InlineKeyboardMarkup?replyMarkup, [Optional] CancellationToken cancellationToken)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            var args = new EditMessageCaptionArgs(inlineMessageId)
            {
                Caption         = caption,
                ParseMode       = parseMode,
                CaptionEntities = captionEntities,
                ReplyMarkup     = replyMarkup
            };

            return(await api.RPCA <Message>(MethodNames.EditMessageCaption, args, cancellationToken).ConfigureAwait(false));
        }
コード例 #5
0
        public static Message EditMessageCaption(this BotClient api, string inlineMessageId, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] InlineKeyboardMarkup?replyMarkup)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            var args = new EditMessageCaptionArgs(inlineMessageId)
            {
                Caption         = caption,
                ParseMode       = parseMode,
                CaptionEntities = captionEntities,
                ReplyMarkup     = replyMarkup
            };

            return(api.RPC <Message>(MethodNames.EditMessageCaption, args));
        }
コード例 #6
0
        public static async Task <T> EditMessageCaptionAsync <T>(this BotClient api, string inlineMessageId, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] InlineKeyboardMarkup?replyMarkup, [Optional] CancellationToken cancellationToken)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            if (typeof(T) != typeof(Message) && typeof(T) != typeof(bool))
            {
                throw new ArgumentException($"{nameof(T)} must be Telegram.BotAPI.AvailableTypes.Message or bool.");
            }
            var args = new EditMessageCaptionArgs(inlineMessageId)
            {
                Caption         = caption,
                ParseMode       = parseMode,
                CaptionEntities = captionEntities,
                ReplyMarkup     = replyMarkup
            };

            return(await api.RPCA <T>(MethodNames.EditMessageCaption, args, cancellationToken).ConfigureAwait(false));
        }
コード例 #7
0
        public static T EditMessageCaption <T>(this BotClient api, string chatId, int messageId, [Optional] string?caption, [Optional] string?parseMode, [Optional] IEnumerable <MessageEntity>?captionEntities, [Optional] InlineKeyboardMarkup?replyMarkup)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            if (typeof(T) != typeof(Message) && typeof(T) != typeof(bool))
            {
                throw new ArgumentException($"{nameof(T)} must be Telegram.BotAPI.AvailableTypes.Message or bool.");
            }
            var args = new EditMessageCaptionArgs(chatId, messageId)
            {
                Caption         = caption,
                ParseMode       = parseMode,
                CaptionEntities = captionEntities,
                ReplyMarkup     = replyMarkup
            };

            return(api.RPC <T>(MethodNames.EditMessageCaption, args));
        }
コード例 #8
0
 public static async Task <Message> EditMessageCaptionAsync(this BotClient bot, EditMessageCaptionArgs args, [Optional] CancellationToken cancellationToken)
 {
     if (bot == default)
     {
         throw new ArgumentNullException(nameof(bot));
     }
     if (args == default)
     {
         throw new ArgumentNullException(nameof(args));
     }
     return(await bot.RPCA <Message>(MethodNames.EditMessageCaption, args, cancellationToken).ConfigureAwait(false));
 }