go to the right channel
This commit is contained in:
parent
a01b30c2d2
commit
314eb05c82
1 changed files with 7 additions and 4 deletions
7
index.js
7
index.js
|
@ -3,6 +3,7 @@ import { spawn } from "node:child_process";
|
||||||
import { mkdir, cp } from 'node:fs/promises';
|
import { mkdir, cp } from 'node:fs/promises';
|
||||||
|
|
||||||
let sessions = {};
|
let sessions = {};
|
||||||
|
let channels = {};
|
||||||
|
|
||||||
const { TOKEN, ID } = process.env;
|
const { TOKEN, ID } = process.env;
|
||||||
//const commands = [];
|
//const commands = [];
|
||||||
|
@ -50,8 +51,8 @@ client.on(Events.MessageCreate, async interaction => {
|
||||||
sessions[id].stdout.on('data', (chunk) => {
|
sessions[id].stdout.on('data', (chunk) => {
|
||||||
if (chunk.toString().length > 1) {
|
if (chunk.toString().length > 1) {
|
||||||
let str = chunk.toString();
|
let str = chunk.toString();
|
||||||
str = str.replaceAll(id,`<@${id}>`);
|
str = str.replaceAll(id, `<@${id}>`);
|
||||||
interaction.channel.send(str);
|
(channels[id] || interaction.channel).send(str);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sessions[id].on('close', () => {
|
sessions[id].on('close', () => {
|
||||||
|
@ -59,6 +60,8 @@ client.on(Events.MessageCreate, async interaction => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channels[id] = interaction.channel;
|
||||||
|
|
||||||
let msgs = msg.split('\n');
|
let msgs = msg.split('\n');
|
||||||
|
|
||||||
setTimeout(async function () {
|
setTimeout(async function () {
|
||||||
|
|
Loading…
Reference in a new issue