-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
40 lines (34 loc) · 1 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// index.ts
import { Client } from "discord.js-selfbot-v13";
import { createInterface } from "node:readline";
import { fetchUserIds, banUser, fetchBansOnce } from "./utils";
const client = new Client();
const rl = createInterface({
input: process.stdin,
output: process.stdout,
});
const token = Bun.env.USER_TOKEN;
client.on("ready", async () => {
console.log(`Logged in as ${client.user?.tag}!`);
rl.question("Please enter the guild ID: ", async (guildId) => {
try {
const userIds = await fetchUserIds();
const bannedUserIds = await fetchBansOnce(client, guildId);
let processedCount = 0;
for (const userId of userIds) {
if (!bannedUserIds.has(userId)) {
await banUser(client, guildId, userId);
bannedUserIds.add(userId);
processedCount++;
}
}
console.log(`Complete. Bans: ${processedCount}`);
} catch (error) {
console.error("Error processing bans:", error);
} finally {
rl.close();
process.exit(0);
}
});
});
client.login(token).catch(console.error);