Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { handleVoiceSelectMenu, handleVoiceModalsSubmit, handleVoiceButtonInteraction } = require('../interaction/temporaryChannelManager');
- const { handleCaptchaVerification } = require('../commands/verifySystem');
- const { Events } = require('discord.js');
- const { showPermissionPanel } = require('../interaction/permissionPanel');
- module.exports = {
- name: Events.InteractionCreate,
- async execute(interaction) {
- try {
- if (interaction.isSelectMenu()) {
- await handleVoiceSelectMenu(interaction);
- return;
- }
- if (interaction.isModalSubmit()) {
- try {
- if (interaction.customId === 'captcha_modal') {
- await handleCaptchaVerification(interaction);
- } else if (interaction.customId === 'muteModal') {
- return;
- } else {
- await handleVoiceModalsSubmit(interaction);
- }
- } catch (error) {
- if (error.code === 10062) {
- console.log('Взаимодействие истекло');
- return;
- }
- console.error('Ошибка при обработке модального окна:', error);
- if (!interaction.replied && !interaction.deferred) {
- await interaction.reply({ content: '❌ Произошла ошибка при обработке формы', ephemeral: true}).catch(() => {});
- }
- }
- return;
- }
- if (interaction.isButton()) {
- console.log('Button pressed:', interaction.customId);
- if (interaction.customId.startsWith('ban-') || interaction.customId.startsWith('unban-')) {
- await handleVoiceButtonInteraction(interaction);
- return;
- }
- if (interaction.customId.startsWith('permissions_')) {
- if (interaction.user.id !== interaction.guild.ownerId) {
- return interaction.reply({
- content: '❌ Требуются права администратора',
- ephemeral: true
- }).catch(() => {});
- }
- const action = interaction.customId.replace('permissions_', '');
- try {
- await interaction.deferUpdate();
- switch (action) {
- case 'refresh':
- await showPermissionPanel(interaction);
- break;
- case 'close':
- if (interaction.message.deletable) {
- await interaction.message.delete().catch(() => {
- return interaction.editReply({ content: 'Панель закрыта', components: [], embeds: [] });
- });
- } else {
- await interaction.editReply({ content: 'Панель закрыта', components: [], embeds: [] });
- }
- break;
- }
- } catch (error) {
- console.error('Ошибка обработки кнопки разрешений:', error);
- if (!interaction.replied && !interaction.deferred) {
- await interaction.reply({ content: '❌ Ошибка при обработке действия', ephemeral: true }).catch(() => {});
- }
- }
- return;
- }
- return;
- }
- if (interaction.isChatInputCommand() || interaction.isContextMenuCommand()) {
- return;
- }
- } catch (error) {
- console.error('Ошибка в interactionCreate:', error);
- try {
- if (!interaction.replied && !interaction.deferred) {
- await interaction.reply({ content: 'Произошла ошибка при обработке команды.', ephemeral: true }).catch(() => {});
- }
- } catch (e) {
- console.error('Ошибка при отправке ответа об ошибке:', e);
- }
- }
- },
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement