Exemple #1
0
        public async Task <ActionResult> AddChannel(string url)
        {
            if (!string.IsNullOrEmpty(url) &&
                (url.StartsWith(MongoConfig.webhook) || url.StartsWith(MongoConfig.webhookOld)) &&
                WebhookChecker.IsWebhook(url))
            {
                await _discordService.Add(new Channel()
                {
                    name  = _accessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
                    value = Regex.Replace(url.Replace(MongoConfig.webhook, MongoConfig.webhookOld), @"\s+", "")
                });

                return(StatusCode(201));
            }
            return(NotFound("wrong webhook url"));
        }