summary refs log tree commit diff
path: root/commands/sql.js
diff options
context:
space:
mode:
authorAmygdala Peanut-Almond <amygdala@almond.desloratadyna.net>2026-04-22 22:49:01 +0200
committerAmygdala Peanut-Almond <amygdala@almond.desloratadyna.net>2026-04-22 22:49:01 +0200
commit3572b97661a3f7c6c29e958b63c20d9f2ef936ac (patch)
treeb3ee056039cf792edd467e5172feee25a07dd56c /commands/sql.js
initialise repository
Signed-off-by: Amygdala Peanut-Almond <amygdala@almond.desloratadyna.net>
Diffstat (limited to 'commands/sql.js')
-rw-r--r--commands/sql.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/commands/sql.js b/commands/sql.js
new file mode 100644
index 0000000..78aeb02
--- /dev/null
+++ b/commands/sql.js
@@ -0,0 +1,65 @@
+/*
+ * 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');
+
+function _plushie(object) {
+	let loopie = Object.keys(object);
+	let out = "";
+
+	for (let i = 0; i < loopie.length; i++) {
+		out = `${out}${loopie[i]}: ${object[loopie[i]]}; `
+	}
+	out = `${out}`
+
+	return out;
+}
+
+function plushie(arrie) {
+	let out = '';
+
+	for (let i = 0; i < arrie.length; i++) {
+		out = `${out}\n${_plushie(arrie[i])}`;
+	}
+
+	return out;
+}
+
+module.exports = {
+	name: 'sql',
+	hidden: true,
+	async execute(message, args) {
+		const prompt = args.join(' ');
+		let out = '';
+
+		if (message.author.id !== "1425229394703683614") {
+			return;
+		}
+
+		try {
+			const query = await database.query(prompt);
+			out = `${plushie(query)}`;
+		} catch (e) {
+			out = `${e}`;
+		}
+		
+		return await message.reply({
+			content: `${out}`
+		});
+	}
+}
+