-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProgram.cs
More file actions
28 lines (19 loc) · 828 Bytes
/
Program.cs
File metadata and controls
28 lines (19 loc) · 828 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
26
27
28
using Satori.Client;
using Satori.Protocol.Elements;
Console.Write("Input Token: ");
var token = Console.ReadLine()?.Trim() ?? "";
Console.Write("Input Platform: ");
var platform = Console.ReadLine()?.Trim() ?? "";
Console.Write("Input SelfId: ");
var selfId = Console.ReadLine()?.Trim() ?? "";
using var client = new SatoriClient("http://localhost:5500", token);
client.Logging += (_, log) => { Console.WriteLine($"[{log.LogTime}] [{log.LogLevel}] {log.Message}"); };
var bot = client.Bot(platform, selfId);
await client.StartAsync();
bot.MessageCreated += async (_, e) =>
{
Console.WriteLine($"Received message from {e.Channel!.Id}: {e.Message!.Content}");
await bot.CreateMessageAsync(e.Channel.Id,
new TextElement { Text = "非常好 Satori,爱来自 Satori.Client" });
};
await Task.Delay(-1);