summary refs log tree commit diff
path: root/commands/eval.js
diff options
context:
space:
mode:
Diffstat (limited to 'commands/eval.js')
-rw-r--r--commands/eval.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/commands/eval.js b/commands/eval.js
new file mode 100644
index 0000000..e73c9bc
--- /dev/null
+++ b/commands/eval.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2024 Emilia Luminé <eqilia@national.shitposting.agency>
+ * This file is a part of the Shamestech bot.
+ * 
+ * The Shamestech bot is free software: you can redistribute it and/or modify it
+ * under the terms of the European Union Public License as published by
+ * by the European Union, only the version 1.2 of the License.
+ * 
+ * The Shamestech bot is distributed in the hope that it will be useful
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+ * European Union Public License for more details.
+ * 
+ * You should have received a copy of the European Union Public License, If not
+ * see <https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12>
+*/
+
+const util = require('node:util');
+
+module.exports = {
+	name: 'eval',
+	hidden: true,
+	async execute(message, args) {
+		const prompt = args.join(' ');
+		let out = '';
+
+		if (message.author.id !== "1425229394703683614") {
+			return;
+		}
+
+		try {
+			out = util.inspect(await eval(prompt));
+		} catch (e) {
+			out = `${e}`;
+		}
+		
+		return await message.reply({
+			content: `${out.length === 0 ? 'empty' : out}`
+		});
+	}
+}
+