initial commit

This commit is contained in:
Ubuntu 2024-08-21 15:00:40 +00:00
commit eaec14f4fb
14 changed files with 1987 additions and 0 deletions

41
commands/catgpt.js Normal file
View file

@ -0,0 +1,41 @@
var meows = [
"mreow",
"miau",
"mewo",
"maow",
"mrow",
"mrao",
"meow",
"mew",
"nya",
];
var emoticons = [
":3",
"^w^",
"=^w^=",
"-w-",
":333"
];
async function execute(client, event) {
var reply = "";
for(let i = 0;i < Math.random() * 15; i++)
reply += " " + meows.random();
reply += "!".repeat(Math.random() * 5);
if(Math.random() > 0.5) {
reply += " " + emoticons.random();
}
await client.reply(event, reply);
}
export default {
command: "catgpt",
name: "catgpt",
usage: "[prompt]",
desc: "advanced NAI-based language meowdel",
execute
}

22
commands/eval.js Normal file
View file

@ -0,0 +1,22 @@
import { encode } from "html-entities";
import util from "util";
function execute(client, event, args) {
var c = "";
try {
var result = eval(args);
c = util.format(result).replaceAll(process.env.ACCESS_TOKEN, "*".repeat(process.env.ACCESS_TOKEN.length));
} catch(err) {
c = util.format(err);
}
client.reply(event, c, `<pre><code>${encode(c)}</code></pre>`);
}
export default {
command: "eval",
name: "eval",
usage: "<code>",
owner: true,
desc: "Run JS code and reply with the result",
execute
}

55
commands/help.js Normal file
View file

@ -0,0 +1,55 @@
import { encode } from "html-entities";
function execute(client, event, args) {
var name = args.toLowerCase();
var command = client.commands.filter(c=>(c.name.toLowerCase()==name || c.command.toLowerCase()==name))[0];
var module = client.modules.filter(m=>m.name.toLowerCase()==name)[0];
var specific = command ?? module ?? false;
if(args != "") {
if(!command && !module) {
client.reply(event, `Section "${args}" not found.\nRun "${process.env.PREFIX}help" for a list of commands and modules.`);
return;
}
if(module) {
var reply = module.name + "\n";
reply += module.desc;
var replyHTML = `<b>${encode(module.name)}</b><br>` +
`<i>${encode(module.desc)}</i>`;
client.reply(event, reply, replyHTML);
return;
}
var reply = command.name + "\n" +
command.desc + "\n\n" +
command.usage;
var replyHTML = `<b>${encode(command.name)}</b><br>` +
`<i>${encode(command.desc)}</i>` +
`<br><code>${encode(command.usage)}</code>`;
client.reply(event, reply, replyHTML);
return;
}
var reply = `commands: ${client.commands.map(m => m.name).join(", ")}\n` +
`modules: ${client.modules.map(m => m.name).join(", ")}\n` +
`run ${process.env.PREFIX}help <module/command> for more information.`;
var replyHTML = `commands: <code>${client.commands.map(m => encode(m.name)).join("</code>, <code>")}</code><br>` +
`modules: <code>${client.modules.map(m => encode(m.name)).join("</code>, <code>")}</code><br>` +
encode(`run ${process.env.PREFIX}help <module/command> for more information.`);
client.reply(event, reply, replyHTML);
}
export default {
command: "help",
name: "help",
desc: "show list of commands and modules",
execute
}

16
commands/info.js Normal file
View file

@ -0,0 +1,16 @@
function execute(client, event, args) {
var info = `${client.name}\n\n`;
info += `Commands: ${client.commands.length}\n`;
info += `Modules: ${client.commands.length}\n`;
info += `Prefix: ${process.env.PREFIX} (you can also mention the bot!)\n`;
info += `Owner: ${process.env.OWNER_ID}`;
client.reply(event, info);
}
export default {
command: "info",
name: "info",
desc: "show general info about the bot",
execute
}

13
commands/restart.js Normal file
View file

@ -0,0 +1,13 @@
import { exec } from "node:child_process";
function execute(client, event, args) {
exec("systemctl --user restart possumbot");
}
export default {
command: "restart",
name: "restart",
owner: true,
desc: "restarts the bot",
execute
}