ChannelGrab/index.ts
2024-06-28 00:59:36 +02:00

47 lines
1.3 KiB
TypeScript

import { Client, Guild } from 'discord.js-selfbot-v13';
const token = '';
class InfoClient extends Client {
public constructor() {
super();
this.init();
}
private async init(): Promise<void> {
this.once('ready', () => this.onReady());
await this.login(token);
}
private onReady(): void {
console.log(`Logged in as ${this.user?.tag}!`);
const guildData: { [key: string]: { [key: string]: string[] } } = {};
this.guilds.cache.forEach((guild: Guild) => {
const guildInfo: { [key: string]: string[] } = {};
console.log(`Guild: ${guild}`);
const channels = guild.channels.cache;
console.log(`There are ${channels.size} channels in the guild.`);
channels.forEach(channel => {
if (channel && channel.type !== 'GUILD_CATEGORY') {
const categoryName = channel.parent?.name || 'Uncategorized';
const categoryID = channel.parent?.id || 'Uncategorized';
if (!guildInfo[categoryName]) {
guildInfo[categoryName] = [];
}
guildInfo[categoryName].push(`${channel.name} (${channel.type} ${channel.id})`);
}
});
guildData[guild.name] = guildInfo;
});
console.log(guildData)
process.exit();
}
}
new InfoClient();