Last active
February 2, 2025 06:54
-
-
Save weskerty/b1547a15f59e554d78620b781318b43b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original: https://gist.github.com/adityaparsad01/454bfaee41fd8eab580b2a3d1cb3aba6 | |
const lib = require("../lib"); | |
const { exec } = require("child_process"); | |
lib.bot( | |
{ | |
pattern: "cmd ?(.*)", | |
fromMe: true, | |
desc: "get linux machine", | |
type: "machine" | |
}, | |
async (message, match) => { | |
const command = match || "ls"; | |
exec(command, (error, stdout, stderr) => { | |
const response = `${stdout.trim() || ""}\n` + | |
`⚠️${stderr.trim() || ""}\n` + | |
`❌ ${error ? error.message : ""}`; | |
return message.send(response); | |
}); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment