v3.0 #145

Merged
Vylpes merged 44 commits from develop into main 2022-04-24 14:46:37 +01:00
3 changed files with 33 additions and 25 deletions
Showing only changes of commit acedbffdad - Show all commits

View file

@ -11,6 +11,7 @@ BOT_PREFIX=v!
BOT_VER=3.0
BOT_AUTHOR=Vylpes
BOT_DATE=28 Nov 2021
BOT_OWNERID=147392775707426816
CORE_VER=2.0.2

View file

@ -1,25 +0,0 @@
const { command } = require('vylbot-core');
const { MessageEmbed } = require('discord.js');
class evaluate extends command {
constructor() {
super("evaluate");
super.description = "Evaluates an expression";
super.category = "Administration";
super.requiredConfigs = "ownerid";
}
evaluate(context) {
if (context.message.author.id == context.client.config.eval.ownerid) {
const result = eval(context.arguments.join(" "));
const embed = new MessageEmbed()
.setDescription(result)
.setColor(0x3050ba);
context.message.channel.send(embed);
}
}
}
module.exports = evaluate;

32
src/commands/eval.ts Normal file
View file

@ -0,0 +1,32 @@
import { Command, ICommandContext } from "vylbot-core";
import ErrorEmbed from "../helpers/ErrorEmbed";
import PublicEmbed from "../helpers/PublicEmbed";
export default class Evaluate extends Command {
constructor() {
super();
super._category = "Owner";
}
public override execute(context: ICommandContext) {
if (context.message.author.id != process.env.BOT_OWNERID) {
return;
}
const stmt = context.args;
console.log(`Eval Statement: ${stmt.join(" ")}`);
try {
const result = eval(stmt.join(" "));
const embed = new PublicEmbed(context, "", result);
embed.SendToCurrentChannel();
}
catch (err: any) {
const errorEmbed = new ErrorEmbed(context, err);
errorEmbed.SendToCurrentChannel();
}
}
}