my body is a machine that turns air into meow mrrpp
This commit is contained in:
parent
2235889ae8
commit
44a8e3f20f
7 changed files with 1237 additions and 39 deletions
66
src/marriage.ts
Normal file
66
src/marriage.ts
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
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<boolean>, 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}>`)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue