Skip to content

Commit e0535b9

Browse files
authored
Merge pull request #27 from devanooga/hamalert
Add hamalert support
2 parents 2494a48 + 4ed080e commit e0535b9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace devanewbot.Api.v0.Controllers;
2+
3+
using System.Threading.Tasks;
4+
using Microsoft.AspNetCore.Mvc;
5+
using SlackDotNet;
6+
7+
[Route("/api/v0/hamalert")]
8+
public class HamAlertController : Controller
9+
{
10+
protected Slack Slack { get; }
11+
12+
public HamAlertController(Slack slack)
13+
{
14+
Slack = slack;
15+
}
16+
17+
18+
[HttpPost("{userId}")]
19+
public async Task<IActionResult> Alert(string userId, [FromQuery] string fullCallsign, [FromQuery] string callSign, string frequency, string band, string mode, string time)
20+
{
21+
await Slack.PostMessage(new SlackDotNet.Payloads.ChatMessage
22+
{
23+
User = userId,
24+
Text = $"HamAlert: {callSign} {frequency} {band} {mode} {time}"
25+
});
26+
27+
return Ok();
28+
}
29+
}

0 commit comments

Comments
 (0)