Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -817,9 +817,67 @@ client.on('interactionCreate', async (interaction) => {
|
|
| 817 |
}
|
| 818 |
}
|
| 819 |
|
| 820 |
-
if (interaction.
|
| 821 |
if (interaction.customId === 'settings_select') {
|
| 822 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 823 |
}
|
| 824 |
}
|
| 825 |
});
|
|
|
|
| 817 |
}
|
| 818 |
}
|
| 819 |
|
| 820 |
+
if (interaction.isStringSelectMenu()) {
|
| 821 |
if (interaction.customId === 'settings_select') {
|
| 822 |
+
const value = interaction.values[0];
|
| 823 |
+
if (value === 'auto_friendly_settings') {
|
| 824 |
+
await showAutoFriendlyPanel(interaction);
|
| 825 |
+
} else {
|
| 826 |
+
await interaction.reply({ content: "✅ Settings interaction acknowledged.", ephemeral: true });
|
| 827 |
+
}
|
| 828 |
+
}
|
| 829 |
+
}
|
| 830 |
+
|
| 831 |
+
if (interaction.isChannelSelectMenu()) {
|
| 832 |
+
if (interaction.customId === 'auto_friendly_channel_select') {
|
| 833 |
+
if (!interaction.member.permissions.has('Administrator')) return interaction.reply({ content: "❌ Admin Only", ephemeral: true });
|
| 834 |
+
const channelId = interaction.values[0];
|
| 835 |
+
const config = storage.data.config[interaction.guildId] || {};
|
| 836 |
+
config.autoFriendlyChannel = channelId;
|
| 837 |
+
storage.data.config[interaction.guildId] = config;
|
| 838 |
+
storage.save('config');
|
| 839 |
+
await interaction.deferUpdate();
|
| 840 |
+
await showAutoFriendlyPanel(interaction);
|
| 841 |
+
}
|
| 842 |
+
}
|
| 843 |
+
|
| 844 |
+
if (interaction.isButton()) {
|
| 845 |
+
if (interaction.customId === 'toggle_auto_friendly') {
|
| 846 |
+
if (!interaction.member.permissions.has('Administrator')) return interaction.reply({ content: "❌ Admin Only", ephemeral: true });
|
| 847 |
+
const config = storage.data.config[interaction.guildId] || {};
|
| 848 |
+
config.autoFriendlyEnabled = !config.autoFriendlyEnabled;
|
| 849 |
+
storage.data.config[interaction.guildId] = config;
|
| 850 |
+
storage.save('config');
|
| 851 |
+
await interaction.deferUpdate();
|
| 852 |
+
await showAutoFriendlyPanel(interaction);
|
| 853 |
+
}
|
| 854 |
+
if (interaction.customId === 'open_interval_modal') {
|
| 855 |
+
if (!interaction.member.permissions.has('Administrator')) return interaction.reply({ content: "❌ Admin Only", ephemeral: true });
|
| 856 |
+
const modal = new ModalBuilder()
|
| 857 |
+
.setCustomId('auto_friendly_interval_modal')
|
| 858 |
+
.setTitle('Auto Friendly Interval');
|
| 859 |
+
const intervalInput = new TextInputBuilder()
|
| 860 |
+
.setCustomId('interval_input')
|
| 861 |
+
.setLabel("Interval in minutes (e.g. 40)")
|
| 862 |
+
.setStyle(TextInputStyle.Short)
|
| 863 |
+
.setRequired(true)
|
| 864 |
+
.setPlaceholder('40');
|
| 865 |
+
modal.addComponents(new ActionRowBuilder().addComponents(intervalInput));
|
| 866 |
+
await interaction.showModal(modal);
|
| 867 |
+
}
|
| 868 |
+
}
|
| 869 |
+
|
| 870 |
+
if (interaction.isModalSubmit()) {
|
| 871 |
+
if (interaction.customId === 'auto_friendly_interval_modal') {
|
| 872 |
+
const interval = parseInt(interaction.fields.getTextInputValue('interval_input'));
|
| 873 |
+
if (isNaN(interval) || interval < 1) {
|
| 874 |
+
return interaction.reply({ content: "❌ Please enter a valid number of minutes.", ephemeral: true });
|
| 875 |
+
}
|
| 876 |
+
const config = storage.data.config[interaction.guildId] || {};
|
| 877 |
+
config.autoFriendlyInterval = interval;
|
| 878 |
+
storage.data.config[interaction.guildId] = config;
|
| 879 |
+
storage.save('config');
|
| 880 |
+
await interaction.reply({ content: `✅ Auto Friendly interval set to **${interval}** minutes.`, ephemeral: true });
|
| 881 |
}
|
| 882 |
}
|
| 883 |
});
|