Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -77,6 +77,9 @@ const commandsData = [
|
|
| 77 |
client.once('ready', async () => {
|
| 78 |
console.log(`[*] Logged in as ${client.user.tag}`);
|
| 79 |
|
|
|
|
|
|
|
|
|
|
| 80 |
// Auto-Scan Pending Polls
|
| 81 |
for (const guild of client.guilds.cache.values()) {
|
| 82 |
const activePollId = storage.data.active_polls[guild.id];
|
|
@@ -330,6 +333,7 @@ client.on('messageCreate', async (message) => {
|
|
| 330 |
|
| 331 |
storage.save('roles');
|
| 332 |
await message.reply(`✅ Updated whitelist for ${role.name}`);
|
|
|
|
| 333 |
}
|
| 334 |
|
| 335 |
if (commandName === 'help') {
|
|
@@ -535,6 +539,25 @@ client.on('interactionCreate', async (interaction) => {
|
|
| 535 |
await interaction.reply(`⏱️ **Uptime**: ${d}d ${h}h ${m}m ${Math.floor(up % 60)}s`);
|
| 536 |
}
|
| 537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 538 |
if (interaction.commandName === 'managerlineup') {
|
| 539 |
if (!storage.isWhitelisted(interaction.guildId, interaction.member)) return interaction.reply({ content: "❌ No Permission", ephemeral: true });
|
| 540 |
const formOptions = Object.keys(FORMATIONS).slice(0, 25).map(k => ({ label: k, value: k }));
|
|
|
|
| 77 |
client.once('ready', async () => {
|
| 78 |
console.log(`[*] Logged in as ${client.user.tag}`);
|
| 79 |
|
| 80 |
+
// Restore persistent data from Discord Cloud Backup channel
|
| 81 |
+
await storage.restoreFromDiscord(client);
|
| 82 |
+
|
| 83 |
// Auto-Scan Pending Polls
|
| 84 |
for (const guild of client.guilds.cache.values()) {
|
| 85 |
const activePollId = storage.data.active_polls[guild.id];
|
|
|
|
| 333 |
|
| 334 |
storage.save('roles');
|
| 335 |
await message.reply(`✅ Updated whitelist for ${role.name}`);
|
| 336 |
+
await storage.backupToDiscord(client); // Ensure it's persisted to Cloud
|
| 337 |
}
|
| 338 |
|
| 339 |
if (commandName === 'help') {
|
|
|
|
| 539 |
await interaction.reply(`⏱️ **Uptime**: ${d}d ${h}h ${m}m ${Math.floor(up % 60)}s`);
|
| 540 |
}
|
| 541 |
|
| 542 |
+
if (interaction.commandName === 'addrole' || interaction.commandName === 'removerole') {
|
| 543 |
+
if (!interaction.member.permissions.has('Administrator')) return interaction.reply({ content: "❌ Admin Only", ephemeral: true });
|
| 544 |
+
const role = interaction.options.getRole('role');
|
| 545 |
+
if (!role) return interaction.reply({ content: "❌ Please select a role!", ephemeral: true });
|
| 546 |
+
|
| 547 |
+
const gid = interaction.guildId;
|
| 548 |
+
if (!storage.data.roles[gid]) storage.data.roles[gid] = [];
|
| 549 |
+
|
| 550 |
+
if (interaction.commandName === 'addrole') {
|
| 551 |
+
if (!storage.data.roles[gid].includes(role.id)) storage.data.roles[gid].push(role.id);
|
| 552 |
+
} else {
|
| 553 |
+
storage.data.roles[gid] = storage.data.roles[gid].filter(id => id !== role.id);
|
| 554 |
+
}
|
| 555 |
+
|
| 556 |
+
storage.save('roles');
|
| 557 |
+
await interaction.reply(`✅ Updated whitelist for <@&${role.id}>`);
|
| 558 |
+
await storage.backupToDiscord(client); // Ensure it's persisted to Cloud
|
| 559 |
+
}
|
| 560 |
+
|
| 561 |
if (interaction.commandName === 'managerlineup') {
|
| 562 |
if (!storage.isWhitelisted(interaction.guildId, interaction.member)) return interaction.reply({ content: "❌ No Permission", ephemeral: true });
|
| 563 |
const formOptions = Object.keys(FORMATIONS).slice(0, 25).map(k => ({ label: k, value: k }));
|