1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.Text.Json;
- using Microsoft.AspNetCore.Http;
- using SlackAPI;
- using sera_slackbot.Library;
- namespace sera_slackbot.Commands
- {
- public class UnhelpfulBotCommand : IBotCommand
- {
- private string channelId;
- private string userId;
- private string message;
- public UnhelpfulBotCommand()
- {
- }
- public void ExtractValidData(JsonElement slackEvent)
- {
- this.channelId = slackEvent.GetProperty("channel").ToString();
- this.userId = slackEvent.GetProperty("user").ToString();
- }
- public bool WillTrigger(JsonElement slackEvent)
- {
- return true;
- }
- public dynamic Run(SlackClient client)
- {
- message = $"I'm sorry, \u003C@{userId}\u003E, I don't understand.";
- client.PostMessage(response => { }, channelId, message);
- return new
- {
- code = StatusCodes.Status200OK,
- body = ""
- };
- }
- }
- }
|