im just that retarded

This commit is contained in:
amy 2024-11-04 15:06:13 +03:30
parent 10a8c12ce1
commit 0d68c8c1e8
No known key found for this signature in database

View file

@ -1,6 +1,7 @@
import {Client, DMChannel, Events, GatewayIntentBits, Message, OmitPartialGroupDMChannel} from "discord.js";
import config from "../config.json" with {type: "json"};
import Database from 'better-sqlite3';
const client = new Client({
intents: Object.keys(GatewayIntentBits).map((a) => {
return GatewayIntentBits[a]
@ -19,6 +20,7 @@ db.exec(`
string_list TEXT CHECK (json_array_length(string_list) <= 3)
)
`);
function addOrUpdate(id: string, secondId: string): boolean | "duplicate" {
const stmt = db.prepare('SELECT * FROM strikes WHERE id = ?');
const row = stmt.get(id) as TableRow | undefined;
@ -57,7 +59,7 @@ async function strike(message: OmitPartialGroupDMChannel<Message<boolean>>) {
if (repliedmember.roles.cache.has(config.strikerroleid)) return;
let result: boolean | "duplicate";
try {
result = addOrUpdate(message.author.id, repliedmessage.author.id)
result = addOrUpdate(repliedmessage.author.id, message.author.id)
} catch (e) {
message.reply('user SHOULD be already banned,,, idk lmao');
return;