This repository was archived by the owner on Oct 12, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 1+ using System . Text . Json ;
12using Lagrange . Core ;
23using Lagrange . Core . Common . Interface . Api ;
34using Lagrange . Core . Event . EventArg ;
@@ -57,6 +58,9 @@ public async Task StartAsync(CancellationToken token)
5758
5859 if ( ! isSucceed ) throw new Exception ( "All login failed!" ) ;
5960
61+ string keystoreJson = JsonSerializer . Serialize ( _lagrange . UpdateKeystore ( ) ) ;
62+ File . WriteAllText ( configuration [ "ConfigPath:Keystore" ] ?? "keystore.json" , keystoreJson ) ;
63+
6064 _logger . LogInformation ( "Bot Uin: {}" , _lagrange . BotUin ) ;
6165
6266 await _web . StartAsync ( token ) ;
Original file line number Diff line number Diff line change @@ -48,9 +48,14 @@ public static HostApplicationBuilder ConfigureLagrangeCore(this HostApplicationB
4848 var configuration = services . GetRequiredService < IConfiguration > ( ) ;
4949 string path = configuration [ "ConfigPath:DeviceInfo" ] ?? "device.json" ;
5050
51- return File . Exists ( path )
51+ var device = File . Exists ( path )
5252 ? JsonSerializer . Deserialize < BotDeviceInfo > ( File . ReadAllText ( path ) ) ?? BotDeviceInfo . GenerateInfo ( )
5353 : BotDeviceInfo . GenerateInfo ( ) ;
54+
55+ string deviceJson = JsonSerializer . Serialize ( device ) ;
56+ File . WriteAllText ( path , deviceJson ) ;
57+
58+ return device ;
5459 } )
5560 . AddSingleton ( ( services ) => // Keystore
5661 {
You can’t perform that action at this time.
0 commit comments