@lf_maple/koishi-plugin-phi-plugin-full 0.1.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/core/.github/ISSUE_TEMPLATE/bug.yaml +133 -0
- package/core/.github/ISSUE_TEMPLATE/config.yml +1 -0
- package/core/.github/ISSUE_TEMPLATE/enhancement.yml +44 -0
- package/core/.vscode/c_cpp_properties.json +18 -0
- package/core/.vscode/launch.json +24 -0
- package/core/.vscode/settings.json +59 -0
- package/core/CHANGELOG.md +184 -0
- package/core/LICENSE +674 -0
- package/core/README.md +330 -0
- package/core/README_en.md +285 -0
- package/core/apps/Dan.js +129 -0
- package/core/apps/RankList.js +322 -0
- package/core/apps/aliasProposal.js +223 -0
- package/core/apps/apiSetting.js +592 -0
- package/core/apps/b19.js +1329 -0
- package/core/apps/botClient.js +64 -0
- package/core/apps/chart.js +692 -0
- package/core/apps/guessGame/guessIll.js +821 -0
- package/core/apps/guessGame/guessLetter.js +831 -0
- package/core/apps/guessGame/guessTips.js +254 -0
- package/core/apps/guessGame/letterGameUtils.js +74 -0
- package/core/apps/guessGame.js +214 -0
- package/core/apps/help.js +117 -0
- package/core/apps/manage.js +288 -0
- package/core/apps/market.js +243 -0
- package/core/apps/money.js +1064 -0
- package/core/apps/phisong.js +1418 -0
- package/core/apps/session.js +664 -0
- package/core/apps/setting.js +468 -0
- package/core/apps/update.js +541 -0
- package/core/apps/user.js +968 -0
- package/core/components/Config.js +249 -0
- package/core/components/Data.js +304 -0
- package/core/components/FileWatcherRegistry.js +102 -0
- package/core/components/Logger.js +11 -0
- package/core/components/ProcessCleanup.js +113 -0
- package/core/components/Version.js +56 -0
- package/core/components/YamlReader.js +157 -0
- package/core/components/baseClass.js +287 -0
- package/core/components/common.js +47 -0
- package/core/components/index.js +13 -0
- package/core/components/platform/index.js +79 -0
- package/core/components/platform/koishi.js +800 -0
- package/core/components/platform/koishiDatabaseRedis.js +391 -0
- package/core/components/platform/memoryRedis.js +209 -0
- package/core/components/platform/types.d.ts +272 -0
- package/core/components/platform/yunzai.js +604 -0
- package/core/components/segment.js +4 -0
- package/core/config/config//350/277/231/351/207/214/346/230/257/351/205/215/347/275/256/346/226/207/344/273/266/347/233/256/345/275/225.txt +0 -0
- package/core/config/default_config/banGroup.yaml +14 -0
- package/core/config/default_config/config.yaml +159 -0
- package/core/config/default_config/nickconfig.yaml +6 -0
- package/core/config/default_config/otherinfo.yaml +51 -0
- package/core/guoba.support.js +597 -0
- package/core/index.js +85 -0
- package/core/lib/AES.js +40 -0
- package/core/lib/Base64.js +22 -0
- package/core/lib/ByteReader.js +168 -0
- package/core/lib/GameProgress.js +37 -0
- package/core/lib/GameRecord.js +47 -0
- package/core/lib/GameSettings.js +24 -0
- package/core/lib/GameUser.js +19 -0
- package/core/lib/Level.js +6 -0
- package/core/lib/LevelRecord.js +9 -0
- package/core/lib/PhigrosUser.js +135 -0
- package/core/lib/SaveManager.js +117 -0
- package/core/lib/Summary.js +47 -0
- package/core/lib/TapTap/CompleteQRCodeData.js +27 -0
- package/core/lib/TapTap/LCHelper.js +81 -0
- package/core/lib/TapTap/TapTapHelper.js +170 -0
- package/core/lib/TapTap/getQRcode.js +61 -0
- package/core/lib/Util.js +30 -0
- package/core/lib/getQRcode.js +73 -0
- package/core/lib/http.js +105 -0
- package/core/model/README.md +3 -0
- package/core/model/api/aliasProposalService.js +151 -0
- package/core/model/api/apiVersion.js +67 -0
- package/core/model/api/autoSeekApi.js +165 -0
- package/core/model/api/botApiAuth.js +208 -0
- package/core/model/api/botSyncService.js +78 -0
- package/core/model/api/gameRecordPayload.js +24 -0
- package/core/model/api/makeRequest.js +1004 -0
- package/core/model/api/makeRequestFnc.js +17 -0
- package/core/model/api/phiApiClient.js +53 -0
- package/core/model/api/phiApiErrors.js +121 -0
- package/core/model/filesystem/getFile.js +256 -0
- package/core/model/filesystem/path.js +84 -0
- package/core/model/game/Chart.js +57 -0
- package/core/model/game/LevelRecordInfo.js +109 -0
- package/core/model/game/SongsInfo.js +46 -0
- package/core/model/game/b30Analysis.js +93 -0
- package/core/model/game/chartParser/Chart.js +23 -0
- package/core/model/game/chartParser/JudgeLine.js +38 -0
- package/core/model/game/chartParser/base/JudgeLineEvent.js +99 -0
- package/core/model/game/chartParser/base/Note.js +44 -0
- package/core/model/game/chartParser/base/SpeedEvent.js +25 -0
- package/core/model/game/chartParser/base/baseType.js +2 -0
- package/core/model/game/constNum.js +215 -0
- package/core/model/game/fCompute.js +711 -0
- package/core/model/game/getChartTag.js +140 -0
- package/core/model/game/getComment.js +132 -0
- package/core/model/game/getInfo.js +1069 -0
- package/core/model/game/getRksRank.js +77 -0
- package/core/model/game/markdown.js +77 -0
- package/core/model/integrations/Vika.js +103 -0
- package/core/model/integrations/getInfoFromTap.js +80 -0
- package/core/model/render/getPic.js +79 -0
- package/core/model/render/picmodle.js +496 -0
- package/core/model/render/progress-bar.js +44 -0
- package/core/model/render/puppeteer.js +431 -0
- package/core/model/render/renderPressureHistory.js +71 -0
- package/core/model/render/send.js +94 -0
- package/core/model/save/Save.js +953 -0
- package/core/model/save/analyzeSaveHistory.js +413 -0
- package/core/model/save/getBackup.js +328 -0
- package/core/model/save/getSave.js +90 -0
- package/core/model/save/getSaveFromApi.js +46 -0
- package/core/model/save/saveHistory.js +586 -0
- package/core/model/save/scoreHistory.js +101 -0
- package/core/model/theme/catalog.js +192 -0
- package/core/model/theme/installGuard.js +275 -0
- package/core/model/theme/installLock.js +174 -0
- package/core/model/theme/installer.js +398 -0
- package/core/model/theme/manager.js +408 -0
- package/core/model/theme/marketClient.js +294 -0
- package/core/model/theme/paths.js +42 -0
- package/core/model/theme/policy.js +54 -0
- package/core/model/theme/recovery.js +167 -0
- package/core/model/theme/useService.js +187 -0
- package/core/model/type/aliasProposal.d.ts +45 -0
- package/core/model/type/type.js +420 -0
- package/core/model/user/apiPermission.js +62 -0
- package/core/model/user/getBanGroup.js +120 -0
- package/core/model/user/getNotes.js +48 -0
- package/core/model/user/pluginData.js +101 -0
- package/core/model/user/userCredentialStore.js +154 -0
- package/core/model/user/userCredentials.js +860 -0
- package/core/package.json +60 -0
- package/core/resources/0608badSave/save.json +1 -0
- package/core/resources/LICENSE +201 -0
- package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.art +220 -0
- package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.css +345 -0
- package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.html +434 -0
- package/core/resources/html/arcgrosB19/arcgros.png +0 -0
- package/core/resources/html/arcgrosB19/arcgrosB19-orz.html +276 -0
- package/core/resources/html/arcgrosB19/arcgrosB19.art +168 -0
- package/core/resources/html/arcgrosB19/arcgrosB19.css +637 -0
- package/core/resources/html/atlas/atlas-orz.html +313 -0
- package/core/resources/html/atlas/atlas.art +194 -0
- package/core/resources/html/atlas/atlas.css +695 -0
- package/core/resources/html/avatar/-SURREALISM-.png +0 -0
- package/core/resources/html/avatar/Alkaid.png +0 -0
- package/core/resources/html/avatar/Aphasia.png +0 -0
- package/core/resources/html/avatar/Artificial Existence.png +0 -0
- package/core/resources/html/avatar/Bonus Time.png +0 -0
- package/core/resources/html/avatar/Burn.png +0 -0
- package/core/resources/html/avatar/Cereris1.png +0 -0
- package/core/resources/html/avatar/Cereris2.png +0 -0
- package/core/resources/html/avatar/Cereris3.png +0 -0
- package/core/resources/html/avatar/Christmas -2019.png +0 -0
- package/core/resources/html/avatar/Cipher1.png +0 -0
- package/core/resources/html/avatar/Class Memories.png +0 -0
- package/core/resources/html/avatar/Credits.png +0 -0
- package/core/resources/html/avatar/Dash.png +0 -0
- package/core/resources/html/avatar/Dlyrotz.png +0 -0
- package/core/resources/html/avatar/Doppelganger1.png +0 -0
- package/core/resources/html/avatar/Doppelganger2.png +0 -0
- package/core/resources/html/avatar/Drop it.png +0 -0
- package/core/resources/html/avatar/Energy Synergy Matrix1.png +0 -0
- package/core/resources/html/avatar/Energy Synergy Matrix2.png +0 -0
- package/core/resources/html/avatar/Energy Synergy Matrix3.png +0 -0
- package/core/resources/html/avatar/Engine x Start!! (melody mix).png +0 -0
- package/core/resources/html/avatar/Engine x Start!! extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/Eradication Catastrophe.png +0 -0
- package/core/resources/html/avatar/FULi AUTO SHOOTER extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/FULi AUTO SHOOTER.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/264-Special1.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/264-Special2.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2641.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2642.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2643.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2644.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2645.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2646.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2647.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2648.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2649.png +0 -0
- package/core/resources/html/avatar/Find_Me.png +0 -0
- package/core/resources/html/avatar/Geopelia 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/Geopelia 2 -by cycats.png +0 -0
- package/core/resources/html/avatar/Geopelia 3 -by /344/275/225/345/221/265.png +0 -0
- package/core/resources/html/avatar/Geopelia in WEPLAY -by /346/265/267/344/272/247.png +0 -0
- package/core/resources/html/avatar/Gino-AprilFool.png +0 -0
- package/core/resources/html/avatar/Glaciaxion.png +0 -0
- package/core/resources/html/avatar/HumaN.png +0 -0
- package/core/resources/html/avatar/Indelible Scar.png +0 -0
- package/core/resources/html/avatar/Introduction.png +0 -0
- package/core/resources/html/avatar/Khronostasis Katharsis.png +0 -0
- package/core/resources/html/avatar/MARENOL.png +0 -0
- package/core/resources/html/avatar/Marenol extra 1 -by /345/226/265n/350/221/265.png +0 -0
- package/core/resources/html/avatar/Non-Melodic Ragez (MUG Edit).png +0 -0
- package/core/resources/html/avatar/Non-Melodic Ragez extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/Oblivion +0 -0
- package/core/resources/html/avatar/OblivionPHIN.png +0 -0
- package/core/resources/html/avatar/Para.png +0 -0
- package/core/resources/html/avatar/Pixel Rebelz1.png +0 -0
- package/core/resources/html/avatar/Pixel Rebelz2.png +0 -0
- package/core/resources/html/avatar/Pixel Rebelz3.png +0 -0
- package/core/resources/html/avatar/RIPPER extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/RIPPER extra 2 -by /344/275/225/345/221/265.png +0 -0
- package/core/resources/html/avatar/Sein.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-Special.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-Special2.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-/346/231/256/351/200/232.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-/346/233/262/347/273/230Ver.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240-Special.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240-/346/231/256/351/200/232.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240-/346/233/262/347/273/230Ver.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240/345/222/214/346/260/264/351/235/222-Special.png +0 -0
- package/core/resources/html/avatar/Snow Desert.png +0 -0
- package/core/resources/html/avatar/Sparkle New Life.png +0 -0
- package/core/resources/html/avatar/Sultan Rage.png +0 -0
- package/core/resources/html/avatar/Winter /342/206/221cube/342/206/223.png +0 -0
- package/core/resources/html/avatar/Xenolith.png +0 -0
- package/core/resources/html/avatar/[PRAW].png +0 -0
- package/core/resources/html/avatar/dB doll.png +0 -0
- package/core/resources/html/avatar/ripper.png +0 -0
- package/core/resources/html/avatar//343/202/202/343/201/272/343/202/202/343/201/2721.png +0 -0
- package/core/resources/html/avatar//343/202/202/343/201/272/343/202/202/343/201/2722.png +0 -0
- package/core/resources/html/avatar//344/270/207/345/220/250/345/214/277/345/220/215/344/277/241.png +0 -0
- package/core/resources/html/avatar//344/272/221/345/245/263/345/255/251 extra 1 -by /345/276/241/345/235/202/346/236/234/345/255/220.png +0 -0
- package/core/resources/html/avatar//344/272/221/345/245/263/345/255/251.png +0 -0
- package/core/resources/html/avatar//345/205/211.png +0 -0
- package/core/resources/html/avatar//345/274/200/345/277/203/347/227/2051.png +0 -0
- package/core/resources/html/avatar//345/274/200/345/277/203/347/227/2052.png +0 -0
- package/core/resources/html/avatar//346/260/264/351/235/222-/344/270/200/345/221/250/345/271/264/347/233/270/350/201/232.png +0 -0
- package/core/resources/html/avatar//346/267/267/344/271/261-Confusion.png +0 -0
- package/core/resources/html/avatar//347/213/202/345/226/234/350/230/255/350/210/2361.png +0 -0
- package/core/resources/html/avatar//347/213/202/345/226/234/350/230/255/350/210/2362.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/201-Special.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2011.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2012.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2013.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2014.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2015.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2016.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2017.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/227-Special.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/2271.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/2272.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/2273.png +0 -0
- package/core/resources/html/avatar//350/217/257/347/201/257/347/210/2611.png +0 -0
- package/core/resources/html/avatar//350/217/257/347/201/257/347/210/2612.png +0 -0
- package/core/resources/html/avatar//350/220/244/347/201/253/350/231/253/343/201/256/346/200/2501.png +0 -0
- package/core/resources/html/avatar//350/220/244/347/201/253/350/231/253/343/201/256/346/200/2502.png +0 -0
- package/core/resources/html/avatar//351/235/222/350/212/275-Special.png +0 -0
- package/core/resources/html/avatar//351/235/222/350/212/275.png +0 -0
- package/core/resources/html/avatar//351/243/216/345/261/277.png +0 -0
- package/core/resources/html/avatar//351/270/240-AprilFool.png +0 -0
- package/core/resources/html/avatar//351/270/240-/344/270/200/345/221/250/345/271/264/347/233/270/350/201/232.png +0 -0
- package/core/resources/html/b19/b19.art +490 -0
- package/core/resources/html/b19/b19.css +1261 -0
- package/core/resources/html/b19/b19666.art +350 -0
- package/core/resources/html/b19/b19666.css +1409 -0
- package/core/resources/html/b19/b19666.html +481 -0
- package/core/resources/html/b19/b19title.css +120 -0
- package/core/resources/html/b19/best19.html +853 -0
- package/core/resources/html/b19/dss2-orz.html +428 -0
- package/core/resources/html/b19/dss2.art +298 -0
- package/core/resources/html/b19/dss2.css +776 -0
- package/core/resources/html/b19/res/666.jpeg +0 -0
- package/core/resources/html/chap/chap-orz.html +93 -0
- package/core/resources/html/chap/chap.art +87 -0
- package/core/resources/html/chap/chap.css +365 -0
- package/core/resources/html/chartImg/chartImg.art +169 -0
- package/core/resources/html/chartImg/chartImg.css +439 -0
- package/core/resources/html/chartImg/echarts-wordcloud.min.js +3 -0
- package/core/resources/html/chartImg/echarts.js +85796 -0
- package/core/resources/html/chartImg/img/Drag.png +0 -0
- package/core/resources/html/chartImg/img/DragHL.png +0 -0
- package/core/resources/html/chartImg/img/Flick.png +0 -0
- package/core/resources/html/chartImg/img/FlickHL.png +0 -0
- package/core/resources/html/chartImg/img/Hold.png +0 -0
- package/core/resources/html/chartImg/img/HoldHL.png +0 -0
- package/core/resources/html/chartImg/img/Hold_End.png +0 -0
- package/core/resources/html/chartImg/img/Hold_Head.png +0 -0
- package/core/resources/html/chartImg/img/Hold_HeadHL.png +0 -0
- package/core/resources/html/chartImg/img/Tap.png +0 -0
- package/core/resources/html/chartImg/img/TapHL.png +0 -0
- package/core/resources/html/chartInfo/chartInfo-orz.html +250 -0
- package/core/resources/html/chartInfo/chartInfo.art +222 -0
- package/core/resources/html/chartInfo/chartInfo.css +265 -0
- package/core/resources/html/chartInfo/echarts-wordcloud.min.js +3 -0
- package/core/resources/html/chartInfo/echarts.js +85796 -0
- package/core/resources/html/clg/clg-orz.html +218 -0
- package/core/resources/html/clg/clg.art +88 -0
- package/core/resources/html/clg/clg.css +230 -0
- package/core/resources/html/clg/demo.jpg +0 -0
- package/core/resources/html/common/common.css +319 -0
- package/core/resources/html/common/css/playerInfo.css +136 -0
- package/core/resources/html/common/font/Aldrich-Regular.ttf +0 -0
- package/core/resources/html/common/font/HIMALAYA.TTF +0 -0
- package/core/resources/html/common/font/NotoColorEmoji-Regular.ttf +0 -0
- package/core/resources/html/common/font/NotoSans-Regular.ttf +0 -0
- package/core/resources/html/common/font/NotoSansArabic.ttf +0 -0
- package/core/resources/html/common/font/NotoSansCanadianAboriginal.ttf +0 -0
- package/core/resources/html/common/font/NotoSansJP.ttf +0 -0
- package/core/resources/html/common/font/NotoSansKannada.ttf +0 -0
- package/core/resources/html/common/font/NotoSansMath-Regular.ttf +0 -0
- package/core/resources/html/common/font/NotoSansSymbols2.ttf +0 -0
- package/core/resources/html/common/font/phi.ttf +0 -0
- package/core/resources/html/common/font//345/220/236/345/274/245/346/201/260/344/277/212.ttf +0 -0
- package/core/resources/html/common/layout/default.art +324 -0
- package/core/resources/html/common/layout/elem.art +21 -0
- package/core/resources/html/common/theme/snow/snow.css +17 -0
- package/core/resources/html/common/theme/snow/snow.js +19 -0
- package/core/resources/html/common/theme/star/star.js +201 -0
- package/core/resources/html/common/theme/topText/topText.css +15 -0
- package/core/resources/html/common/theme/topText/topText.js +30 -0
- package/core/resources/html/difficultyHistory/difficultyHistory-orz.html +361 -0
- package/core/resources/html/difficultyHistory/difficultyHistory.art +102 -0
- package/core/resources/html/difficultyHistory/difficultyHistory.css +205 -0
- package/core/resources/html/guess/guess-orz.html +50 -0
- package/core/resources/html/guess/guess.art +51 -0
- package/core/resources/html/guess/guess.css +33 -0
- package/core/resources/html/help/help-orz.html +73 -0
- package/core/resources/html/help/help.art +84 -0
- package/core/resources/html/help/help.css +266 -0
- package/core/resources/html/historyB30/historyB30-orz.html +168 -0
- package/core/resources/html/historyB30/historyB30.art +143 -0
- package/core/resources/html/historyB30/historyB30.css +270 -0
- package/core/resources/html/ill/ill-orz.html +21 -0
- package/core/resources/html/ill/ill.art +23 -0
- package/core/resources/html/ill/ill.css +79 -0
- package/core/resources/html/jrrp/ShineAfter.removebg.png +0 -0
- package/core/resources/html/jrrp/jrrp-orz.html +68 -0
- package/core/resources/html/jrrp/jrrp.art +58 -0
- package/core/resources/html/jrrp/jrrp.css +251 -0
- package/core/resources/html/list/list-orz.html +35 -0
- package/core/resources/html/list/list.art +67 -0
- package/core/resources/html/list/list.css +259 -0
- package/core/resources/html/lvsco/demo.jpg +0 -0
- package/core/resources/html/lvsco/lvsco-orz.html +334 -0
- package/core/resources/html/lvsco/lvsco.art +314 -0
- package/core/resources/html/lvsco/lvsco.css +706 -0
- package/core/resources/html/market/detail.art +44 -0
- package/core/resources/html/market/market.art +86 -0
- package/core/resources/html/market/market.css +64 -0
- package/core/resources/html/newSong/newSong.art +34 -0
- package/core/resources/html/newSong/newSong.css +48 -0
- package/core/resources/html/newSong/newSong.html +23 -0
- package/core/resources/html/newnotice/newnotice.art +47 -0
- package/core/resources/html/newnotice/newnotice.css +83 -0
- package/core/resources/html/otherimg/0.png +0 -0
- package/core/resources/html/otherimg/1.png +0 -0
- package/core/resources/html/otherimg/2.png +0 -0
- package/core/resources/html/otherimg/3.png +0 -0
- package/core/resources/html/otherimg/4.png +0 -0
- package/core/resources/html/otherimg/5.png +0 -0
- package/core/resources/html/otherimg/A.png +0 -0
- package/core/resources/html/otherimg/B.png +0 -0
- package/core/resources/html/otherimg/C.png +0 -0
- package/core/resources/html/otherimg/F.png +0 -0
- package/core/resources/html/otherimg/FC.png +0 -0
- package/core/resources/html/otherimg/NEW.png +0 -0
- package/core/resources/html/otherimg/Phigros_Icon_3.0.0.png +0 -0
- package/core/resources/html/otherimg/S.png +0 -0
- package/core/resources/html/otherimg/Star1.png +0 -0
- package/core/resources/html/otherimg/Star2.png +0 -0
- package/core/resources/html/otherimg/V.png +0 -0
- package/core/resources/html/otherimg/callback.png +0 -0
- package/core/resources/html/otherimg/chapHelp.png +0 -0
- package/core/resources/html/otherimg/dan_code.png +0 -0
- package/core/resources/html/otherimg/data.png +0 -0
- package/core/resources/html/otherimg/helpDoc.png +0 -0
- package/core/resources/html/otherimg/nickSuggest.png +0 -0
- package/core/resources/html/otherimg/phi.png +0 -0
- package/core/resources/html/otherimg/phigros.png +0 -0
- package/core/resources/html/otherimg/snow1.png +0 -0
- package/core/resources/html/otherimg/snow2.png +0 -0
- package/core/resources/html/otherimg/snow3.png +0 -0
- package/core/resources/html/otherimg/snow4.png +0 -0
- package/core/resources/html/otherimg/title.png +0 -0
- package/core/resources/html/rand/rand-orz.html +62 -0
- package/core/resources/html/rand/rand.art +59 -0
- package/core/resources/html/rand/rand.css +257 -0
- package/core/resources/html/rankingList/rankingList-orz.html +456 -0
- package/core/resources/html/rankingList/rankingList.art +171 -0
- package/core/resources/html/rankingList/rankingList.css +570 -0
- package/core/resources/html/rankingList-old/rankingList-orz.html +300 -0
- package/core/resources/html/rankingList-old/rankingList.art +89 -0
- package/core/resources/html/rankingList-old/rankingList.css +265 -0
- package/core/resources/html/score/score-orz.html +625 -0
- package/core/resources/html/score/score.art +249 -0
- package/core/resources/html/score/score.css +435 -0
- package/core/resources/html/score/scoreOld-orz.html +128 -0
- package/core/resources/html/score/scoreOld.art +230 -0
- package/core/resources/html/score/scoreOld.css +475 -0
- package/core/resources/html/score/scoreRankList-orz.html +613 -0
- package/core/resources/html/score/scoreRankList.art +231 -0
- package/core/resources/html/score/scoreRankList.css +197 -0
- package/core/resources/html/setting/setting-orz.html +123 -0
- package/core/resources/html/setting/setting.art +72 -0
- package/core/resources/html/setting/setting.css +170 -0
- package/core/resources/html/setting/userSetting-orz.html +132 -0
- package/core/resources/html/setting/userSetting.art +48 -0
- package/core/resources/html/setting/userSetting.css +160 -0
- package/core/resources/html/sign/sign-orz.html +262 -0
- package/core/resources/html/sign/sign.art +163 -0
- package/core/resources/html/sign/sign.css +706 -0
- package/core/resources/html/suggest/suggest.art +271 -0
- package/core/resources/html/suggest/suggest.css +300 -0
- package/core/resources/html/table/table-orz.html +228 -0
- package/core/resources/html/table/table.art +163 -0
- package/core/resources/html/table/table.css +401 -0
- package/core/resources/html/tasks/tasks-orz.html +83 -0
- package/core/resources/html/tasks/tasks.art +118 -0
- package/core/resources/html/tasks/tasks.css +334 -0
- package/core/resources/html/update/update-orz.html +735 -0
- package/core/resources/html/update/update.art +259 -0
- package/core/resources/html/update/update.css +676 -0
- package/core/resources/html/userinfo/userinfo-old-orz.html +408 -0
- package/core/resources/html/userinfo/userinfo-old.art +233 -0
- package/core/resources/html/userinfo/userinfo-old.css +466 -0
- package/core/resources/html/userinfo/userinfo-orz.html +543 -0
- package/core/resources/html/userinfo/userinfo.art +288 -0
- package/core/resources/html/userinfo/userinfo.css +757 -0
- package/core/resources/info/DLC/arc.json +412 -0
- package/core/resources/info/DLC/chunithm.json +1172 -0
- package/core/resources/info/DLC/dynamix.json +455 -0
- package/core/resources/info/DLC/fanshi.json +132 -0
- package/core/resources/info/DLC/lanota.json +412 -0
- package/core/resources/info/DLC/maimai.json +1110 -0
- package/core/resources/info/DLC/orz.json +158 -0
- package/core/resources/info/DLC/rizline.json +40 -0
- package/core/resources/info/DLC/rotaeno.json +159 -0
- package/core/resources/info/DLC/ryceam.json +53 -0
- package/core/resources/info/avatar.txt +109 -0
- package/core/resources/info/chaplist.yaml +102 -0
- package/core/resources/info/help/api.json +83 -0
- package/core/resources/info/help.json +436 -0
- package/core/resources/info/info.csv +315 -0
- package/core/resources/info/infolist.json +1758 -0
- package/core/resources/info/jrrp.json +92 -0
- package/core/resources/info/nicklist.yaml +2373 -0
- package/core/resources/info/notesInfo.json +1 -0
- package/core/resources/info/notice.json +11 -0
- package/core/resources/info/oldInfo/100/change.csv +218 -0
- package/core/resources/info/oldInfo/100/info.json +7 -0
- package/core/resources/info/oldInfo/101/change.csv +218 -0
- package/core/resources/info/oldInfo/101/info.json +7 -0
- package/core/resources/info/oldInfo/102/change.csv +223 -0
- package/core/resources/info/oldInfo/102/info.json +7 -0
- package/core/resources/info/oldInfo/103/change.csv +224 -0
- package/core/resources/info/oldInfo/103/info.json +7 -0
- package/core/resources/info/oldInfo/104/change.csv +225 -0
- package/core/resources/info/oldInfo/104/info.json +7 -0
- package/core/resources/info/oldInfo/105/change.csv +228 -0
- package/core/resources/info/oldInfo/105/info.json +7 -0
- package/core/resources/info/oldInfo/106/change.csv +229 -0
- package/core/resources/info/oldInfo/106/info.json +7 -0
- package/core/resources/info/oldInfo/108/change.csv +233 -0
- package/core/resources/info/oldInfo/108/info.json +7 -0
- package/core/resources/info/oldInfo/109/change.csv +235 -0
- package/core/resources/info/oldInfo/109/info.json +7 -0
- package/core/resources/info/oldInfo/110/change.csv +235 -0
- package/core/resources/info/oldInfo/110/info.json +7 -0
- package/core/resources/info/oldInfo/111/change.csv +242 -0
- package/core/resources/info/oldInfo/111/info.json +7 -0
- package/core/resources/info/oldInfo/112/change.csv +242 -0
- package/core/resources/info/oldInfo/112/info.json +7 -0
- package/core/resources/info/oldInfo/113/change.csv +244 -0
- package/core/resources/info/oldInfo/113/info.json +7 -0
- package/core/resources/info/oldInfo/115/change.csv +247 -0
- package/core/resources/info/oldInfo/115/info.json +7 -0
- package/core/resources/info/oldInfo/116/change.csv +249 -0
- package/core/resources/info/oldInfo/116/info.json +7 -0
- package/core/resources/info/oldInfo/118/change.csv +252 -0
- package/core/resources/info/oldInfo/118/info.json +7 -0
- package/core/resources/info/oldInfo/119/change.csv +255 -0
- package/core/resources/info/oldInfo/119/info.json +7 -0
- package/core/resources/info/oldInfo/120/change.csv +255 -0
- package/core/resources/info/oldInfo/120/info.json +7 -0
- package/core/resources/info/oldInfo/121/change.csv +257 -0
- package/core/resources/info/oldInfo/121/info.json +7 -0
- package/core/resources/info/oldInfo/122/change.csv +260 -0
- package/core/resources/info/oldInfo/122/info.json +7 -0
- package/core/resources/info/oldInfo/123/change.csv +260 -0
- package/core/resources/info/oldInfo/123/info.json +7 -0
- package/core/resources/info/oldInfo/124/change.csv +262 -0
- package/core/resources/info/oldInfo/124/info.json +7 -0
- package/core/resources/info/oldInfo/125/change.csv +266 -0
- package/core/resources/info/oldInfo/125/info.json +7 -0
- package/core/resources/info/oldInfo/126/change.csv +269 -0
- package/core/resources/info/oldInfo/126/info.json +7 -0
- package/core/resources/info/oldInfo/127/change.csv +270 -0
- package/core/resources/info/oldInfo/127/info.json +7 -0
- package/core/resources/info/oldInfo/128/change.csv +273 -0
- package/core/resources/info/oldInfo/128/info.json +7 -0
- package/core/resources/info/oldInfo/129/change.csv +274 -0
- package/core/resources/info/oldInfo/129/info.json +7 -0
- package/core/resources/info/oldInfo/130/change.csv +275 -0
- package/core/resources/info/oldInfo/130/info.json +7 -0
- package/core/resources/info/oldInfo/131/change.csv +278 -0
- package/core/resources/info/oldInfo/131/info.json +7 -0
- package/core/resources/info/oldInfo/132/change.csv +280 -0
- package/core/resources/info/oldInfo/132/info.json +7 -0
- package/core/resources/info/oldInfo/133/change.csv +284 -0
- package/core/resources/info/oldInfo/133/info.json +7 -0
- package/core/resources/info/oldInfo/134/change.csv +286 -0
- package/core/resources/info/oldInfo/134/info.json +7 -0
- package/core/resources/info/oldInfo/135/change.csv +290 -0
- package/core/resources/info/oldInfo/135/info.json +7 -0
- package/core/resources/info/oldInfo/136/change.csv +290 -0
- package/core/resources/info/oldInfo/136/info.json +7 -0
- package/core/resources/info/oldInfo/137/change.csv +293 -0
- package/core/resources/info/oldInfo/137/info.json +7 -0
- package/core/resources/info/oldInfo/138/change.csv +295 -0
- package/core/resources/info/oldInfo/138/info.json +7 -0
- package/core/resources/info/oldInfo/139/change.csv +295 -0
- package/core/resources/info/oldInfo/139/info.json +7 -0
- package/core/resources/info/oldInfo/140/change.csv +298 -0
- package/core/resources/info/oldInfo/140/info.json +7 -0
- package/core/resources/info/oldInfo/141/change.csv +300 -0
- package/core/resources/info/oldInfo/141/info.json +7 -0
- package/core/resources/info/oldInfo/142/change.csv +302 -0
- package/core/resources/info/oldInfo/142/info.json +7 -0
- package/core/resources/info/oldInfo/143/change.csv +303 -0
- package/core/resources/info/oldInfo/143/info.json +7 -0
- package/core/resources/info/oldInfo/144/change.csv +303 -0
- package/core/resources/info/oldInfo/144/info.json +7 -0
- package/core/resources/info/oldInfo/145/change.csv +305 -0
- package/core/resources/info/oldInfo/145/info.json +7 -0
- package/core/resources/info/oldInfo/146/change.csv +305 -0
- package/core/resources/info/oldInfo/146/info.json +7 -0
- package/core/resources/info/oldInfo/148/change.csv +307 -0
- package/core/resources/info/oldInfo/148/info.json +7 -0
- package/core/resources/info/oldInfo/149/change.csv +307 -0
- package/core/resources/info/oldInfo/149/info.json +7 -0
- package/core/resources/info/oldInfo/151/change.csv +309 -0
- package/core/resources/info/oldInfo/151/info.json +7 -0
- package/core/resources/info/oldInfo/152/change.csv +312 -0
- package/core/resources/info/oldInfo/152/info.json +7 -0
- package/core/resources/info/oldInfo/153/change.csv +313 -0
- package/core/resources/info/oldInfo/153/info.json +7 -0
- package/core/resources/info/oldInfo/154/change.csv +315 -0
- package/core/resources/info/oldInfo/154/info.json +7 -0
- package/core/resources/info/oldInfo/92/change.csv +204 -0
- package/core/resources/info/oldInfo/92/info.json +7 -0
- package/core/resources/info/oldInfo/93/change.csv +206 -0
- package/core/resources/info/oldInfo/93/info.json +7 -0
- package/core/resources/info/oldInfo/94/change.csv +209 -0
- package/core/resources/info/oldInfo/94/info.json +7 -0
- package/core/resources/info/oldInfo/95/change.csv +211 -0
- package/core/resources/info/oldInfo/95/info.json +7 -0
- package/core/resources/info/oldInfo/96/change.csv +216 -0
- package/core/resources/info/oldInfo/96/info.json +7 -0
- package/core/resources/info/oldInfo/98/change.csv +216 -0
- package/core/resources/info/oldInfo/98/info.json +7 -0
- package/core/resources/info/oldInfo/99/change.csv +217 -0
- package/core/resources/info/oldInfo/99/info.json +7 -0
- package/core/resources/info/oldNotesInfo.json +1 -0
- package/core/resources/info/sentences.json +1 -0
- package/core/resources/info/spinfo.json +362 -0
- package/core/resources/info/tips.txt +278 -0
- package/core/resources/otherill//351/233/252/351/231/215SP.png +0 -0
- package/core/resources/song-select.html +535 -0
- package/core/resources/themes/README.md +24 -0
- package/core/resources/themes/milthm/A.png +0 -0
- package/core/resources/themes/milthm/B.png +0 -0
- package/core/resources/themes/milthm/C.png +0 -0
- package/core/resources/themes/milthm/F.png +0 -0
- package/core/resources/themes/milthm/FC.png +0 -0
- package/core/resources/themes/milthm/S.png +0 -0
- package/core/resources/themes/milthm/V.png +0 -0
- package/core/resources/themes/milthm/arcgrosB19.css +36 -0
- package/core/resources/themes/milthm/b19.art +464 -0
- package/core/resources/themes/milthm/b19.css +1314 -0
- package/core/resources/themes/milthm/bg.png +0 -0
- package/core/resources/themes/milthm/clg.css +37 -0
- package/core/resources/themes/milthm/difficultyHistory.css +42 -0
- package/core/resources/themes/milthm/font.ttf +0 -0
- package/core/resources/themes/milthm/help.css +36 -0
- package/core/resources/themes/milthm/historyB30.css +48 -0
- package/core/resources/themes/milthm/info.yaml +45 -0
- package/core/resources/themes/milthm/list.css +39 -0
- package/core/resources/themes/milthm/phi.png +0 -0
- package/core/resources/themes/milthm/setting.css +37 -0
- package/core/resources/themes/milthm/sign.css +81 -0
- package/core/resources/themes/milthm/suggest.css +40 -0
- package/core/resources/themes/milthm/table.css +54 -0
- package/core/resources/themes/milthm/update.css +68 -0
- package/core/tests/aliasProposalService.test.js +82 -0
- package/core/tests/apiAccountDeletion.test.js +125 -0
- package/core/tests/apiPermission.test.js +44 -0
- package/core/tests/apiVersion.test.js +55 -0
- package/core/tests/b30Analysis.test.js +38 -0
- package/core/tests/backgroundIllustration.test.js +21 -0
- package/core/tests/botApiAuthRecovery.test.js +148 -0
- package/core/tests/botSyncService.test.js +42 -0
- package/core/tests/fileWatcherRegistry.test.js +44 -0
- package/core/tests/gameRecordPayload.test.js +34 -0
- package/core/tests/guessLetter.test.js +79 -0
- package/core/tests/makeRequestHandling.test.js +118 -0
- package/core/tests/marketOverflow.test.js +31 -0
- package/core/tests/platformTemplateCache.test.js +92 -0
- package/core/tests/pluginDataThemePreference.test.js +36 -0
- package/core/tests/processCleanup.test.js +58 -0
- package/core/tests/puppeteerShutdown.test.js +17 -0
- package/core/tests/renderPressureHistory.test.js +59 -0
- package/core/tests/saveStats.test.js +26 -0
- package/core/tests/themeInstallGuard.test.js +289 -0
- package/core/tests/themeManager.test.js +625 -0
- package/core/tests/themeManagerInit.test.js +11 -0
- package/core/tests/themeMarket.test.js +855 -0
- package/core/tests/themePageRouting.test.js +431 -0
- package/core/tests/themePolicy.test.js +28 -0
- package/core/tests/themeStorageRecovery.test.js +192 -0
- package/core/tests/userCredentialModuleBoundaries.test.js +41 -0
- package/core/tests/userCredentials.test.js +285 -0
- package/core/tsconfig.json +32 -0
- package/core/types/vendor.d.ts +14 -0
- package/lib/index.cjs +358 -0
- package/lib/index.d.cts +182 -0
- package/lib/index.d.ts +182 -0
- package/lib/index.js +320 -0
- package/package.json +74 -0
- package/readme.md +3 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const cleanupManagerSymbol = Symbol.for('phi-plugin.processCleanupManager')
|
|
2
|
+
const globalStore = /** @type {Record<symbol, any>} */ (globalThis)
|
|
3
|
+
|
|
4
|
+
const signalExitCode = /** @type {Partial<Record<NodeJS.Signals, number>>} */ ({
|
|
5
|
+
SIGHUP: 129,
|
|
6
|
+
SIGINT: 130,
|
|
7
|
+
SIGTERM: 143,
|
|
8
|
+
SIGBREAK: 149,
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export class ProcessCleanupManager {
|
|
12
|
+
/**
|
|
13
|
+
* @param {NodeJS.Process} [target]
|
|
14
|
+
* @param {number} [timeout]
|
|
15
|
+
*/
|
|
16
|
+
constructor(target = process, timeout = 10000) {
|
|
17
|
+
this.target = target
|
|
18
|
+
this.timeout = timeout
|
|
19
|
+
this.cleanup = /** @type {() => Promise<unknown>} */ (async () => {})
|
|
20
|
+
this.emergencyCleanup = () => {}
|
|
21
|
+
this.installed = false
|
|
22
|
+
this.handlingSignal = false
|
|
23
|
+
/** @type {Partial<Record<NodeJS.Signals, () => void>>} */
|
|
24
|
+
this.signalHandlers = {}
|
|
25
|
+
this.exitHandler = () => {
|
|
26
|
+
try {
|
|
27
|
+
this.emergencyCleanup()
|
|
28
|
+
} catch { }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {() => Promise<unknown>} cleanup
|
|
34
|
+
* @param {() => void} emergencyCleanup
|
|
35
|
+
*/
|
|
36
|
+
register(cleanup, emergencyCleanup) {
|
|
37
|
+
const oldCleanup = this.cleanup
|
|
38
|
+
this.cleanup = cleanup
|
|
39
|
+
this.emergencyCleanup = emergencyCleanup
|
|
40
|
+
if (this.installed && oldCleanup !== cleanup) {
|
|
41
|
+
void Promise.resolve().then(() => oldCleanup()).catch(() => {})
|
|
42
|
+
}
|
|
43
|
+
if (!this.installed) this.install()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
install() {
|
|
47
|
+
this.installed = true
|
|
48
|
+
this.target.once('exit', this.exitHandler)
|
|
49
|
+
/** @type {NodeJS.Signals[]} */
|
|
50
|
+
const signals = ['SIGHUP', 'SIGINT', 'SIGTERM']
|
|
51
|
+
if (process.platform === 'win32') signals.push('SIGBREAK')
|
|
52
|
+
for (const signal of signals) {
|
|
53
|
+
const handler = () => { void this.handleSignal(signal, handler) }
|
|
54
|
+
this.signalHandlers[signal] = handler
|
|
55
|
+
this.target.on(signal, handler)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @param {NodeJS.Signals} signal
|
|
61
|
+
* @param {() => void} handler
|
|
62
|
+
*/
|
|
63
|
+
async handleSignal(signal, handler) {
|
|
64
|
+
if (this.handlingSignal) return
|
|
65
|
+
this.handlingSignal = true
|
|
66
|
+
const shouldRelaySignal = this.target.listenerCount(signal) === 1
|
|
67
|
+
let timeoutId
|
|
68
|
+
try {
|
|
69
|
+
await Promise.race([
|
|
70
|
+
Promise.resolve().then(() => this.cleanup()),
|
|
71
|
+
new Promise(resolve => { timeoutId = setTimeout(resolve, this.timeout) }),
|
|
72
|
+
])
|
|
73
|
+
} catch {
|
|
74
|
+
// The synchronous fallback below still runs when graceful cleanup fails.
|
|
75
|
+
} finally {
|
|
76
|
+
if (timeoutId) clearTimeout(timeoutId)
|
|
77
|
+
try {
|
|
78
|
+
this.emergencyCleanup()
|
|
79
|
+
} catch { }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!shouldRelaySignal) return
|
|
83
|
+
this.target.removeListener(signal, handler)
|
|
84
|
+
try {
|
|
85
|
+
this.target.kill(this.target.pid, signal)
|
|
86
|
+
} catch {
|
|
87
|
+
this.target.exit(signalExitCode[signal] || 1)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
dispose() {
|
|
92
|
+
this.target.removeListener('exit', this.exitHandler)
|
|
93
|
+
for (const [signal, handler] of Object.entries(this.signalHandlers)) {
|
|
94
|
+
if (handler) this.target.removeListener(/** @type {NodeJS.Signals} */ (signal), handler)
|
|
95
|
+
}
|
|
96
|
+
this.signalHandlers = {}
|
|
97
|
+
this.installed = false
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const processCleanupManager = /** @type {ProcessCleanupManager} */ (
|
|
102
|
+
globalStore[cleanupManagerSymbol] ||= new ProcessCleanupManager()
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @param {() => Promise<unknown>} cleanup
|
|
107
|
+
* @param {() => void} emergencyCleanup
|
|
108
|
+
*/
|
|
109
|
+
export function registerProcessCleanup(cleanup, emergencyCleanup) {
|
|
110
|
+
processCleanupManager.register(cleanup, emergencyCleanup)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export default processCleanupManager
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
import { pluginRoot } from '../model/filesystem/path.js'
|
|
4
|
+
import logger from './Logger.js'
|
|
5
|
+
import fileWatcherRegistry from './FileWatcherRegistry.js'
|
|
6
|
+
import platform from './platform/index.js'
|
|
7
|
+
const README_path = `${pluginRoot}/README.md`
|
|
8
|
+
const yunzai_ver = `v${platform.getPackageVersion()}`
|
|
9
|
+
|
|
10
|
+
let currentVersion = ''
|
|
11
|
+
let phigrosVer = ''
|
|
12
|
+
let phigrosVerNum = 0
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
if (fs.existsSync(README_path)) {
|
|
16
|
+
const logs = fs.readFileSync(README_path, 'utf8')
|
|
17
|
+
currentVersion = 'v' + (/插件版本\-([0-9\.]+)/.exec(logs)?.[1] ?? '')
|
|
18
|
+
phigrosVer = /Phigros\-([0-9\.]+)/.exec(logs)?.[1] ?? ''
|
|
19
|
+
phigrosVerNum = Number(/PhigrosVer\-([0-9]+)/.exec(logs)?.[1] ?? 0)
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {
|
|
22
|
+
logger.error(e)
|
|
23
|
+
// do nth
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let Version = {
|
|
27
|
+
/** @type {string} 插件版本 v1.0.0 */
|
|
28
|
+
ver: currentVersion,
|
|
29
|
+
/** @type {string} Phigros版本 1.0.0 */
|
|
30
|
+
phigros: phigrosVer,
|
|
31
|
+
/** @type {number} Phigros版本号 */
|
|
32
|
+
phigrosVerNum: phigrosVerNum,
|
|
33
|
+
/** @type {string} 云崽版本 */
|
|
34
|
+
yunzai: yunzai_ver,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const versionWatcher = fileWatcherRegistry.watch('version:readme', README_path, () => {
|
|
38
|
+
try {
|
|
39
|
+
const logs = fs.readFileSync(README_path, 'utf8')
|
|
40
|
+
currentVersion = 'v' + (/插件版本\-([0-9\.]+)/.exec(logs)?.[1] ?? '')
|
|
41
|
+
phigrosVer = /Phigros\-([0-9\.]+)/.exec(logs)?.[1] ?? ''
|
|
42
|
+
phigrosVerNum = Number(/PhigrosVer\-([0-9]+)/.exec(logs)?.[1] ?? 0)
|
|
43
|
+
Version.ver = currentVersion
|
|
44
|
+
Version.phigros = phigrosVer
|
|
45
|
+
Version.phigrosVerNum = phigrosVerNum
|
|
46
|
+
} catch (e) {
|
|
47
|
+
logger.error(e)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
Object.defineProperty(Version, 'close', {
|
|
52
|
+
value: () => versionWatcher.close(),
|
|
53
|
+
enumerable: false,
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
export default Version
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import YAML from 'yaml'
|
|
3
|
+
import lodash from 'lodash'
|
|
4
|
+
import chokidar from 'chokidar'
|
|
5
|
+
// import Constant from '../server/constant/Constant.js'
|
|
6
|
+
|
|
7
|
+
const Constant = {
|
|
8
|
+
CONFIG_INTEGER_KEY: '__yaml_integer_key__',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default class YamlReader {
|
|
12
|
+
/**
|
|
13
|
+
* 读写yaml文件
|
|
14
|
+
*
|
|
15
|
+
* @param {string} yamlPath yaml文件绝对路径
|
|
16
|
+
* @param {boolean} [isWatch] 是否监听文件变化
|
|
17
|
+
*/
|
|
18
|
+
constructor(yamlPath, isWatch = false) {
|
|
19
|
+
this.yamlPath = yamlPath
|
|
20
|
+
this.isWatch = isWatch
|
|
21
|
+
/** @type {YAML.Document.Parsed | undefined} */
|
|
22
|
+
this.document = undefined
|
|
23
|
+
/** @type {import('chokidar').FSWatcher | undefined} */
|
|
24
|
+
this.watcher = undefined
|
|
25
|
+
this.isSave = false
|
|
26
|
+
this.initYaml()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
initYaml() {
|
|
30
|
+
try {
|
|
31
|
+
// parseDocument 将会保留注释
|
|
32
|
+
this.document = YAML.parseDocument(fs.readFileSync(this.yamlPath, 'utf8'))
|
|
33
|
+
} catch (error) {
|
|
34
|
+
throw error
|
|
35
|
+
}
|
|
36
|
+
if (this.isWatch && !this.watcher) {
|
|
37
|
+
this.watcher = chokidar.watch(this.yamlPath).on('change', () => {
|
|
38
|
+
if (this.isSave) {
|
|
39
|
+
this.isSave = false
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
this.initYaml()
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**返回读取的对象 */
|
|
48
|
+
get jsonData() {
|
|
49
|
+
if (!this.document) {
|
|
50
|
+
return null
|
|
51
|
+
}
|
|
52
|
+
return this.document.toJSON()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*检查集合是否包含key的值*/
|
|
56
|
+
/**
|
|
57
|
+
* @param {string} keyPath
|
|
58
|
+
*/
|
|
59
|
+
has(keyPath) {
|
|
60
|
+
return this.document?.hasIn(keyPath.split('.')) ?? false
|
|
61
|
+
}
|
|
62
|
+
/*返回key的值*/
|
|
63
|
+
/**
|
|
64
|
+
* @param {string} keyPath
|
|
65
|
+
*/
|
|
66
|
+
get(keyPath) {
|
|
67
|
+
return lodash.get(this.jsonData, keyPath)
|
|
68
|
+
}
|
|
69
|
+
/*修改某个key的值*/
|
|
70
|
+
/**
|
|
71
|
+
* @param {string} keyPath
|
|
72
|
+
* @param {unknown} value
|
|
73
|
+
*/
|
|
74
|
+
set(keyPath, value) {
|
|
75
|
+
this.document?.setIn(keyPath.split('.'), value)
|
|
76
|
+
this.save()
|
|
77
|
+
}
|
|
78
|
+
/*删除key*/
|
|
79
|
+
/**
|
|
80
|
+
* @param {string} keyPath
|
|
81
|
+
*/
|
|
82
|
+
delete(keyPath) {
|
|
83
|
+
this.document?.deleteIn(keyPath.split('.'))
|
|
84
|
+
this.save()
|
|
85
|
+
}
|
|
86
|
+
//数组添加数据
|
|
87
|
+
/**
|
|
88
|
+
* @param {string} keyPath
|
|
89
|
+
* @param {unknown} value
|
|
90
|
+
*/
|
|
91
|
+
addIn(keyPath, value) {
|
|
92
|
+
this.document?.addIn(keyPath.split('.'), value)
|
|
93
|
+
this.save()
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* 设置 document 的数据(递归式)
|
|
97
|
+
* @param {unknown} data 要写入的数据
|
|
98
|
+
*/
|
|
99
|
+
setData(data) {
|
|
100
|
+
this.setDataRecursion(data, [])
|
|
101
|
+
this.save()
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @param {unknown} data
|
|
106
|
+
* @param {string[]} parentKeys
|
|
107
|
+
*/
|
|
108
|
+
setDataRecursion(data, parentKeys) {
|
|
109
|
+
if (Array.isArray(data)) {
|
|
110
|
+
this.document?.setIn(this.mapParentKeys(parentKeys), data)
|
|
111
|
+
} else if (typeof data === 'object' && data !== null) {
|
|
112
|
+
for (const [key, value] of Object.entries(data)) {
|
|
113
|
+
this.setDataRecursion(value, parentKeys.concat([key]))
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
const mappedParentKeys = this.mapParentKeys(parentKeys)
|
|
117
|
+
this.document?.setIn(mappedParentKeys, data)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// 将数字key转为number类型,防止出现引号
|
|
122
|
+
/**
|
|
123
|
+
* @param {string[]} parentKeys
|
|
124
|
+
* @returns {(string | number)[]}
|
|
125
|
+
*/
|
|
126
|
+
mapParentKeys(parentKeys) {
|
|
127
|
+
return parentKeys.map((k) => {
|
|
128
|
+
if (k.startsWith(Constant.CONFIG_INTEGER_KEY)) {
|
|
129
|
+
return Number.parseInt(k.replace(Constant.CONFIG_INTEGER_KEY, ''))
|
|
130
|
+
}
|
|
131
|
+
return k
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 彻底删除某个key
|
|
136
|
+
/**
|
|
137
|
+
* @param {string} keyPath
|
|
138
|
+
*/
|
|
139
|
+
deleteKey(keyPath) {
|
|
140
|
+
const keys = this.mapParentKeys(keyPath.split('.'))
|
|
141
|
+
this.document?.deleteIn(keys)
|
|
142
|
+
this.save()
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
save() {
|
|
146
|
+
this.isSave = true
|
|
147
|
+
let yaml = this.document?.toString() ?? ''
|
|
148
|
+
fs.writeFileSync(this.yamlPath, yaml, 'utf8')
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** 关闭可选的文件监听器。 */
|
|
152
|
+
async close() {
|
|
153
|
+
const watcher = this.watcher
|
|
154
|
+
this.watcher = undefined
|
|
155
|
+
if (watcher) await watcher.close()
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import Config from './Config.js'
|
|
2
|
+
import send from "../model/render/send.js";
|
|
3
|
+
import fCompute from '../model/game/fCompute.js'
|
|
4
|
+
import getInfo from '../model/game/getInfo.js';
|
|
5
|
+
import logger from './Logger.js';
|
|
6
|
+
import platform from './platform/index.js';
|
|
7
|
+
|
|
8
|
+
/** @import {PlatformEvent, PlatformMessageInput, PlatformPluginConfig, PlatformUserId} from './platform/types.js' */
|
|
9
|
+
|
|
10
|
+
const HostPlugin = platform.PluginBase
|
|
11
|
+
const wrappedHandlerSymbol = Symbol('phi.wrappedHandler')
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {object} botEventObj
|
|
16
|
+
* @property {string} msg 消息内容
|
|
17
|
+
* @property {PlatformUserId} user_id 发送者ID
|
|
18
|
+
* @property {boolean} isGroup 是否群消息
|
|
19
|
+
* @property {boolean} isPrivate 是否私聊消息
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {object} botEventGroup
|
|
24
|
+
* @property {true} isGroup 是否群消息
|
|
25
|
+
* @property {PlatformUserId} group_id 群ID
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @typedef {object} botEventPrivate
|
|
30
|
+
* @property {true} isPrivate 是否私聊消息
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**@typedef {PlatformEvent & botEventObj & (botEventGroup | botEventPrivate) & Object.<string, any>} botEvent */
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @template {any} T
|
|
37
|
+
* @typedef {Object} waitToChoseSong
|
|
38
|
+
* @property {idString[]} ids 待选择的曲目列表
|
|
39
|
+
* @property {T} options 其他选项
|
|
40
|
+
* @property {mutiNickCallback<T>} callback 选择后的回调函数
|
|
41
|
+
* @property {NodeJS.Timeout | undefined} timer 超时清理定时器
|
|
42
|
+
**/
|
|
43
|
+
|
|
44
|
+
/** @type {Record<string, waitToChoseSong<any>>} */
|
|
45
|
+
const wait_to_chose_song = {}
|
|
46
|
+
|
|
47
|
+
/** @param {string} userId */
|
|
48
|
+
function clearMutiNickState(userId) {
|
|
49
|
+
const state = wait_to_chose_song[userId]
|
|
50
|
+
if (state?.timer) clearTimeout(state.timer)
|
|
51
|
+
delete wait_to_chose_song[userId]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @template {any} T
|
|
56
|
+
* @typedef {(e: botEvent, id: idString, options: T) => void} mutiNickCallback
|
|
57
|
+
**/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @typedef {object} getMicInfoFromMsgOptionsMap
|
|
61
|
+
* @property {levelKind} rank 难度
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export default class phiPluginBase extends HostPlugin {
|
|
66
|
+
/** @type {botEvent} */
|
|
67
|
+
e
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {PlatformPluginConfig} config 配置项
|
|
72
|
+
*/
|
|
73
|
+
constructor({
|
|
74
|
+
name = "your-plugin",
|
|
75
|
+
dsc = "无",
|
|
76
|
+
handler,
|
|
77
|
+
namespace,
|
|
78
|
+
event = "message",
|
|
79
|
+
priority = 5000,
|
|
80
|
+
task = undefined,
|
|
81
|
+
rule = []
|
|
82
|
+
}) {
|
|
83
|
+
super({
|
|
84
|
+
name, dsc, handler, namespace, event, priority, task,
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
rule
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
/** @type {botEvent} */
|
|
90
|
+
this.e = platform.wrapEvent({ msg: '', user_id: '', isGroup: false, isPrivate: true }) // 占位用;
|
|
91
|
+
this.wrapPlatformHandlers()
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** @returns {void} */
|
|
96
|
+
wrapPlatformHandlers() {
|
|
97
|
+
for (const item of this.rule || []) {
|
|
98
|
+
if (item?.fnc) this.wrapPlatformHandler(item.fnc)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @param {string} key
|
|
104
|
+
* @returns {void}
|
|
105
|
+
*/
|
|
106
|
+
wrapPlatformHandler(key) {
|
|
107
|
+
const fn = this[key]
|
|
108
|
+
if (typeof fn !== 'function') return
|
|
109
|
+
const typedFn = /** @type {Function & Record<symbol, unknown>} */ (fn)
|
|
110
|
+
if (typedFn[wrappedHandlerSymbol]) return
|
|
111
|
+
const wrapped = (/** @type {any[]} */ ...args) => {
|
|
112
|
+
if (args[0] && typeof args[0] === 'object') {
|
|
113
|
+
args[0] = this.wrapPlatformEvent(args[0])
|
|
114
|
+
} else if (this.e) {
|
|
115
|
+
this.e = this.wrapPlatformEvent(this.e)
|
|
116
|
+
}
|
|
117
|
+
return typedFn.apply(this, args)
|
|
118
|
+
}
|
|
119
|
+
wrapped[wrappedHandlerSymbol] = true
|
|
120
|
+
this[key] = wrapped
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @param {botEvent} e
|
|
125
|
+
* @returns {botEvent}
|
|
126
|
+
*/
|
|
127
|
+
wrapPlatformEvent(e) {
|
|
128
|
+
this.e = platform.wrapEvent(e)
|
|
129
|
+
return this.e
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @param {PlatformMessageInput} [msg]
|
|
134
|
+
* @param {boolean} [quote]
|
|
135
|
+
* @param {Record<string, unknown>} [data]
|
|
136
|
+
*/
|
|
137
|
+
reply(msg = '', quote = false, data = {}) {
|
|
138
|
+
return platform.reply(this.e, msg, { quote, ...data })
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @param {...any} args
|
|
143
|
+
*/
|
|
144
|
+
setContext(...args) {
|
|
145
|
+
if (this.e) this.e = platform.wrapEvent(this.e)
|
|
146
|
+
if (typeof args[0] === 'string') this.wrapPlatformHandler(args[0])
|
|
147
|
+
return super.setContext?.(...args)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @param {...any} args
|
|
152
|
+
*/
|
|
153
|
+
finish(...args) {
|
|
154
|
+
return super.finish?.(...args)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @template {object} T
|
|
159
|
+
* @param {botEvent} e 事件对象
|
|
160
|
+
* @param {idString[]} idList
|
|
161
|
+
* @param {T} options
|
|
162
|
+
* @param {mutiNickCallback<T>} callback
|
|
163
|
+
*/
|
|
164
|
+
choseMutiNick(e, idList, options, callback) {
|
|
165
|
+
e = this.wrapPlatformEvent(e)
|
|
166
|
+
if (idList.length === 0) {
|
|
167
|
+
send.send_with_At(e, `未找到相关曲目信息QAQ!如果想要提供别名的话请访问 /phihelp 中的别名投稿链接嗷!`, true)
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (idList.length === 1) {
|
|
171
|
+
callback(e, idList[0], options);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
send.send_with_At(e, fCompute.mutiNick(idList));
|
|
175
|
+
const userId = String(e.user_id)
|
|
176
|
+
const timeoutSeconds = Number(Config.getUserCfg('config', 'mutiNickWaitTimeOut')) || 0
|
|
177
|
+
clearMutiNickState(userId)
|
|
178
|
+
const state = wait_to_chose_song[userId] = {
|
|
179
|
+
ids: idList,
|
|
180
|
+
options,
|
|
181
|
+
callback,
|
|
182
|
+
timer: /** @type {NodeJS.Timeout | undefined} */ (undefined),
|
|
183
|
+
};
|
|
184
|
+
if (timeoutSeconds > 0) {
|
|
185
|
+
state.timer = setTimeout(() => {
|
|
186
|
+
if (wait_to_chose_song[userId] === state) clearMutiNickState(userId)
|
|
187
|
+
}, timeoutSeconds * 1000)
|
|
188
|
+
state.timer?.unref?.()
|
|
189
|
+
}
|
|
190
|
+
this.setContext('mutiNick', false, timeoutSeconds, '操作超时已取消,请注意@BOT进行回复呐!')
|
|
191
|
+
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async mutiNick() {
|
|
195
|
+
this.e = this.wrapPlatformEvent(this.e)
|
|
196
|
+
const { msg } = this.e;
|
|
197
|
+
const num = Number(msg.match(/([0-9]+)/)?.[0]);
|
|
198
|
+
const userId = String(this.e.user_id)
|
|
199
|
+
const state = wait_to_chose_song[userId]
|
|
200
|
+
const ids = state?.ids || [];
|
|
201
|
+
if (!num) {
|
|
202
|
+
send.send_with_At(this.e, `请输入正确的序号哦!`);
|
|
203
|
+
} else if (!ids[num - 1]) {
|
|
204
|
+
send.send_with_At(this.e, `未找到${num}所对应的曲目哦!`);
|
|
205
|
+
} else {
|
|
206
|
+
clearMutiNickState(userId)
|
|
207
|
+
this.finish('mutiNick', false)
|
|
208
|
+
state?.callback(this.e, ids[num - 1], state.options);
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* 提取消息中的曲目与其他信息
|
|
215
|
+
* @template {keyof getMicInfoFromMsgOptionsMap} T
|
|
216
|
+
* @template {object} T2
|
|
217
|
+
* @param {botEvent} e 事件对象
|
|
218
|
+
* @param {RegExp} fncName 要去掉的命令前缀
|
|
219
|
+
* @param {T[]} params 需要解析的键集合
|
|
220
|
+
* @param {T2} options 其他选项
|
|
221
|
+
* @param {(e: botEvent, id: idString, params: Pick<getMicInfoFromMsgOptionsMap, T> & T2) => void} callback 仅包含声明过的键
|
|
222
|
+
*/
|
|
223
|
+
async getMicInfoFromMsg(e, fncName, params = [], options, callback) {
|
|
224
|
+
let msg = e.msg.replace(fncName, '');
|
|
225
|
+
/** @type {Pick<getMicInfoFromMsgOptionsMap, T>} */
|
|
226
|
+
const optObj = /** @type {Pick<getMicInfoFromMsgOptionsMap, T>} */ ({});
|
|
227
|
+
for (let opt of params) {
|
|
228
|
+
switch (opt) {
|
|
229
|
+
case 'rank': {
|
|
230
|
+
let rank = /** @type {levelKind} */((msg.match(/\b(EZ|HD|IN|AT)\b/i)?.[1] || 'IN').toUpperCase())
|
|
231
|
+
optObj[opt] = rank;
|
|
232
|
+
msg = msg.replace(/\b(EZ|HD|IN|AT)\b/i, '')
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (!msg) {
|
|
239
|
+
send.send_with_At(e, `请在命令后添加曲目名称或别名哦~`, true);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
let ids = getInfo.fuzzysongsnick(msg, undefined, true)
|
|
244
|
+
if (!ids.length) {
|
|
245
|
+
send.send_with_At(e, `未找到${msg}的相关曲目信息QAQ!如果想要提供别名的话请访问 /phihelp 中的别名投稿链接嗷!`, true)
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (ids.length > 1) {
|
|
250
|
+
this.choseMutiNick(e, ids, { ...optObj, ...options }, (e, id, optObj) => {
|
|
251
|
+
|
|
252
|
+
let info = getInfo.info(id, true)
|
|
253
|
+
if (!info) {
|
|
254
|
+
send.send_with_At(e, `未找到${id}的曲目信息QAQ!请回报管理员!`, true)
|
|
255
|
+
logger.error(`phi-plugin错误:未找到曲目ID为${id}的曲目信息!`)
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if ('rank' in optObj) {
|
|
259
|
+
const { rank } = optObj
|
|
260
|
+
if (!info.chart[/** @type {levelKind} */(rank)]) {
|
|
261
|
+
send.send_with_At(e, `${info.song} 没有 ${rank} 这个难度QAQ!`)
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
callback(e, id, optObj)
|
|
267
|
+
})
|
|
268
|
+
} else {
|
|
269
|
+
const id = ids[0];
|
|
270
|
+
let info = getInfo.info(id, true)
|
|
271
|
+
if (!info) {
|
|
272
|
+
send.send_with_At(e, `未找到${id}的曲目信息QAQ!请回报管理员!`, true)
|
|
273
|
+
logger.error(`phi-plugin错误:未找到曲目ID为${id}的曲目信息!`)
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if ('rank' in optObj) {
|
|
277
|
+
const { rank } = optObj
|
|
278
|
+
if (!info.chart[/** @type {levelKind} */(rank)]) {
|
|
279
|
+
send.send_with_At(e, `${info.song} 没有 ${rank} 这个难度QAQ!`)
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
callback(e, id, { ...optObj, ...options })
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import platform from './platform/index.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
/**
|
|
5
|
+
* @param {import('./platform/types.js').PlatformUserId} userId
|
|
6
|
+
* @param {import('./platform/types.js').PlatformMessageInput} msg
|
|
7
|
+
* @param {import('./platform/types.js').PlatformUserId} [botId]
|
|
8
|
+
*/
|
|
9
|
+
relpyPrivate(userId, msg, botId) {
|
|
10
|
+
if (platform.relpyPrivate) return platform.relpyPrivate(userId, msg, botId)
|
|
11
|
+
return false
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {number} ms
|
|
16
|
+
* @returns {Promise<void>}
|
|
17
|
+
*/
|
|
18
|
+
sleep(ms) {
|
|
19
|
+
return platform.sleep(ms)
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {string} url
|
|
24
|
+
* @param {string} file
|
|
25
|
+
* @param {unknown} [opts]
|
|
26
|
+
*/
|
|
27
|
+
downFile(url, file, opts) {
|
|
28
|
+
return platform.downFile(url, file, opts)
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} dirname
|
|
33
|
+
* @returns {boolean}
|
|
34
|
+
*/
|
|
35
|
+
mkdirs(dirname) {
|
|
36
|
+
return platform.mkdirs(dirname)
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {import('./platform/types.js').PlatformEvent} e
|
|
41
|
+
* @param {import('./platform/types.js').PlatformMessageInput[]} [msg]
|
|
42
|
+
* @param {string} [dec]
|
|
43
|
+
*/
|
|
44
|
+
makeForwardMsg(e, msg = [], dec) {
|
|
45
|
+
return platform.makeForwardMsg(e, msg, dec)
|
|
46
|
+
},
|
|
47
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Version from './Version.js'
|
|
2
|
+
import Data from './Data.js'
|
|
3
|
+
import Config from './Config.js'
|
|
4
|
+
import YamlReader from './YamlReader.js'
|
|
5
|
+
import { pluginRoot } from '../model/filesystem/path.js'
|
|
6
|
+
import platform from './platform/index.js'
|
|
7
|
+
import logger from './Logger.js'
|
|
8
|
+
import segment from './segment.js'
|
|
9
|
+
const Path = platform.rootPath
|
|
10
|
+
const Display_Plugin_Name = 'Phi-Plugin'
|
|
11
|
+
const Plugin_Name = 'phi-plugin'
|
|
12
|
+
const Plugin_Path = pluginRoot
|
|
13
|
+
export { Config, Data, Version, Path, Plugin_Name, Plugin_Path, Display_Plugin_Name, YamlReader, logger, segment }
|