diff --git a/commands/devel.js b/commands/devel.js index 47e2022..66d1923 100644 --- a/commands/devel.js +++ b/commands/devel.js @@ -26,18 +26,18 @@ module.exports = { subcommand .setName('listallverified') .setDescription('List all verified users.')) - .addSubcommand(subcommand => - subcommand - .setName('purgereactions') - .setDescription('Purge all reactions from a messages.') - .addIntegerOption(option => - option - .setName('count') - .setDescription('Count of messages to purge reactions from.'))) - .addSubcommand(subcommand => - subcommand - .setName('updatemutedrolepermissions') - .setDescription('Update the permissions of the muted role.')) + .addSubcommand(subcommand => + subcommand + .setName('purgereactions') + .setDescription('Purge all reactions from a messages.') + .addIntegerOption(option => + option + .setName('count') + .setDescription('Count of messages to purge reactions from.'))) + .addSubcommand(subcommand => + subcommand + .setName('updatemutedrolepermissions') + .setDescription('Update the permissions of the muted role.')) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -60,11 +60,11 @@ module.exports = { const slothPixel = "https://api.slothpixel.me/api/guilds/" const verifiedUsers = await verify.find() - + verifiedUsers.forEach(async (user) => { - + const userGuild = await fetch(slothPixel + user.uuid); - + if (userGuild.data.id !== hypixelGuildID) { await verify.deleteOne({ uuid: user.uuid }) } @@ -77,8 +77,13 @@ module.exports = { if (subcommand === 'reload') { - await interaction.reply({ content: 'In development', ephemeral: true }) - return + const { exec } = require('child_process'); + exec('pm2 restart 0', async (err, stdout, stderr) => { + if (err) { + await interaction.reply({ content: 'Error while reloading: ' + err, ephemeral: true }) + } + await interaction.reply({ content: 'Reloading...', ephemeral: true }) + }); } @@ -113,61 +118,64 @@ module.exports = { }) } - if (subcommand === 'purgereactions') { + if (subcommand === 'purgereactions') { - const count = interaction.options.getInteger('count'); - await interaction.deferReply({}) + const count = interaction.options.getInteger('count'); + await interaction.deferReply({}) - if (user.id !== dev) { - interaction.editReply({ content: 'Due to you not screwing something up this command is restricted to only ' + userMentioned, ephemeral: true }) - return - } + if (user.id !== dev) { + interaction.editReply({ content: 'Due to you not screwing something up this command is restricted to only ' + userMentioned, ephemeral: true }) + return + } - const messages = await interaction.channel.messages.fetch({ limit: count }); + const messages = await interaction.channel.messages.fetch({ limit: count }); - messages.forEach(async (message) => { - await message.reactions.removeAll(); - }) + messages.forEach(async (message) => { + await message.reactions.removeAll(); + }) - await interaction.editReply(`Purged reactions from ${count} message(s).`) + await interaction.editReply(`Purged reactions from ${count} message(s).`) - } + } - if (subcommand === 'updatemutedrolepermissions') { + if (subcommand === 'updatemutedrolepermissions') { - await interaction.deferReply({ ephemeral: true }) + await interaction.reply({ content: 'In development', ephemeral: true }) + return - const guild = interaction.guild; - const voiceChannels = guild.channels.cache.filter(channel => channel.type === ChannelType.GuildVoice); - const textChannels = guild.channels.cache.filter(channel => channel.type === ChannelType.GuildText); - const mutedRole = guild.roles.cache.get(muted); + await interaction.deferReply({ ephemeral: true }) - // for (const channel of voiceChannels) { - // await channel[1].permissionOverwrites.create(mutedRole, [ - // { - // id: mutedRole, - // deny: [PermissionFlagsBits.Speak, PermissionFlagsBits.SendMessages] - // }, - // { - // id: guild.roles.everyone, - // deny: [PermissionFlagsBits.Connect, PermissionFlagsBits.ViewChannel] - // }, - // { - // id: "722386801930797056", - // allow: [PermissionFlagsBits.Connect, PermissionFlagsBits.ViewChannel] - // } - // ]) - // } + const guild = interaction.guild; + const voiceChannels = guild.channels.cache.filter(channel => channel.type === ChannelType.GuildVoice); + const textChannels = guild.channels.cache.filter(channel => channel.type === ChannelType.GuildText); + const mutedRole = guild.roles.cache.get(muted); - const channel = guild.channels.cache.get("1108161929882636380"); + // for (const channel of voiceChannels) { + // await channel[1].permissionOverwrites.create(mutedRole, [ + // { + // id: mutedRole, + // deny: [PermissionFlagsBits.Speak, PermissionFlagsBits.SendMessages] + // }, + // { + // id: guild.roles.everyone, + // deny: [PermissionFlagsBits.Connect, PermissionFlagsBits.ViewChannel] + // }, + // { + // id: "722386801930797056", + // allow: [PermissionFlagsBits.Connect, PermissionFlagsBits.ViewChannel] + // } + // ]) + // } - await channel.permissionOverwrites.edit("961891974472953906", { - 2097152: true, - 2048: true - }) + const channel = guild.channels.cache.get("1108161929882636380"); - await interaction.editReply({ content: 'Updated permissions for voice channels.', ephemeral: true }) + await channel.permissionOverwrites.edit("961891974472953906", { + 2097152: true, + 2048: true + }) - } + await interaction.editReply({ content: 'Updated permissions for voice channels.', ephemeral: true }) + + } } }; \ No newline at end of file