This repository has been archived on 2026-06-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
chipmunkbot3/plugins/function.js
T
2024-02-11 21:23:41 -05:00

15 lines
432 B
JavaScript

const fs = require('fs')
function inject (bot) {
bot.runFunction = function (filepath) {
const commands = fs.readFileSync(filepath).toString().replace(/\r\n?/g, '\n').split('\n')
let i = 0
const interval = setInterval(() => {
if (!commands[i]?.startsWith('#')) { bot.exploits.execute('run ' + commands[i]) }
if (++i > commands.length) { clearInterval(interval) }
}, 50)
}
}
module.exports = inject