Loop over every token in tokens.txt and get all the channels

This commit is contained in:
Joren 2024-06-28 01:25:27 +02:00
parent 8e8906d50a
commit f51f7e66c0
Signed by: Joren
GPG Key ID: 280E33DFBC0F1B55

View File

@ -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<void> {
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);