Skip to content

Commit

Permalink
fix #14
Browse files Browse the repository at this point in the history
  • Loading branch information
YDKK committed Sep 8, 2024
1 parent e882712 commit 430e419
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions SlackLineBridge/Controllers/WebhookController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private async Task<IActionResult> PushToLine(string host, SlackChannel slackChan
}

//URLタグを抽出
var urls = UrlRegex().Matches(text);
text = UrlRegex().Replace(text, "${url}");

var client = clientFactory.CreateClient("Line");
foreach (var bridge in bridges)
Expand All @@ -178,19 +178,14 @@ private async Task<IActionResult> PushToLine(string host, SlackChannel slackChan
iconUrl = $"https://{host}/proxy/slack/{Crypt.GetHMACHex(userIconUrl, _slackSigningSecret)}/{HttpUtility.UrlEncode(userIconUrl)}"
},
};
var urlMessages = urls.Select(x => x.Groups["url"].Value).Select(x => new
{
type = "text",
text = x
});

var json = new
{
to = lineChannel.Id,
messages = new dynamic[]
{
message
}.Concat(urlMessages).ToArray()
}.ToArray()
};
var jsonStr = JsonSerializer.Serialize(json);
logger.LogInformation("Push message to LINE: {jsonStr}", jsonStr);
Expand Down

0 comments on commit 430e419

Please sign in to comment.