mirror of
https://github.com/Expand-sys/ccashbot
synced 2025-12-16 23:52:14 +11:00
yeet
This commit is contained in:
parent
94a4af2dd8
commit
256e2c0b18
12 changed files with 187 additions and 1307 deletions
|
|
@ -1,14 +0,0 @@
|
||||||
const { checkbal } = require("../../helpers/ccash");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
name: "checkbal",
|
|
||||||
description: "check your ccash balance",
|
|
||||||
async execute(message, args) {
|
|
||||||
let bal = await checkbal(message.author, args[0]);
|
|
||||||
if (bal == -1) {
|
|
||||||
message.reply("User not found");
|
|
||||||
} else {
|
|
||||||
message.reply(bal.toString() + " CCash");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
const { link } = require("../../helpers/ccash");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
name: "link",
|
|
||||||
description: "link your ccash account",
|
|
||||||
async execute(message, args) {
|
|
||||||
if (!args[0] || !args[1]) {
|
|
||||||
message.reply("You need to enter arguments for this command to work");
|
|
||||||
}
|
|
||||||
let result = await link(message.author, args[0], args[1]);
|
|
||||||
console.log(result);
|
|
||||||
if (result == true) {
|
|
||||||
message.reply(
|
|
||||||
"Linked your discord account to user " + args[0] + " successfully"
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
message.reply("Could not verify your CCash user, please check spelling");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
const googleIt = require("google-it");
|
|
||||||
const Discord = require('discord.js');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
name: 'google',
|
|
||||||
description: 'Google shit or something',
|
|
||||||
execute(message, args) {
|
|
||||||
let query = ''
|
|
||||||
for(i in args){
|
|
||||||
query += args[i]+' '
|
|
||||||
}
|
|
||||||
console.log(query)
|
|
||||||
|
|
||||||
googleIt({'limit': 1, 'query': query, 'disableConsole':'true'}).then(results => {
|
|
||||||
const embed = new Discord.MessageEmbed()
|
|
||||||
.setColor('#0099ff')
|
|
||||||
.setTitle(results[0].title)
|
|
||||||
.setURL(results[0].link)
|
|
||||||
.setDescription(results[0].snippet)
|
|
||||||
message.reply(embed)
|
|
||||||
}).catch(e => {
|
|
||||||
// any possible errors that might have occurred (like no Internet connection)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
const leet = require("../../helpers/leetspeak");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
name: 'leet',
|
|
||||||
description: 'leet speak translator',
|
|
||||||
async execute(message, args) {
|
|
||||||
var text = ''
|
|
||||||
for(i in args){
|
|
||||||
text += args[i]+' '
|
|
||||||
}
|
|
||||||
text = text.slice(0, text.length-1)
|
|
||||||
console.log(text)
|
|
||||||
let output = await leet.convertInput(text)
|
|
||||||
message.reply(output)
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
name: 'kick',
|
|
||||||
description: 'Tag a member and kick them (but not really).',
|
|
||||||
guildOnly: true,
|
|
||||||
permissions: 'KICK_MEMBERS',
|
|
||||||
execute(message) {
|
|
||||||
if (!message.mentions.users.size) {
|
|
||||||
return message.reply('you need to tag a user in order to kick them!');
|
|
||||||
}
|
|
||||||
|
|
||||||
const taggedUser = message.mentions.users.first();
|
|
||||||
|
|
||||||
message.channel.send(`You wanted to kick: ${taggedUser.username}`);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -19,11 +19,20 @@ module.exports = {
|
||||||
console.log("host");
|
console.log("host");
|
||||||
const rcon = new Rcon({
|
const rcon = new Rcon({
|
||||||
host: `${host}`,
|
host: `${host}`,
|
||||||
port: 25575,
|
port: `${process.env.RCON_PORT}`,
|
||||||
password: `${rconpass}`,
|
password: `${rconpass}`,
|
||||||
});
|
});
|
||||||
|
let connected = true
|
||||||
|
let error
|
||||||
|
try{
|
||||||
|
await rcon.connect();
|
||||||
|
} catch(e){
|
||||||
|
console.log(e)
|
||||||
|
connected = false
|
||||||
|
error = e
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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 speech = content.split("say ");
|
let speech = content.split("say ");
|
||||||
|
|
@ -31,10 +40,15 @@ module.exports = {
|
||||||
speech = content.split("say ");
|
speech = content.split("say ");
|
||||||
speech[0] = `say ${message.author.username}: ${speech[1]} `;
|
speech[0] = `say ${message.author.username}: ${speech[1]} `;
|
||||||
}
|
}
|
||||||
let res = await rcon.send(`${speech[0]}`);
|
if (connected == true){
|
||||||
|
let res = await rcon.send(`${speech[0]}`);
|
||||||
message.reply(`Sent Command ${content}: ${res}`);
|
message.reply(`Sent Command ${content}: ${res}`);
|
||||||
rcon.end();
|
rcon.end();
|
||||||
|
} else {
|
||||||
|
message.reply(`${error}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
const fs = require("fs");
|
|
||||||
const got = require("got");
|
|
||||||
|
|
||||||
const { spawn } = require("child_process");
|
|
||||||
let minecraftloc = process.env.MINECRAFTLOC;
|
|
||||||
module.exports = {
|
|
||||||
name: "start",
|
|
||||||
description: "start mc server",
|
|
||||||
guildOnly: true,
|
|
||||||
permissions: "KICK_MEMBERS",
|
|
||||||
async execute(message, args) {
|
|
||||||
let channel = message.guild.channels.cache.get(process.env.CONSOLECHAN);
|
|
||||||
spawnMC(channel);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
function spawnMC(channel) {
|
|
||||||
let options = {
|
|
||||||
shell: true,
|
|
||||||
cwd: `${minecraftloc}`,
|
|
||||||
};
|
|
||||||
const minecraft = spawn(
|
|
||||||
"java",
|
|
||||||
["-Xmx24G", "-Xms1024M", "-jar", "server.jar", "-nogui"],
|
|
||||||
options
|
|
||||||
);
|
|
||||||
minecraft.stdout.on("data", (data) => {
|
|
||||||
try {
|
|
||||||
channel.send(`${data}`);
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
minecraft.stderr.on("data", (data) => {
|
|
||||||
try {
|
|
||||||
channel.send(`${data}`);
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
minecraft.on("close", (code) => {
|
|
||||||
console.log(`child process exited with code ${code}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -13,12 +13,12 @@ module.exports = {
|
||||||
permissions: "SEND_MESSAGES",
|
permissions: "SEND_MESSAGES",
|
||||||
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 your username you want to whitelist");
|
||||||
} else {
|
} else {
|
||||||
console.log(host);
|
console.log(host);
|
||||||
const rcon = new Rcon({
|
const rcon = new Rcon({
|
||||||
host: `${host}`,
|
host: `${host}`,
|
||||||
port: 25575,
|
port: `${process.env.RCONPASS}`,
|
||||||
password: `${rconpass}`,
|
password: `${rconpass}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
const db = require("quick.db");
|
|
||||||
const got = require("got");
|
|
||||||
api = process.env.CCASHAPIURL;
|
|
||||||
async function link(disc, userpass) {
|
|
||||||
let verified = await got.post(process.env.CCASHAPIURL + "BankF/vpass", {
|
|
||||||
json: {
|
|
||||||
name: user,
|
|
||||||
attempt: pass,
|
|
||||||
},
|
|
||||||
responseType: "json",
|
|
||||||
});
|
|
||||||
if (verified.body.value == 1) {
|
|
||||||
console.log("verified");
|
|
||||||
if (db.get("links", { discorduser: disc.id }).ccashuser != user) {
|
|
||||||
db.delete("links", {
|
|
||||||
discorduser: disc.id,
|
|
||||||
});
|
|
||||||
db.push("links", {
|
|
||||||
discorduser: disc.id,
|
|
||||||
ccashuser: user,
|
|
||||||
attempt: pass,
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
db.push("links", {
|
|
||||||
discorduser: disc.id,
|
|
||||||
ccashuser: user,
|
|
||||||
attempt: pass,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
async function checkbal(disc, user) {
|
|
||||||
if (user != undefined) {
|
|
||||||
balance = await got(`${api}/user/balance`, {
|
|
||||||
headers: {
|
|
||||||
Accept: "application/json",
|
|
||||||
},
|
|
||||||
searchParams: {
|
|
||||||
name: user,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
balance = parseInt(balance.body);
|
|
||||||
return balance;
|
|
||||||
} else {
|
|
||||||
let usernm = db.get("links").filter((a) => a.discorduser == disc.id)[0]
|
|
||||||
.ccashuser;
|
|
||||||
console.log(usernm);
|
|
||||||
balance = await got(`${api}/user/balance`, {
|
|
||||||
headers: {
|
|
||||||
Accept: "application/json",
|
|
||||||
},
|
|
||||||
searchParams: {
|
|
||||||
name: usernm,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
balance = parseInt(balance.body);
|
|
||||||
return balance;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(balance);
|
|
||||||
}
|
|
||||||
module.exports = { link, checkbal };
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
const alphabetBasic = {
|
|
||||||
'a': '4',
|
|
||||||
'b': '8',
|
|
||||||
'e': '3',
|
|
||||||
'f': 'f',
|
|
||||||
'g': '6', // or 9
|
|
||||||
'i': '1', // or |
|
|
||||||
'o': '0',
|
|
||||||
's': '5',
|
|
||||||
't': '7' // or +
|
|
||||||
}
|
|
||||||
|
|
||||||
const alphabetAdvanced = {
|
|
||||||
'c': '(', // or k or |< or /<
|
|
||||||
'd': '<|',
|
|
||||||
'h': '|-|',
|
|
||||||
'k': '|<', // or /<
|
|
||||||
'l': '|', // or 1
|
|
||||||
'm': '|\\/|',
|
|
||||||
'n': '|\\|',
|
|
||||||
'p': '|2',
|
|
||||||
'u': '|_|',
|
|
||||||
'v': '/', // or \/
|
|
||||||
'w': '//', // or \/\/
|
|
||||||
'x': '><',
|
|
||||||
'y': '\'/'
|
|
||||||
}
|
|
||||||
|
|
||||||
const alphabetReversed = [
|
|
||||||
[/(\|\\\/\|)/g, 'm'],
|
|
||||||
[/(\|\\\|)/g, 'n'],
|
|
||||||
[/(\()/g, 'c'],
|
|
||||||
[/(<\|)/g, 'd'],
|
|
||||||
[/\|-\|/g, 'h'],
|
|
||||||
[/(\|<)/g, 'k'],
|
|
||||||
[/(\|2)/g, 'p'],
|
|
||||||
[/(\|_\|)/g, 'u'],
|
|
||||||
[/(\/\/)/g, 'w'],
|
|
||||||
[/(><)/g, 'x'],
|
|
||||||
[/(\|)/g, 'l'],
|
|
||||||
[/(\'\/)/g, 'y'],
|
|
||||||
[/(\/)/g, 'v'],
|
|
||||||
[/(1)/g, 'i'],
|
|
||||||
[/(0)/g, 'o'],
|
|
||||||
[/(3)/g, 'e'],
|
|
||||||
[/(4)/g, 'a'],
|
|
||||||
[/(5)/g, 's'],
|
|
||||||
[/(6)/g, 'g'],
|
|
||||||
[/(7)/g, 't'],
|
|
||||||
[/(8)/g, 'b'],
|
|
||||||
[/(ph)/g, 'f'],
|
|
||||||
]
|
|
||||||
|
|
||||||
// Convert input into l33t
|
|
||||||
const convertInput = (text, useAdvanced = 'n') => {
|
|
||||||
for (let i = 0; i < text.length; i++) {
|
|
||||||
let alphabet
|
|
||||||
let letter = text[i].toLowerCase()
|
|
||||||
|
|
||||||
if (useAdvanced.toLowerCase() === 'y') {
|
|
||||||
// Use advanced l33t speak alphabet
|
|
||||||
alphabet = alphabetBasic[letter] ? alphabetBasic[letter] : alphabetAdvanced[letter]
|
|
||||||
} else {
|
|
||||||
// Use basic l33t speak alphabet
|
|
||||||
alphabet = alphabetBasic[letter]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alphabet) {
|
|
||||||
text = text.replace(text[i], alphabet)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show the result in console
|
|
||||||
console.log(text)
|
|
||||||
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const convertInputReverse = (text) => {
|
|
||||||
text = text.toLowerCase()
|
|
||||||
|
|
||||||
alphabetReversed.map((x) => {
|
|
||||||
text = text.replace(x[0], x[1])
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log(text)
|
|
||||||
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = { convertInput, convertInputReverse }
|
|
||||||
1168
package-lock.json
generated
1168
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "http://10.10.4.20:3000/HarrisonDubois/discordbot.git"
|
"url": "https://github.com/Expand-sys/ccashbot"
|
||||||
},
|
},
|
||||||
"author": "Expand",
|
"author": "Expand",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
"file-type": "^16.5.0",
|
"file-type": "^16.5.0",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
"get-pixels": "^3.3.2",
|
"get-pixels": "^3.3.2",
|
||||||
"google-it": "^1.6.2",
|
|
||||||
"got": "^11.8.2",
|
"got": "^11.8.2",
|
||||||
"minecraft-server-util": "^3.5.2",
|
"minecraft-server-util": "^3.5.2",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue