Fixed DeviceInfo Generation for Lagrange.OneBot

This commit is contained in:
Linwenxuan 2023-10-14 23:10:06 +08:00
parent bfd93a84e0
commit 64a0c41add
1 changed files with 2 additions and 2 deletions

View File

@ -59,13 +59,13 @@ public sealed class LagrangeAppBuilder
BotDeviceInfo deviceInfo;
if (!File.Exists(deviceInfoPath))
{
deviceInfo = new BotDeviceInfo();
deviceInfo = BotDeviceInfo.GenerateInfo();
string json = JsonSerializer.Serialize(deviceInfo);
File.WriteAllText(deviceInfoPath, json);
}
else
{
deviceInfo = JsonSerializer.Deserialize<BotDeviceInfo>(File.ReadAllText(deviceInfoPath)) ?? new BotDeviceInfo();
deviceInfo = JsonSerializer.Deserialize<BotDeviceInfo>(File.ReadAllText(deviceInfoPath)) ?? BotDeviceInfo.GenerateInfo();
}
Services.AddSingleton(BotFactory.Create(config, deviceInfo, keystore));