im just that retarded
This commit is contained in:
parent
10a8c12ce1
commit
0d68c8c1e8
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
import {Client, DMChannel, Events, GatewayIntentBits, Message, OmitPartialGroupDMChannel} from "discord.js";
|
import {Client, DMChannel, Events, GatewayIntentBits, Message, OmitPartialGroupDMChannel} from "discord.js";
|
||||||
import config from "../config.json" with {type: "json"};
|
import config from "../config.json" with {type: "json"};
|
||||||
import Database from 'better-sqlite3';
|
import Database from 'better-sqlite3';
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: Object.keys(GatewayIntentBits).map((a) => {
|
intents: Object.keys(GatewayIntentBits).map((a) => {
|
||||||
return GatewayIntentBits[a]
|
return GatewayIntentBits[a]
|
||||||
|
@ -19,6 +20,7 @@ db.exec(`
|
||||||
string_list TEXT CHECK (json_array_length(string_list) <= 3)
|
string_list TEXT CHECK (json_array_length(string_list) <= 3)
|
||||||
)
|
)
|
||||||
`);
|
`);
|
||||||
|
|
||||||
function addOrUpdate(id: string, secondId: string): boolean | "duplicate" {
|
function addOrUpdate(id: string, secondId: string): boolean | "duplicate" {
|
||||||
const stmt = db.prepare('SELECT * FROM strikes WHERE id = ?');
|
const stmt = db.prepare('SELECT * FROM strikes WHERE id = ?');
|
||||||
const row = stmt.get(id) as TableRow | undefined;
|
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;
|
if (repliedmember.roles.cache.has(config.strikerroleid)) return;
|
||||||
let result: boolean | "duplicate";
|
let result: boolean | "duplicate";
|
||||||
try {
|
try {
|
||||||
result = addOrUpdate(message.author.id, repliedmessage.author.id)
|
result = addOrUpdate(repliedmessage.author.id, message.author.id)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
message.reply('user SHOULD be already banned,,, idk lmao');
|
message.reply('user SHOULD be already banned,,, idk lmao');
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue