From f51f7e66c0f9ea734a990822eb5c24bc849eaef5 Mon Sep 17 00:00:00 2001 From: Joren Date: Fri, 28 Jun 2024 01:25:27 +0200 Subject: [PATCH] Loop over every token in tokens.txt and get all the channels --- index.ts | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/index.ts b/index.ts index 1561126..6de3499 100644 --- a/index.ts +++ b/index.ts @@ -1,17 +1,19 @@ import { Client, Guild } from 'discord.js-selfbot-v13'; import fs from 'fs'; -const token = ''; class InfoClient extends Client { - public constructor() { + public token: string; + + public constructor(token: string) { super(); + this.token = token; this.init(); } private async init(): Promise { this.once('ready', () => this.onReady()); - await this.login(token); + await this.login(this.token); } private onReady(): void { @@ -38,12 +40,22 @@ class InfoClient extends Client { }); guildData[guild.name] = guildInfo; }); - const filename = `${this.user?.tag}[${token.substring(0, 5)}].json`; + const filename = `${this.user?.tag} ${this.token.substring(0, 5)}.json`; const jsonData = JSON.stringify(guildData, null, 2); fs.writeFileSync(filename, jsonData); process.exit(); } } -new InfoClient(); +function createInfoClientsFromFile(filePath: string): void { + const tokens = fs.readFileSync(filePath, 'utf-8').split('\n').map(token => token.trim()); + tokens.forEach(token => { + if (token) { + new InfoClient(token); + } + }); +} + +const tokensFilePath = 'tokens.txt'; +createInfoClientsFromFile(tokensFilePath);