/** Reads options from command line, requires command-line-args */ function readCommandLineOptions() { function resolveKeyValuePairs(kvs: string[]) { var o: any = {}; for (var i=0; i<kvs.length; i++) { var kv = kvs[i].split("="); o[kv[0]] = kv[1] || true; } return o; } var opts = commandLineArgs(optionDefinitions); if (opts.help) { fableLib.stdoutLog(commandLineUsage(getAppDescription())); fableLib.finish(0); } if (opts.refs) { opts.refs = resolveKeyValuePairs(opts.refs); } if (opts.coreLib) { opts.refs = Object.assign(opts.refs || {}, { "Fable.Core": opts.coreLib }) delete opts.coreLib; } if (opts.extra) { opts.extra = resolveKeyValuePairs(opts.extra); } return opts; }
function printHelp() { console.log(commandLineUsage(usage)); }
name: "config", type: String, typeLabel: "<config.yaml>", }, ]; const options = args(optionDefinitions); if (options.help) { /* tslint:disable:no-console */ console.log(usage([ { content: "A tool to fix channels of rooms already bridged " + "to matrix, to make sure their names, icons etc. are correctly.", header: "Fix bridged channels", }, { header: "Options", optionList: optionDefinitions, }, ])); process.exit(0); } const yamlConfig = yaml.safeLoad(fs.readFileSync("./discord-registration.yaml", "utf8")); const registration = AppServiceRegistration.fromObject(yamlConfig); const config = new DiscordBridgeConfig(); config.ApplyConfig(yaml.safeLoad(fs.readFileSync(options.config, "utf8")) as DiscordBridgeConfig); if (registration === null) { throw new Error("Failed to parse registration file");
description: "The power to set", name: "power", type: Number, typeLabel: "<0-100>", }, ]; const options = args(optionDefinitions); if (options.help) { /* tslint:disable:no-console */ console.log(usage([ { content: "A tool to give a user a power level in a bot user controlled room.", header: "Admin Me", }, { header: "Options", optionList: optionDefinitions, }, ])); process.exit(0); } if (!options.roomid) { console.error("Missing roomid parameter. Check -h"); process.exit(1); } if (!options.userid) { console.error("Missing userid parameter. Check -h"); process.exit(1);
name: "config", type: String, typeLabel: "<config.yaml>", }, ]; const options = args(optionDefinitions); if (options.help) { /* tslint:disable:no-console */ console.log(usage([ { content: "A tool to fix usernames of ghosts already in " + "matrix rooms, to make sure they represent the correct discord usernames.", header: "Fix usernames of joined ghosts", }, { header: "Options", optionList: optionDefinitions, }, ])); process.exit(0); } const yamlConfig = yaml.safeLoad(fs.readFileSync("./discord-registration.yaml", "utf8")); const registration = AppServiceRegistration.fromObject(yamlConfig); const config = new DiscordBridgeConfig(); config.ApplyConfig(yaml.safeLoad(fs.readFileSync(options.config, "utf8")) as DiscordBridgeConfig); if (registration === null) { throw new Error("Failed to parse registration file");
defaultValue: "room-store.db", description: "The location of the room store.", name: "store", type: String, }, ]; const options = args(optionDefinitions); if (options.help) { /* tslint:disable:no-console */ console.log(usage([ { content: "A tool to set all the bridged rooms to visible in the directory.", header: "Add rooms to directory", }, { header: "Options", optionList: optionDefinitions, }, ])); process.exit(0); } const yamlConfig = yaml.safeLoad(fs.readFileSync("./discord-registration.yaml", "utf8")); const registration = AppServiceRegistration.fromObject(yamlConfig); const config: DiscordBridgeConfig = yaml.safeLoad(fs.readFileSync(options.config, "utf8")) as DiscordBridgeConfig; if (registration === null) { throw new Error("Failed to parse registration file"); } const clientFactory = new ClientFactory({