コード例 #1
0
        /// <summary>Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns True on success.</summary>
        /// <param name="bot">BotClient</param>
        /// <param name="args">Parameters.</param>
        /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
        /// <exception cref="BotRequestException">Thrown when a request to Telegram Bot API got an error response.</exception>
        /// <exception cref="ArgumentNullException">Thrown when a required parameter is null.</exception>
        /// <returns>True</returns>
        public static async Task <bool> SetStickerSetThumbAsync(this BotClient bot, SetStickerSetThumbArgs args, [Optional] CancellationToken cancellationToken)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

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

            if (args.UseMultipart())
            {
                return(await bot.RPCAF <bool>(MethodNames.SetStickerSetThumb, args, cancellationToken : cancellationToken).ConfigureAwait(false));
            }
            else
            {
                return(await bot.RPCA <bool>(MethodNames.SetStickerSetThumb, args, cancellationToken : cancellationToken).ConfigureAwait(false));
            }
        }
コード例 #2
0
        /// <summary>Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns True on success.</summary>
        /// <param name="bot">BotClient</param>
        /// <param name="args">Parameters.</param>
        /// <exception cref="BotRequestException">Thrown when a request to Telegram Bot API got an error response.</exception>
        /// <exception cref="ArgumentNullException">Thrown when a required parameter is null.</exception>
        /// <returns>True</returns>
        public static bool SetStickerSetThumb(this BotClient bot, SetStickerSetThumbArgs args)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

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

            if (args.UseMultipart())
            {
                return(bot.RPCF <bool>(MethodNames.SetStickerSetThumb, args));
            }
            else
            {
                return(bot.RPC <bool>(MethodNames.SetStickerSetThumb, args));
            }
        }