aozhiwei f86fdac6fe 1
2022-04-01 23:07:15 +08:00

20 lines
430 B
JavaScript

const app = require('j7/app');
const cmdHash = {};
async function execCmd(session) {
const cmdLine = session.request('cmd').split('.');
const cmd = cmdLine[0];
const params = cmdLine.length > 1 ? [] : cmdLine.slice(1);
if (cmdHash[cmd]) {
cmdHash[cmd](session, params);
} else {
session.rspErr(404, 'not found');
}
}
function init() {
app.registerHandler('GM', 'execCmd', execCmd);
}
exports.init = init;