@praise166/vire 0.1.4 → 0.1.5
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/assets/Poppins-Regular.ttf +0 -0
- package/dist/vire.js +27 -1
- package/package.json +1 -2
|
Binary file
|
package/dist/vire.js
CHANGED
|
@@ -4,6 +4,7 @@ import { spawn } from 'node:child_process';
|
|
|
4
4
|
import { access, copyFile, mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
5
5
|
import { dirname, join } from 'node:path';
|
|
6
6
|
import process from 'node:process';
|
|
7
|
+
import { createInterface } from 'node:readline';
|
|
7
8
|
import { fileURLToPath } from 'node:url';
|
|
8
9
|
import { input, password, select } from '@inquirer/prompts';
|
|
9
10
|
import boxen from 'boxen';
|
|
@@ -485,7 +486,7 @@ function startBot(binary, token, login) {
|
|
|
485
486
|
const child = spawn(binary, [], {
|
|
486
487
|
cwd: root,
|
|
487
488
|
shell: false,
|
|
488
|
-
stdio: ['
|
|
489
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
489
490
|
env: {
|
|
490
491
|
...process.env,
|
|
491
492
|
DISCORD_TOKEN: token,
|
|
@@ -494,6 +495,7 @@ function startBot(binary, token, login) {
|
|
|
494
495
|
},
|
|
495
496
|
});
|
|
496
497
|
ora().succeed('vire is online');
|
|
498
|
+
const terminal = attachTerminalCommands(child);
|
|
497
499
|
let started = true;
|
|
498
500
|
child.stdout.setEncoding('utf8');
|
|
499
501
|
child.stderr.setEncoding('utf8');
|
|
@@ -514,6 +516,7 @@ function startBot(binary, token, login) {
|
|
|
514
516
|
reject(error);
|
|
515
517
|
});
|
|
516
518
|
child.on('exit', code => {
|
|
519
|
+
terminal.close();
|
|
517
520
|
if (!started) {
|
|
518
521
|
console.log(chalk.red(`vire.self exited before connecting (${code ?? 0})`));
|
|
519
522
|
}
|
|
@@ -524,6 +527,29 @@ function startBot(binary, token, login) {
|
|
|
524
527
|
});
|
|
525
528
|
});
|
|
526
529
|
}
|
|
530
|
+
function attachTerminalCommands(child) {
|
|
531
|
+
console.log(chalk.dim('terminal commands: /rpc help'));
|
|
532
|
+
const terminal = createInterface({
|
|
533
|
+
input: process.stdin,
|
|
534
|
+
output: process.stdout,
|
|
535
|
+
terminal: true,
|
|
536
|
+
});
|
|
537
|
+
terminal.on('line', line => {
|
|
538
|
+
const input = line.trim();
|
|
539
|
+
if (!input)
|
|
540
|
+
return;
|
|
541
|
+
if (input === '/quit' || input === '/exit') {
|
|
542
|
+
child.kill();
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
if (!input.startsWith('/')) {
|
|
546
|
+
console.log(chalk.dim('use /rpc help for terminal config'));
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
child.stdin?.write(`${input}\n`);
|
|
550
|
+
});
|
|
551
|
+
return terminal;
|
|
552
|
+
}
|
|
527
553
|
async function main() {
|
|
528
554
|
banner();
|
|
529
555
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praise166/vire",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@inquirer/prompts": "^7.3.2",
|
|
25
|
-
"@praise166/vire": "^0.1.3",
|
|
26
25
|
"boxen": "^8.0.1",
|
|
27
26
|
"chalk": "^5.4.1",
|
|
28
27
|
"dotenv": "^16.4.7",
|