示例#1
0
        public static async Task <bool> SetWebhookAsync(this BotClient bot, SetWebhookArgs args, [Optional] CancellationToken cancellationToken)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

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

            return(await bot.RPCAF <bool>(MethodNames.SetWebhook, args, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
示例#2
0
        public static bool SetWebhook(this BotClient bot, SetWebhookArgs args)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

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

            return(bot.RPCF <bool>(MethodNames.SetWebhook, args));
        }
示例#3
0
        public static bool SetWebhook(this BotClient api, string url, [Optional] InputFile?certificate, [Optional] string?ipAddress, [Optional] uint?maxConnections, [Optional] IEnumerable <string>?allowedUpdates, [Optional] bool?dropPendingUpdates, [Optional] string?secretToken)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            var args = new SetWebhookArgs(url)
            {
                Certificate        = certificate,
                IpAddress          = ipAddress,
                MaxConnections     = maxConnections,
                AllowedUpdates     = allowedUpdates,
                DropPendingUpdates = dropPendingUpdates,
                SecretToken        = secretToken
            };

            return(api.RPCF <bool>(MethodNames.SetWebhook, args));
        }