Added leak and exec, moved from a config.json file to a .env file, other changes
This commit is contained in:
parent
ef071a39d4
commit
d661b58271
24 changed files with 216 additions and 58 deletions
|
@ -1,7 +1,6 @@
|
|||
// separate the client from app.js so we can call it later
|
||||
const { Client } = require("eris");
|
||||
const config = require("../config.json");
|
||||
const client = new Client(config.token, {
|
||||
const client = new Client(process.env.TOKEN, {
|
||||
defaultImageSize: 1024
|
||||
});
|
||||
module.exports = client;
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
// database stuff
|
||||
const mongoose = require("mongoose");
|
||||
const config = require("../config.json");
|
||||
mongoose.connect(config.mongoURL);
|
||||
mongoose.connect(process.env.MONGO);
|
||||
const guildSchema = new mongoose.Schema({
|
||||
id: String,
|
||||
tags: Map,
|
||||
prefix: String
|
||||
});
|
||||
const Guild = mongoose.model("Guild", guildSchema);
|
||||
/*const membersSchema = new mongoose.Schema({
|
||||
|
||||
});*/
|
||||
const xpSchema = new mongoose.Schema({
|
||||
id: String,
|
||||
members: Map,
|
||||
enabled: Boolean
|
||||
});
|
||||
const XP = mongoose.model("XP", xpSchema);
|
||||
|
||||
exports.guilds = Guild;
|
||||
exports.xp = XP;
|
|
@ -1,9 +1,8 @@
|
|||
// dbl api client
|
||||
const DBL = require("dblapi.js");
|
||||
const logger = require("./logger.js");
|
||||
const config = require("../config.json");
|
||||
const client = require("./client.js");
|
||||
const dbl = new DBL(config.dblToken, client);
|
||||
const dbl = new DBL(process.env.DBL, client);
|
||||
dbl.on("error", e => {
|
||||
logger.error(e);
|
||||
});
|
||||
|
|
|
@ -1,15 +1,39 @@
|
|||
// workaround for a gm bug where it doesn't output buffers properly
|
||||
// https://github.com/aheckmann/gm/issues/572#issuecomment-293768810
|
||||
module.exports = (data) => {
|
||||
module.exports = (data, format) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
data.stream((err, stdout, stderr) => {
|
||||
if (err) return reject(err);
|
||||
const chunks = [];
|
||||
stdout.on("data", (chunk) => { chunks.push(chunk); });
|
||||
// these are 'once' because they can and do fire multiple times for multiple errors,
|
||||
// but this is a promise so you'll have to deal with them one at a time
|
||||
stdout.once("end", () => { resolve(Buffer.concat(chunks)); });
|
||||
stderr.once("data", (data) => { reject(String(data)); });
|
||||
});
|
||||
if (format) {
|
||||
data.stream(format, (err, stdout, stderr) => {
|
||||
if (err) return reject(err);
|
||||
const chunks = [];
|
||||
stdout.on("data", (chunk) => {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
// these are 'once' because they can and do fire multiple times for multiple errors,
|
||||
// but this is a promise so you'll have to deal with them one at a time
|
||||
stdout.once("end", () => {
|
||||
resolve(Buffer.concat(chunks));
|
||||
});
|
||||
stderr.once("data", (data) => {
|
||||
reject(String(data));
|
||||
});
|
||||
});
|
||||
} else {
|
||||
data.stream((err, stdout, stderr) => {
|
||||
if (err) return reject(err);
|
||||
const chunks = [];
|
||||
stdout.on("data", (chunk) => {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
// these are 'once' because they can and do fire multiple times for multiple errors,
|
||||
// but this is a promise so you'll have to deal with them one at a time
|
||||
stdout.once("end", () => {
|
||||
resolve(Buffer.concat(chunks));
|
||||
});
|
||||
stderr.once("data", (data) => {
|
||||
reject(String(data));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -5,22 +5,21 @@ exports.random = (array) => {
|
|||
|
||||
// clean(text) to clean message of any private info or mentions
|
||||
exports.clean = async (text) => {
|
||||
const config = require("../config.json");
|
||||
if (text && text.constructor.name == "Promise")
|
||||
text = await text;
|
||||
if (typeof evaled !== "string")
|
||||
if (typeof text !== "string")
|
||||
text = require("util").inspect(text, { depth: 1 });
|
||||
|
||||
text = text
|
||||
.replace(/`/g, `\`${String.fromCharCode(8203)}`)
|
||||
.replace(/@/g, `@${String.fromCharCode(8203)}`)
|
||||
.replace(config.token, "<redacted>")
|
||||
.replace(config.mashapeKey, "<redacted>")
|
||||
.replace(config.catToken, "<redacted>")
|
||||
.replace(config.googleKey, "<redacted>")
|
||||
.replace(config.cseID, "<redacted>")
|
||||
.replace(config.dblToken, "<redacted>")
|
||||
.replace(config.mongoURL, "<redacted>");
|
||||
.replace(process.env.TOKEN, "<redacted>")
|
||||
.replace(process.env.MASHAPE, "<redacted>")
|
||||
.replace(process.env.CAT, "<redacted>")
|
||||
.replace(process.env.GOOGLE, "<redacted>")
|
||||
.replace(process.env.CSE, "<redacted>")
|
||||
.replace(process.env.DBL, "<redacted>")
|
||||
.replace(process.env.MONGO, "<redacted>");
|
||||
|
||||
return text;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue