Merge pull request #10 from mudkipscience/dev

1.2.2
This commit is contained in:
Emily 2020-03-26 07:27:08 +00:00 committed by GitHub
commit f41d4ddd3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 70 additions and 32 deletions

View file

@ -2,6 +2,12 @@ const config = {
// ID's
"owners": [], // Adding your ID here will give you access to dangerous commands like eval. Please be careful with who you add here! Eval can be used to modify the host machine.
// Host options
"devmodeEnabled": false, // true or false
"loggingServer": "", // server ID, or blank to disable
"startupLogs": "", // Channel ID, or blank to disable
"consoleLogs": "", // Channel ID, or blank to disable
// Tokens
"token": "", // Your bot's token.
"devtoken": "", // (optional) another token, meant for a bot used for development

View file

@ -15,18 +15,21 @@ try {
console.log('Failed to load config.js:', err);
process.exit();
};
try{
client.version = require('./version.json');
} catch (err) {
console.log('Failed to load version.json:', err);
process.exit();
};
try{
client.logger = require('./src/modules/Logger');
} catch (err) {
console.log('Failed to load Logger.js:', err);
process.exit();
};
client.logger.setClient(client);
try{
@ -36,7 +39,7 @@ try{
process.exit();
};
if(process.env['USER'] != 'container') {
if(client.config.devmodeEnabled == true && process.env['USER'] != 'container') {
client.devmode = true;
} else {
client.devmode = false;

View file

@ -1,10 +1,4 @@
exports.run = async (client, message, args) => {
if(client.devmode === true) {
return message.channel.send(
"<:error:466995152976871434> This command has been disabled because Woomy is in development mode."
);
};
const settings = message.settings;
if (!client.settings.has(message.guild.id)) client.settings.set(message.guild.id, {});

View file

@ -14,7 +14,7 @@ exports.run = async (client, message, args) => {
};
exports.conf = {
enabled: true,
enabled: false,
guildOnly: false,
aliases: [],
permLevel: "User",

View file

@ -6,25 +6,45 @@ module.exports = client => {
client.lockActivity = false;
client.logger.log(`Connected to Discord as ${client.user.tag} | v${client.version.number}`, 'ready');
let channel, channel1;
let guild, channel, channel1;
if(client.config.loggingServer.length > 0) {
try {
channel = client.guilds.cache.get('410990517841690625').channels.cache.get('570963998342643732');
} catch(err) {};
guild = client.guilds.cache.get(client.config.loggingServer)
} catch(err) {
client.logger.error("Could not find loggingServer server (is the ID valid?):\n" + err);
process.exit(1);
};
if(client.config.consoleLogs.length > 0) {
try {
channel1 = client.guilds.cache.get('410990517841690625').channels.cache.get('570963481189154822');
} catch(err) {};
channel1 = client.guilds.cache.get(client.config.consoleLogs)
} catch(err) {
client.logger.error("Could not find consoleLogs channel (is the ID valid?):\n" + err);
process.exit(1);
};
};
if(client.config.startupLogs.length > 0) {
try {
channel = guild.channels.cache.get(client.config.startupLogs)
} catch(err) {
client.logger.error("Could not find startupLogs channel (is the ID valid?):\n" + err);
process.exit(1);
};
};
};
if(client.devmode == true) {
client.logger.warn("Running in development mode.")
prefix = client.config.defaultSettings.devprefix;
} else {
prefix = client.config.defaultSettings.prefix;
channel.send(`\`${timestamp}\`: Ready event fired! Connected to ${client.users.cache.size} users in ${client.guilds.cache.size} guilds.`);
channel1.send(`\`${timestamp}\`: **Ready event fired**`);
if(channel1) {
channel1.send(`Bot started at \`${timestamp}\``);
};
};
let randomActivity = activityArray.random();
@ -37,4 +57,6 @@ module.exports = client => {
client.user.setActivity(`${prefix + randomActivity} | v${client.version.number}`, {type: "PLAYING"});
};
}, 30000);
client.logger.log(`Connected to Discord as ${client.user.tag} | v${client.version.number}`, 'ready');
};

View file

@ -2,17 +2,25 @@ const chalk = require("chalk");
const moment = require("moment");
exports.log = (content, type = "log") => {
const timestamp = chalk.grey(`[${moment().format("YYYY-MM-DD HH:mm:ss")}]`);
const timestamp = `[${moment().format("YYYY-MM-DD HH:mm:ss")}]`;
let channel;
try { channel = client.guilds.cache.get('410990517841690625').channels.cache.get('570963481189154822'); } catch(err) {}
try {
channel = client.guilds.cache.get(client.config.loggingServer).channels.cache.get(client.config.consoleLogs);
} catch(err) {};
var logToServer = false;
if(client.devmode === false && channel && guild.available) {
logToServer = true;
};
switch (type) {
case "info": {
try {
if (client.devmode == false) {
channel.send(`\`${timestamp}\`: ` + content);
if (logToServer == true) {
channel.send(`\`${timestamp}\` \`[${type.toUpperCase()}]\` ` + content);
};
} catch(err) {};
return console.log(`${timestamp} ${chalk.cyanBright(`[${type.toUpperCase()}]`)} ${content} `);
@ -20,8 +28,8 @@ exports.log = (content, type = "log") => {
case "warn": {
try {
if (client.devmode == false) {
channel.send(`\`${timestamp}\`: ` + content);
if (logToServer == true) {
channel.send(`\`${timestamp}\` \`[${type.toUpperCase()}]\` ` + content);
};
} catch(err) {};
return console.log(`${timestamp} ${chalk.yellowBright(`[${type.toUpperCase()}]`)} ${content} `);
@ -29,8 +37,8 @@ exports.log = (content, type = "log") => {
case "error": {
try {
if (client.devmode == false) {
channel.send(`\`${timestamp}\`: ` + content);
if (logToServer == true) {
channel.send(`\`${timestamp}\` \`[${type.toUpperCase()}]\` ` + content);
};
} catch(err) {}
return console.log(`${timestamp} ${chalk.redBright(`[${type.toUpperCase()}]`)} ${content} `);
@ -38,8 +46,8 @@ exports.log = (content, type = "log") => {
case "debug": {
try {
if (client.devmode == false) {
channel.send(`\`${timestamp}\`: ` + content);
if (logToServer == true) {
channel.send(`\`${timestamp}\` \`[${type.toUpperCase()}]\` ` + content);
};
} catch(err) {};
return console.log(`${timestamp} ${chalk.magentaBright(`[${type.toUpperCase()}]`)} ${content} `);
@ -47,14 +55,19 @@ exports.log = (content, type = "log") => {
case "cmd": {
try {
if (client.devmode == false) {
channel.send(`\`${timestamp}\` ` + content);
if (logToServer == true) {
channel.send(`\`${timestamp}\` \`[${type.toUpperCase()}]\` ` + content);
};
} catch(err) {};
return console.log(`${timestamp} ${chalk.whiteBright(`[${type.toUpperCase()}]`)} ${content}`);
};
case "ready": {
try {
if (logToServer == true) {
channel.send(`\`${timestamp}\` \`[${type.toUpperCase()}]\` ` + content);
};
} catch(err) {};
return console.log(`${timestamp} ${chalk.greenBright (`[${type.toUpperCase()}]`)} ${content}`);
};

View file

@ -1,4 +1,4 @@
{
"number": "1.2.1",
"number": "1.2.2",
"changelog": "**1.2.0 CHANGELOG:**\n> • Added action commands! (`cuddle`, `feed`, `hug`, `kiss`, `pat`, `poke`, `slap`, `smug`, `tickle`)\n> • Added `fact`\n> • Added `catfact`\n> • Added `dogfact`\n> • Added `yoda`\n> • Added `dice`\n> • Added `spoilerise`\n> • Added `zalgo`\n> • Added `dog`\n> • Added `cat`\n> • Added `lizard`\n> • Added `neko`\n> • Added `nekogif`\n> • Added `kemonomimi`\n> • Added `foxgirl`\n> • Added `identity`\n> • Added `pronouns`\n> • Added `sexuality`\n> • Added `ship`\n> • Renamed `flip to `coinflip` (flip remains as an alias)\n> • Renamed `math` to `calculate` (math is an alias)\n> • @Woomy is now a prefix\n> • Added the `inspire` alias to `inspirobot`\n> • Help now displays the amount of commands in each category\n> • Bots now get a badge in `userinfo`\n> • `roleinfo` now displays what permissions a role has\n> • small changes to `weather`\n> • Woomy now has clear logging of issues that prevent her from starting\n> • request npm module has been swapped out for node-fetch\n**NOTES:**\n> Thank you to Terryiscool160 for creating multiple commands used in this update"
}