Remove the pebblisp code feature
This commit is contained in:
parent
be0b49393f
commit
dcabca0c1a
|
@ -1677,50 +1677,6 @@ command(
|
|||
|
||||
const exec = require('child_process').exec
|
||||
const { createReadStream } = require('fs')
|
||||
command(
|
||||
['!pl'],
|
||||
'!pl `code`\n\n' +
|
||||
'A very very stupid lisp implementation.',
|
||||
async ({ event, say }) => {
|
||||
return
|
||||
let code = ' (def sys 0)'// = '(def iLoveHvacker "9jklFUlbnd38bCrrU9765FhN") '
|
||||
code += event.text.substring(4)
|
||||
.replace(/`/g, '')
|
||||
.replace(/</g, '<')
|
||||
code += ' '
|
||||
// console.log('PL CODE:', code)
|
||||
|
||||
//const fileName = '/home/sagevaillancourt/git/hvacker/pl/' + event.user + (new Date().toLocaleString().replace(/[^a-z0-9]/gi, '_'))
|
||||
//fs.writeFileSync(fileName, code)
|
||||
|
||||
const command = `/home/sagevaillancourt/projects/pebblisp/src/pl '${code}'`
|
||||
console.log('pl command:', command)
|
||||
const child = exec(command)
|
||||
let result = '```\n'
|
||||
let errors = ''
|
||||
child.stdout.on('data', data => (result += data.replace(/\[\d+m/g, '')))
|
||||
child.stderr.on('data', data => {
|
||||
result += `\nERR:${data}\n`
|
||||
errors += `\nERR:${data}`
|
||||
})
|
||||
const maxLines = 25
|
||||
const maxChar = 2000
|
||||
child.on('close', async () => {
|
||||
// fs.rmSync(fileName)
|
||||
const lines = result.split('\n')
|
||||
let err = '\n'
|
||||
if (lines.length > maxLines) {
|
||||
result = lines.slice(0, maxLines).join('\n') + '\n...'
|
||||
err += `Output exceeds ${maxLines} lines and was truncated.\n`
|
||||
}
|
||||
if (result.length > maxChar) {
|
||||
result = result.substring(0, maxChar)
|
||||
err += `\nOutput also exceeds ${maxChar} characters and was truncated further...\n`
|
||||
}
|
||||
result += '```' + err + (errors && 'stderr:\n```\n' + errors.substring(0, 200) + '```')
|
||||
await say(result)
|
||||
})
|
||||
}, adminOnly)
|
||||
|
||||
command(
|
||||
['!steal', '!sagesteal'],
|
||||
|
|
Loading…
Reference in New Issue