-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.cs
More file actions
executable file
·25 lines (19 loc) · 899 Bytes
/
Example.cs
File metadata and controls
executable file
·25 lines (19 loc) · 899 Bytes
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
#!/usr/bin/env dotnet
#:project ./Fluxify.Bot/Fluxify.Bot.csproj
#:package Microsoft.Extensions.Logging.Console@10.0.3
// This is a Single file app -> run with `dotnet run Example.cs`
// you need to provide the FLUXIFY_BOT_TOKEN variable with the bot token
using Fluxify.Bot;
using Fluxify.Commands;
using Fluxify.Commands.CommandCollection;
using Fluxify.Core;
using Microsoft.Extensions.Logging;
var loggerFactory = LoggerFactory.Create(b => b.AddConsole().SetMinimumLevel(LogLevel.Trace));
var config = new FluxerConfig(loggerFactory)
{
Credentials = new BotTokenCredentials(Environment.GetEnvironmentVariable("FLUXIFY_BOT_TOKEN")
?? throw new Exception("FLUXIFY_BOT_TOKEN environment variable is not set"))
};
var bot = new Bot("f!", config);
bot.Commands.Command("ping", (CommandContext ctx) => ctx.ReplyAsync("Pong!"));
await bot.RunAsync();