-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathAppHome.cs
More file actions
36 lines (33 loc) · 1.44 KB
/
AppHome.cs
File metadata and controls
36 lines (33 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using SlackNet;
using SlackNet.Blocks;
using SlackNet.Events;
namespace SlackNetDemo;
/// <summary>
/// Displays a list of things you can do with this demo when you open the app's home screen.
/// </summary>
class AppHome(ISlackApiClient slack) : IEventHandler<AppHomeOpened>
{
public async Task Handle(AppHomeOpened slackEvent)
{
if (slackEvent.Tab == AppHomeTab.Home)
{
Console.WriteLine($"{(await slack.Users.Info(slackEvent.User)).Name} opened the app's home view");
await slack.Views.Publish(slackEvent.User, new HomeViewDefinition
{
Blocks =
{
new SectionBlock
{
Text = new Markdown($"""
Welcome to the SlackNet example. Here's what you can do:
• Say "{PingDemo.Trigger}" to get back a pong
• Say "{CounterDemo.Trigger}" to get the counter demo
• Say "{ModalViewDemo.Trigger}" to open then modal view demo
• Use the `{EchoDemo.SlashCommand}` slash command to see an echo
""")
}
}
}, slackEvent.View?.Hash);
}
}
}