Untitled
unknown
javascript
3 years ago
10 kB
2
Indexable
const { MessageEmbed } = require('discord.js'); const Event = require('../../structures/Event'); const StatList = require('../../structures/models/StatList'); module.exports = class interactionCreate extends Event { constructor(...args) { super(...args) }; async run(interaction) { try { if (interaction.isCommand()) { const command = this.bot.commands.get(interaction.commandName.toLowerCase()); if (command) command.interactionRun(interaction); }; if (interaction.isSelectMenu()) { if (interaction.customId === 'faq') { if (interaction.values[0] === 'Gameplay') { interaction.reply({ content: '<:Valorant:961902410127769630> **Valorant Matchmaking** - *Gameplay*\n\n*This server operates via a queueing system. To participate, join any one of the five matchmaking queues. Wait until the queue is full with ten members, any two people can become a captain. These captains choose players one at a time after the knife round until all players have been picked and each team moves to their own voice chat.* \n\n*Our server has a map polling system, the map which has been voted the most will be picked between the two teams, and choose the best IN server for all to play on. Host a room with correct details and play! After the match has ended, you may post the screenshot in <#976610625604182046> and moderators will sort out your points from there. Remember to always play by the rules written down in <#976610621665734707> as failure to do so will result in punishments.*\n\n*To know more about our ranking and points system, please go to this channel <#976610619476312124>*', ephemeral: true }); } else if (interaction.values[0] === 'Points') { interaction.reply({ content: '<:VALORANT:685247196979134495> **Valorant Matchmaking** - *Points*\n\n*As every other game, you have the same goal of reaching to the top with the highest points compared to the other players by the end of the season by participating in custom games. The amount of points you receive per win will vary depending on your current points, as shown in <#976610619476312124>. Points may also be lost as a result of a defeat, and depending on the circumstance, points will be removed if a punishment is issued.*\n\n*Points update will not take any longer than an hour, if you can no longer see your screenshot in <#976610625604182046> and have also not recieved your points, then please open up a ticket at <#976610569966723102>. You can check if your points have been updated or not in <#976610627630026772>*', ephemeral: true }) } else if (interaction.values[0] === 'Report') { interaction.reply({ content: '<:VALORANT:685247196979134495> **Valorant Matchmaking** - *Report*\n\n*You may report a player by opening up a ticket in <#976610569966723102>. There you must give us the evidence towards your report and It must follow the guidelines set in <#976610621665734707>.*', ephemeral: true }) } else if (interaction.values[0] === 'Prize') { interaction.reply({ content: '<:VALORANT:685247196979134495> **Valorant Matchmaking** - *Prizepool*\n\n**Season 2 Prize Pool**\n\n**First Place** - 30$\n**Second Place** - 20$\n**Third Place** - 15$', ephemeral: true }); }; }; }; if (interaction.isButton()) { if (interaction.customId === 'giveaway') return; await interaction.deferReply({ ephemeral: true }); if (interaction.customId === 'leaderboard_topPoints') { let topPointUsers = await StatList.find({}).sort({ current_points: -1 }).limit(35); let pointsDescription = ''; for (let i in topPointUsers) pointsDescription += `${Number(i) + 1}) **${topPointUsers[i].name}** - *${topPointUsers[i].current_points}*\n`; const topPointsEmbed = new MessageEmbed() .setAuthor({ name: interaction.guild.name, iconURL: interaction.guild.iconURL({ dynamic: true }) }) .setTitle('Top 35 Highest Point Holders') .setDescription(pointsDescription) .setFooter({ text: 'Leaderboard is updated every two hours and shows the top 35 players on the leaderboard.' }) .setTimestamp(); interaction.editReply({ embeds: [topPointsEmbed] }); } else if (interaction.customId === 'leaderboard_topWins') { let topWinUsers = await StatList.find({}).sort({ wins: -1 }).limit(35); let winsDescription = ''; for (let i in topWinUsers) winsDescription += `${Number(i) + 1}) **${topWinUsers[i].name}** - *${topWinUsers[i].wins}*\n`; const topWinsEmbed = new MessageEmbed() .setAuthor({ name: interaction.guild.name, iconURL: interaction.guild.iconURL({ dynamic: true }) }) .setTitle('Top 35 Highest Win Holders') .setDescription(winsDescription) .setFooter({ text: 'Leaderboard is updated every two hours and shows the top 35 players within this server with the most wins.' }) .setTimestamp(); interaction.editReply({ embeds: [topWinsEmbed] }); } else if (interaction.customId === 'leaderboard_Radiant') { let Celestials = await StatList.find({}).where('current_points').gte(700).sort({ current_points: -1 }); let celestialsDescription = ''; for (let i in Celestials) { celestialsDescription += `${Number(i) + 1}) **${Celestials[i].name}** - *${Celestials[i].current_points}*\n`; }; const celestialsEmbed = new MessageEmbed() .setAuthor({ name: interaction.guild.name, iconURL: interaction.guild.iconURL({ dynamic: true }) }) .setTitle('Radiant Leaderboard') .setDescription(celestialsDescription.length === 0 ? 'There are currently no Radiants. Rise to the top to see your name on the list!' : celestialsDescription) .setTimestamp(); interaction.editReply({ embeds: [celestialsEmbed] }); } else if (interaction.customId === 'matchPing') { const role = interaction.guild.roles.cache.get('976610562358272030'); if (interaction.member.roles.cache.has(role.id)) { await interaction.member.roles.remove(role); interaction.editReply({ content: `*${interaction.user.tag}, ${role} has been removed from you.*` }); } else { await interaction.member.roles.add(role); interaction.editReply({ content: `*${interaction.user.tag}, ${role} has been added to you.*` }); }; } else if (interaction.customId === 'subPing') { const role = interaction.guild.roles.cache.get('976610563243257896'); if (interaction.member.roles.cache.has(role.id)) { await interaction.member.roles.remove(role); interaction.editReply({ content: `*${interaction.user.tag}, ${role} has been removed from you.*` }); } else { await interaction.member.roles.add(role); interaction.editReply({ content: `*${interaction.user.tag}, ${role} has been added to you.*` }); }; } else if (interaction.customId === 'support') { let category = interaction.guild.channels.cache.get('976610572529434644'); if (category.children.some((channel) => channel.name.toLowerCase() === `ticket-${interaction.user.username}`.toLowerCase())) return interaction.editReply({ content: '*You already have an existing ticket*' }); let channel = await category.createChannel(`ticket-${interaction.user.username}`, { permissionOverwrites: [ { id: interaction.user.id, allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'EMBED_LINKS', 'ATTACH_FILES', 'READ_MESSAGE_HISTORY'] }, { id: interaction.guild.id, deny: ['VIEW_CHANNEL'] }, { id: '976610542779265034', allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'EMBED_LINKS', 'ATTACH_FILES', 'READ_MESSAGE_HISTORY'] }, { id: '976610538975019039', allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'EMBED_LINKS', 'ATTACH_FILES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'] }, { id: '976610538442338404', allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'EMBED_LINKS', 'ATTACH_FILES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'] } ] }); interaction.editReply({ content: `*Your ticket has been opened in ${channel}*` }); channel.send({ content: `**Please ask your queries here!**` }); }; }; } catch (error) { return console.error(error); }; }; };
Editor is loading...