adding exit
This commit is contained in:
parent
61a7e442c9
commit
0ba92e4b60
@ -8,6 +8,7 @@ async function AIRequest(prompt) {
|
||||
.post('https://codex-ai-v9q6.onrender.com/')
|
||||
.headers({ 'Accept': 'application/json', 'Content-Type': 'application/json' })
|
||||
.send({ "prompt": prompt })
|
||||
console.log(AIRequest.body.bot)
|
||||
return AIRequest.body.bot
|
||||
}
|
||||
|
||||
|
12
sshChat.js
12
sshChat.js
@ -58,6 +58,7 @@ for (const file of commandFiles) {
|
||||
async function handleCommand(input) {
|
||||
if (input.startsWith("!") || input.startsWith(">")) {
|
||||
const command = input.split(" ")
|
||||
if (!command) return consoile.log("Please either send a message or enter a command.")
|
||||
switch (command[0]) {
|
||||
case "!":
|
||||
AIRequest(command.slice(1).join(" "))
|
||||
@ -84,6 +85,15 @@ async function handleCommand(input) {
|
||||
case ">login":
|
||||
login(command[1], conns, MYKEY)
|
||||
break;
|
||||
case ">exit":
|
||||
console.log("Sending close message...")
|
||||
for (let conn of conns) {
|
||||
conn.write(`CLOSED: ${publicKey.toString('hex')}`)
|
||||
}
|
||||
|
||||
await sleep(2000)
|
||||
process.exit()
|
||||
break
|
||||
default:
|
||||
console.log("Command not found.")
|
||||
}
|
||||
@ -163,7 +173,7 @@ setTimeout(() => {
|
||||
discovery.flushed().then(() => {
|
||||
console.log(`joined topic: ${b4a.toString(topic, 'hex')}\n(Share this key to others so they may join.)`)
|
||||
console.log('You are now in a chatroom for your topic, feel free to chat.\n')
|
||||
console.log('Want to login to the SSH.SURF API? Type ">login [APIKEY]" to login.\nPease close using CTRL+C\n')
|
||||
console.log('Want to login to the SSH.SURF API? Type ">login [APIKEY]" to login.\nPease close using CTRL+X or use the >exit command\n')
|
||||
})
|
||||
}, 1000);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user