Polished eval and de-cached statuses on clear

master
Kit Kasune 4 years ago
parent f9da99060f
commit 40db8704da
  1. 2
      commands/clearstatus.js
  2. 13
      commands/eval.js

@ -1,5 +1,6 @@
const Discord = require('discord.js'); const Discord = require('discord.js');
const mongooes = require('mongoose'); const mongooes = require('mongoose');
const UserData = require('../models/user'); const UserData = require('../models/user');
module.exports = { module.exports = {
@ -15,6 +16,7 @@ module.exports = {
tu.statusmsg = ''; tu.statusmsg = '';
tu.statustype = ''; tu.statustype = '';
tu.save(); tu.save();
require('../util/siftstatuses')(client, message.author.id);
return message.reply("welcome back! I cleared your status."); return message.reply("welcome back! I cleared your status.");
} }
}; };

@ -1,15 +1,22 @@
const Discord = require('discord.js'); const Discord = require('discord.js');
const chalk = require('chalk'); const chalk = require('chalk');
const {Tag} = require('../util/tag');
const {TagFilter} = require('../util/tagfilter');
module.exports = { module.exports = {
name: 'eval', name: 'eval',
aliases: ['ev', ':', 'e'], aliases: ['ev', ':', 'e'],
help: "Evaluates raw JavaScript code. *This is a __developer-only__ command.* Usage: `{{p}}eval <code>`", help: "Evaluates raw JavaScript code. *This is a __developer-only__ command.* Usage: `{{p}}eval <code>`",
execute(message, msg, args, cmd, prefix, mention, client) { execute(message, msg, args, cmd, prefix, mention, client) {
try { try {
if (!client.developers.includes(message.author.id)) return; if (!client.developers.includes(message.author.id)) {return message.channel.send("Sorry, but I've got trust issues, so only me devs can go commanding me around like that.");};
if (!args.length) return message.channel.send(`Syntax: \`${prefix}eval <code>\``); if (!args.length) return message.channel.send(`Syntax: \`${prefix}eval <code>\``);
let options = new TagFilter([new Tag(['s', 'silent', 'nr', 'noreply'], 'silent', 'toggle')]).test(args[0]);
if (options.silent) {args.shift();}
if (!args.length) {return message.channel.send("Silly goose, if you want me to do something, you have to tell me what!");}
const result = new Promise((resolve) => resolve(eval(args.join(' ')))); const result = new Promise((resolve) => resolve(eval(args.join(' '))));
return result.then((output) => { return result.then((output) => {
if (typeof output !== 'string') { if (typeof output !== 'string') {
@ -19,7 +26,7 @@ module.exports = {
.replace(client.config.database.password, 'Database Password') .replace(client.config.database.password, 'Database Password')
.replace(client.config.database.cluster, 'Database Cluster'); .replace(client.config.database.cluster, 'Database Cluster');
return message.channel.send(new Discord.MessageEmbed() return options.silent ? null : message.channel.send(new Discord.MessageEmbed()
.setTitle('Client Evaluation') .setTitle('Client Evaluation')
.setDescription(`\`\`\`js\n${output}\n\`\`\``) .setDescription(`\`\`\`js\n${output}\n\`\`\``)
.setColor('c375f0') .setColor('c375f0')

Loading…
Cancel
Save