import { Message } from "discord.js"; import sqlite3 from "sqlite3"; import { getid, getpartner, isValidID } from "./dbhelper.ts"; import { Person } from "./types.ts"; export function handlemarriage(message: Message, db: sqlite3.Database) { const command = message.content.replaceAll("!fag ", "").split(" ") // if (message[0] === "propose") { // if (hasPartner) // } if (command[0] === "forcemarry") { let husband: string; let wife: string; console.log(command.slice(1)) if (command.slice(1).length == 2) { husband = getid(command[1]) wife = getid(command[2]) console.log("guh") } else if (command.slice(1).length === 1) { console.log("guh2") husband = getid(message.author) wife = getid(command[1]) } if (isValidID(husband, wife)) { db.run(` INSERT INTO users (id, partner) VALUES ((?),(?)) `, [wife, husband], (err) => { if (err) { message.reply("SQL error. Most likely from echo. Make sure to spam ping her. - " + err); } else { message.reply("Update successful."); } }); } else { message.reply("SyntaxError: `error that is passed when im too lazy to set the error`" + wife + " - " + husband) } } else if (command[0] == "getmarriagestatus") { let person: string; try { person = command[1] } catch (err) { message.reply("SyntaxError: `error that is passed when im too lazy to set the error`") return } getpartner(db, person).then((a) => { if (typeof a === "string") { message.reply(a) } else if (!a.length) { message.reply("this mf is single lmaoooooo") } else { const bettera = (a as Person[]) if (bettera[0].id == person) { console.log(bettera[0].partner) message.reply(`@silent the personal fag of this person is <@${bettera[0].partner}>`) } else { console.log(bettera[0].id) message.reply(`@silent the personal fag of this person is <@${bettera[0].id}>`) } } }) } }