mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-28 14:20:46 -05:00
Ban feature
This commit is contained in:
14
scripts/ban-user.ts
Normal file
14
scripts/ban-user.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/* eslint-disable no-console */
|
||||
import "dotenv/config";
|
||||
import invariant from "tiny-invariant";
|
||||
import { sql } from "~/db/sql";
|
||||
|
||||
const discordId = process.argv[2]?.trim();
|
||||
|
||||
invariant(discordId, "discord id is required (argument 1)");
|
||||
|
||||
sql
|
||||
.prepare('update "User" set banned = 1 where discordId = @discordId')
|
||||
.run({ discordId });
|
||||
|
||||
console.log(`Banned user with discord id: ${discordId}`);
|
||||
16
scripts/delete-skill.ts
Normal file
16
scripts/delete-skill.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/* eslint-disable no-console */
|
||||
import "dotenv/config";
|
||||
import invariant from "tiny-invariant";
|
||||
import { sql } from "~/db/sql";
|
||||
|
||||
const discordId = process.argv[2]?.trim();
|
||||
|
||||
invariant(discordId, "discord id is required (argument 1)");
|
||||
|
||||
sql
|
||||
.prepare(
|
||||
'delete from "Skill" where "userId" = (select id from "User" where discordId = @discordId)'
|
||||
)
|
||||
.run({ discordId });
|
||||
|
||||
console.log(`Deleted skill of user with discord id: ${discordId}`);
|
||||
Reference in New Issue
Block a user