forked from yusufusta/WhatsAsena
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluators.js
28 lines (21 loc) · 1.05 KB
/
evaluators.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Copyright (C) 2020 Yusuf Usta.
Licensed under the GPL-3.0 License;
you may not use this file except in compliance with the License.
WhatsAsena - Yusuf Usta
*/
const Asena = require('../events');
const {MessageType} = require('@adiwajshing/baileys');
const exec = require('child_process').exec;
const os = require("os");
const Language = require('../language');
const Lang = Language.getString('evaluators');
Asena.addCommand({pattern: 'term ?(.*)', fromMe: true, desc: Lang.TERM_DESC, usage: '.term ls'}, (async (message, match) => {
var user = os.userInfo().username;
if (match[1] === '') return await message.client.sendMessage(message.jid,Lang.GIVE_ME_CODE,MessageType.text);
exec(match[1], async (err, stdout, stderr) => {
if (err) {
return await message.client.sendMessage(message.jid,'```' + user + ':~# ' + match[1] + '\n' + err + '```',MessageType.text);
}
return await message.client.sendMessage(message.jid,'```' + user + ':~# ' + match[1] + '\n' + stdout + '```',MessageType.text);
});
}));