@@ -175,7 +175,24 @@ impl ConfigLogic for File {
175
175
176
176
if let Ok ( o) = old {
177
177
info ! ( "Converting old NOALBS config into v2" ) ;
178
- Config :: from ( o)
178
+
179
+ if std:: fs:: File :: open ( ".env" ) . is_err ( ) {
180
+ info ! ( "Creating .env file" ) ;
181
+
182
+ let bot = o. twitch_chat . bot_username . to_lowercase ( ) ;
183
+ let oauth = o. twitch_chat . oauth . to_string ( ) ;
184
+ let env =
185
+ format ! ( "TWITCH_BOT_USERNAME={}\n TWITCH_BOT_OAUTH={}" , bot, oauth) ;
186
+ std:: fs:: write ( ".env" , env. as_bytes ( ) ) ?;
187
+
188
+ std:: env:: set_var ( "TWITCH_BOT_USERNAME" , bot) ;
189
+ std:: env:: set_var ( "TWITCH_BOT_OAUTH" , oauth) ;
190
+ }
191
+
192
+ let c = Config :: from ( o) ;
193
+ self . save ( & c) ?;
194
+
195
+ c
179
196
} else {
180
197
return Err ( error:: Error :: Json ( e) ) ;
181
198
}
@@ -268,6 +285,8 @@ struct RtmpOld {
268
285
#[ serde( rename_all = "camelCase" , default ) ]
269
286
struct TwitchChat {
270
287
channel : String ,
288
+ bot_username : String ,
289
+ oauth : String ,
271
290
enable : bool ,
272
291
prefix : String ,
273
292
enable_public_commands : bool ,
@@ -440,6 +459,8 @@ impl Default for TwitchChat {
440
459
fn default ( ) -> Self {
441
460
Self {
442
461
channel : "715209" . to_string ( ) ,
462
+ bot_username : "715209" . to_string ( ) ,
463
+ oauth : "oauth:YOUR_OAUTH_HERE" . to_string ( ) ,
443
464
enable : true ,
444
465
prefix : "!" . to_string ( ) ,
445
466
enable_public_commands : true ,
0 commit comments