Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -121,37 +121,6 @@ client.once('ready', async () => {
|
|
| 121 |
}
|
| 122 |
});
|
| 123 |
|
| 124 |
-
// Auto-Friendly Background Loop
|
| 125 |
-
setInterval(async () => {
|
| 126 |
-
const now = Date.now();
|
| 127 |
-
for (const guild of client.guilds.cache.values()) {
|
| 128 |
-
const config = storage.data.config[guild.id];
|
| 129 |
-
if (config?.autoFriendlyEnabled && config?.autoFriendlyChannel) {
|
| 130 |
-
const intervalMs = (config.autoFriendlyInterval || 40) * 60000;
|
| 131 |
-
const lastRun = config.lastAutoFriendly || 0;
|
| 132 |
-
|
| 133 |
-
if (now - lastRun >= intervalMs) {
|
| 134 |
-
try {
|
| 135 |
-
const channel = await guild.channels.fetch(config.autoFriendlyChannel).catch(() => null);
|
| 136 |
-
if (channel && channel.isTextBased()) {
|
| 137 |
-
const needed = 7;
|
| 138 |
-
const content = `⭐▬▬▬▬▬ **FRIENDLY** ▬▬▬▬▬⭐\n🤝 Session\n🟩 I'm In\n🟥 Busy\n⭐▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬⭐\n🗳️ Needed: ${needed}\n@everyone`;
|
| 139 |
-
const msg = await channel.send({ content, allowedMentions: { parse: ['everyone'] } });
|
| 140 |
-
await msg.react('🟩');
|
| 141 |
-
await msg.react('🟥');
|
| 142 |
-
storage.data.active_polls[guild.id] = msg.id;
|
| 143 |
-
config.lastAutoFriendly = now;
|
| 144 |
-
storage.save('config');
|
| 145 |
-
storage.save('active_polls');
|
| 146 |
-
}
|
| 147 |
-
} catch (err) {
|
| 148 |
-
console.error(`Auto-friendly error in ${guild.name}:`, err);
|
| 149 |
-
}
|
| 150 |
-
}
|
| 151 |
-
}
|
| 152 |
-
}
|
| 153 |
-
}, 60000); // Check every minute
|
| 154 |
-
});
|
| 155 |
|
| 156 |
const inviteCache = new Map();
|
| 157 |
|
|
|
|
| 121 |
}
|
| 122 |
});
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
const inviteCache = new Map();
|
| 126 |
|