You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
await using var container = new Container { Options = { DefaultScopedLifestyle = new AsyncScopedLifestyle() } };
container.AddSlackNet(c => c
// Configure the tokens used to authenticate with Slack
.UseApiToken(settings.ApiToken) // This gets used by the API client
.UseAppLevelToken(settings.AppLevelToken) // This gets used by the socket mode client
// Register your Slack handlers here
.RegisterEventHandler<MessageEvent, PingDemo>()
);
Console.WriteLine("Connecting...");
var client = container.SlackServices().GetSocketModeClient(); // .SlackServices() is a convenience method for resolving SlackNet services, but you can also resolve ISlackSocketModeClient directly
await client.Connect();
Console.WriteLine("Connected. Press any key to exit...");
await Task.Run(Console.ReadKey);
record AppSettings
{
public string ApiToken { get; init; } = string.Empty;
public string AppLevelToken { get; init; } = string.Empty;