This repository was archived by the owner on Dec 18, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,9 @@ const bots = new Map();
1111// 获取机器人目录
1212function getBotDir ( ) {
1313 const bot_bir = new Map ( ) ;
14- for ( let file_name of fs_1 . readdirSync ( './config/bots' ) ) {
15- const bot_id = file_name . split ( '.' ) [ 0 ] ;
14+ const files = fs_1 . readdirSync ( './config/bots' ) . filter ( file_name => / \. y m l $ / . test ( file_name ) ) ;
15+ for ( let file_name of files ) {
16+ const bot_id = file_name . slice ( 0 , file_name . length - 4 ) ;
1617 bot_bir . set ( bot_id , util_1 . getProfileSync ( bot_id , './config/bots' ) ) ;
1718 }
1819 return bot_bir ;
Original file line number Diff line number Diff line change @@ -12,9 +12,10 @@ const bots: Map<number, Client> = new Map();
1212// 获取机器人目录
1313function getBotDir ( ) : Map < string , IBot > {
1414 const bot_bir : Map < string , IBot > = new Map ( ) ;
15+ const files : string [ ] = readdirSync ( './config/bots' ) . filter ( file_name => / \. y m l $ / . test ( file_name ) )
1516
16- for ( let file_name of readdirSync ( './config/bots' ) ) {
17- const bot_id : string = file_name . split ( '.' ) [ 0 ] ;
17+ for ( let file_name of files ) {
18+ const bot_id : string = file_name . slice ( 0 , file_name . length - 4 ) ;
1819
1920 bot_bir . set ( bot_id , getProfileSync ( bot_id , './config/bots' ) as IBot ) ;
2021 }
You can’t perform that action at this time.
0 commit comments