matrix-cli – Diff between revs 20 and 21
?pathlinks?
Rev 20 | Rev 21 | |||
---|---|---|---|---|
Line 127... | Line 127... | |||
127 | if (select.length == 0) { |
127 | if (select.length == 0) { |
|
128 | log.error(`Room '${sayRoom}' not found.`) |
128 | log.error(`Room '${sayRoom}' not found.`) |
|
129 | matrixLogout(client) |
129 | matrixLogout(client) |
|
130 | return |
130 | return |
|
131 | } |
131 | } |
|
- | 132 | |
||
132 | var room = select[0] |
133 | var room = select[0] |
|
133 | var payload = {} |
134 | var payload = {} |
|
- | 135 | |
||
134 | switch (commandOptions.type.toUpperCase()) { |
136 | switch (commandOptions.type.toUpperCase()) { |
|
135 | case 'HTML': |
137 | case 'HTML': |
|
136 | const promises = [] |
138 | const promises = [] |
|
137 | // interpret body as html and download/replace images |
139 | // interpret body as html and download/replace images |
|
138 | var htmlDocument = parse(sayText) |
140 | var htmlDocument = parse(sayText) |
|
Line 148... | Line 150... | |||
148 | }) |
150 | }) |
|
149 | }) |
151 | }) |
|
150 | })) |
152 | })) |
|
151 | } |
153 | } |
|
152 | }) |
154 | }) |
|
153 | |
155 | |
|
154 | Promise.all(promises) |
156 | Promise.all(promises) |
|
155 | .then(() => { |
157 | .then(() => { |
|
156 | payload = { |
158 | payload = { |
|
157 | "format": "org.matrix.custom.html", |
159 | "format": "org.matrix.custom.html", |
|
158 | "body": '', |
160 | "body": '', |
|
Line 447... | Line 449... | |||
447 | +-- --+`).version('1.0') |
449 | +-- --+`).version('1.0') |
|
Line 448... | Line 450... | |||
448 | |
450 | |
|
449 | program.command('say <room> <text>') |
451 | program.command('say <room> <text>') |
|
450 | .requiredOption('-u, --user <user>', 'the username to log-in to matrix.org') |
452 | .requiredOption('-u, --user <user>', 'the username to log-in to matrix.org') |
|
451 | .option('-p, --password <password>', 'the password to log-in to matrix.org') |
453 | .option('-p, --password <password>', 'the password to log-in to matrix.org') |
|
452 | .requiredOption('-s, --server <server>', 'the server to log-in to') |
454 | .requiredOption('-s, --server <server>', 'the server to log-in to', 'https://matrix.org') |
|
453 | .option('-t, --type <type>', 'the message format; either text (default) or html') |
455 | .option('-t, --type <type>', 'the message format; either text (default) or html', 'text') |
|
454 | .description('send a message to a room') |
456 | .description('send a message to a room') |
|
Line 455... | Line 457... | |||
455 | .action(matrixSay) |
457 | .action(matrixSay) |
|
456 | |
458 | |
|
457 | program.command('publish <room> <file...>') |
459 | program.command('publish <room> <file...>') |
|
458 | .requiredOption('-u, --user <user>', 'the username to log-in to matrix.org') |
460 | .requiredOption('-u, --user <user>', 'the username to log-in to matrix.org') |
|
459 | .option('-p, --password <password>', 'the password to log-in to matrix.org') |
461 | .option('-p, --password <password>', 'the password to log-in to matrix.org') |
|
460 | .requiredOption('-s, --server <server>', 'the server to log-in to') |
462 | .requiredOption('-s, --server <server>', 'the server to log-in to', 'https://matrix.org') |
|
Line 461... | Line 463... | |||
461 | .description('publish files to a room from either the local filesystem or from an URL') |
463 | .description('publish files to a room from either the local filesystem or from an URL') |
|
462 | .action(matrixPublish) |
464 | .action(matrixPublish) |
|
463 | |
465 | |
|
464 | program.command('join <room>') |
466 | program.command('join <room>') |
|
465 | .requiredOption('-u, --user <user>', 'the username to log-in to matrix.org') |
467 | .requiredOption('-u, --user <user>', 'the username to log-in to matrix.org') |
|
466 | .option('-p, --password <password>', 'the password to log-in to matrix.org') |
468 | .option('-p, --password <password>', 'the password to log-in to matrix.org') |
|
Line 467... | Line 469... | |||
467 | .requiredOption('-s, --server <server>', 'the server to log-in to') |
469 | .requiredOption('-s, --server <server>', 'the server to log-in to', 'https://matrix.org') |
|
468 | .description('join a room') |
470 | .description('join a room') |
|
469 | .action(matrixJoin) |
471 | .action(matrixJoin) |
|
470 | |
472 | |
|
471 | program.command('part <room>') |
473 | program.command('part <room>') |
|
472 | .requiredOption('-u, --user <user>', 'the username to log-in to matrix.org') |
474 | .requiredOption('-u, --user <user>', 'the username to log-in to matrix.org') |
|
Line 473... | Line 475... | |||
473 | .option('-p, --password <password>', 'the password to log-in to matrix.org') |
475 | .option('-p, --password <password>', 'the password to log-in to matrix.org') |
|
474 | .requiredOption('-s, --server <server>', 'the server to log-in to') |
476 | .requiredOption('-s, --server <server>', 'the server to log-in to', 'https://matrix.org') |
|
475 | .description('part with a room') |
477 | .description('part with a room') |
|
476 | .action(matrixPart) |
478 | .action(matrixPart) |
|
477 | |
479 | |
|
478 | program.command('list') |
480 | program.command('list') |
|
479 | .requiredOption('-u, --user <user>', 'the username to log-in to matrix.org') |
481 | .requiredOption('-u, --user <user>', 'the username to log-in to matrix.org') |
|
Line 480... | Line 482... | |||
480 | .option('-p, --password <password>', 'the password to log-in to matrix.org') |
482 | .option('-p, --password <password>', 'the password to log-in to matrix.org') |
|
481 | .requiredOption('-s, --server <server>', 'the server to log-in to') |
483 | .requiredOption('-s, --server <server>', 'the server to log-in to', 'https://matrix.org') |
|
482 | .requiredOption('-e, --entity <entity>', 'the entity to list, valid options are "rooms", "members"') |
484 | .requiredOption('-e, --entity <entity>', 'the entity to list, valid options are "rooms", "members"', 'rooms') |
|
483 | .description('list various matrix entities') |
485 | .description('list various matrix entities') |
|
484 | .action(matrixList) |
486 | .action(matrixList) |
|
485 | |
487 | |
|
Line 486... | Line 488... | |||
486 | program.command('mqtt <room> <connect> <topic>') |
488 | program.command('mqtt <room> <connect> <topic>') |