UNPKG

mcbbsmis

Version:

Minecraft Connect Bind BiliBili Sync Message Interaction Service

95 lines (78 loc) 2.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const node_fs_1 = require("node:fs"); const config_1 = tslib_1.__importDefault(require("../config")); const INIT_CONFIG_CONTENT = `# ============================== # Mcbbsmis Configs File # Author Info: # GitHub: Mcbbsmis # Npm: Mcbbsmis # BiliBili: lZiMUl # ============================== # ============================== # Global Settings # ============================== [global] # Host address to listen on. Default '0.0.0.0' means all network interfaces. host = '0.0.0.0' # Port to listen on. port = 5700 # Program language. Options: # en_US (default) - English # ru_RU - Russian # zh_CN - Simplified Chinese # zh_TW - Traditional Chinese (Taiwan) language = 'en_US' # Command identifier used for in-game commands. identifier = '$' # ============================== # Options - Feature Toggles # ============================== [options] # Show welcome message on startup welcome = false # Show viewer count watch = false # Show online count online = false # Listen to like events like = true # Listen to chat messages (danmu) danmu = true # Listen to gift events gift = true # Listen to share/interaction events share = false # ============================== # BiliBili Settings # ============================== [bilibili] # Live room ID roomid = 9329583 # BiliBili user ID userid = 291883246 # BiliBili username username = 'lZiMUl' # ============================== # Client Settings # ============================== [xbox] # Game client username (used to identify commands) username = 'lZiMUl' `; function InitUnit(force = false) { if (!(0, node_fs_1.existsSync)(config_1.default.CONFIG_PATH)) (0, node_fs_1.mkdirSync)(config_1.default.CONFIG_PATH, { recursive: true }); const configExists = (0, node_fs_1.existsSync)(config_1.default.CONFIG_FILE_PATH); if (!configExists) config_1.default.LOGGER.warn(config_1.default.LANGUAGE.get('#1')); if (!configExists || force) { config_1.default.LOGGER.info(config_1.default.LANGUAGE.get('#2')); (0, node_fs_1.writeFileSync)(config_1.default.CONFIG_FILE_PATH, INIT_CONFIG_CONTENT, { encoding: 'utf-8', flag: 'w' }); } } exports.default = InitUnit;