Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.1 kB
0
Indexable
Never
module.exports = async (client, node) => {
    console.log(`[INFO] Node ${node.options.name} ready`);

    const guildDatas = await client.guildData.find();
    const status = guildDatas.filter((x) => x.reconnect.status);

    console.log(`[INFO] Auto reconnect found in ${status.length} servers`);

    for (const guildData of guildDatas) {
        const index = guildDatas.indexOf(guildData);
        const reconnect = guildData.reconnect;

        setTimeout(async () => {
            const guild = client.guilds.cache.get(guildData.id);
            const text = client.channels.cache.get(reconnect.text);
            const voices = client.channels.cache.get(reconnect.voice);

            if (!reconnect.status || !text || !voices) return;

            await client.manager.create({
                guildId: guild.id,
                voiceId: voices.id,
                textId: text.id,
                shardId: guild.shardId,
                volume: client.config.defaultVolume,
                deaf: true,
            });
        }),
            index * 5000;
    }
};
Leave a Comment