whitelist command and made app as a whole more portable

This commit is contained in:
Expand-sys 2021-10-19 09:26:04 +11:00
parent 4c344be737
commit 468b10443f
5 changed files with 42 additions and 23 deletions

View file

@ -6,9 +6,9 @@ module.exports = {
async execute(message, args) { async execute(message, args) {
let bal = await checkbal(message.author, args[0]); let bal = await checkbal(message.author, args[0]);
if (bal == -1) { if (bal == -1) {
message.reply("User not found fucko"); message.reply("User not found");
} else { } else {
message.reply(bal.toString() + " piss points"); message.reply(bal.toString() + " CCash");
} }
}, },
}; };

View file

@ -6,29 +6,28 @@ const { spawn } = require("child_process");
module.exports = { module.exports = {
name: "mc", name: "mc",
description: "send a mc command", description: "send a Minecraft command",
guildOnly: true, guildOnly: true,
permissions: "SEND_MESSAGES", permissions: `${process.env.MCACCESS}`,
async execute(message, args) { async execute(message, args) {
if (!args) { if (!args) {
return message.reply("OI you need to specify the command you want"); return message.reply("OI you need to specify the command you want");
} else { } else {
const rcon = new Rcon({ const rcon = new Rcon({
host: "mc.expand.gay", host: `${host}`,
port: 25575, port: 25575,
password: "6pnyf2DsCfHV67d3", password: `${rconpass}`,
}); });
await rcon.connect(); await rcon.connect();
let content = message.content.substring(message.content.indexOf(" ") + 1); let content = message.content.substring(message.content.indexOf(" ") + 1);
console.log(content); console.log(content);
let fuck = content.split("say "); let speech = content.split("say ");
if (args[0] == "say") { if (args[0] == "say") {
fuck = content.split("say "); speech = content.split("say ");
fuck[0] = `say ${message.author.username}: ${fuck[1]} `; speech[0] = `say ${message.author.username}: ${speech[1]} `;
} }
console.log(fuck); let res = await rcon.send(`${speech[0]}`);
let res = await rcon.send(`${fuck[0]}`);
message.reply(`Sent Command ${content}: ${res}`); message.reply(`Sent Command ${content}: ${res}`);
rcon.end(); rcon.end();

View file

@ -0,0 +1,30 @@
const fs = require("fs");
const got = require("got");
const { Rcon } = require("rcon-client");
const { spawn } = require("child_process");
module.exports = {
name: "whitelist",
description: "Whitelist yourself",
guildOnly: true,
permissions: "SEND_MESSAGES",
async execute(message, args) {
if (!args) {
return message.reply("OI you need to specify the command you want");
} else {
const rcon = new Rcon({
host: `${host}`,
port: 25575,
password: `${rconpass}`,
});
await rcon.connect();
let content = message.content.split("!whitelist ")[1];
let res = await rcon.send(`whitelist add ${content}`);
message.reply(`whitelisted `);
rcon.end();
}
},
};

View file

@ -1,12 +0,0 @@
module.exports = {
name: 'args-info',
description: 'Information about the arguments provided.',
args: true,
execute(message, args) {
if (args[0] === 'foo') {
return message.channel.send('bar');
}
message.channel.send(`First argument: ${args[0]}`);
},
};

View file

@ -10,6 +10,8 @@ const dotenv = require("dotenv");
dotenv.config(); dotenv.config();
const prefix = process.env.PREFIX; const prefix = process.env.PREFIX;
const rconpass = process.env.RCONPASS;
const host = process.env.HOST;
const client = new Client({ const client = new Client({
intents: [ intents: [