Removing unnecceary code

This commit is contained in:
2023-05-20 15:46:51 +02:00
parent 8b2912f5e5
commit 1acca7e0ee

View File

@@ -26,18 +26,18 @@ module.exports = {
subcommand subcommand
.setName('listallverified') .setName('listallverified')
.setDescription('List all verified users.')) .setDescription('List all verified users.'))
.addSubcommand(subcommand => .addSubcommand(subcommand =>
subcommand subcommand
.setName('purgereactions') .setName('purgereactions')
.setDescription('Purge all reactions from a messages.') .setDescription('Purge all reactions from a messages.')
.addIntegerOption(option => .addIntegerOption(option =>
option option
.setName('count') .setName('count')
.setDescription('Count of messages to purge reactions from.'))) .setDescription('Count of messages to purge reactions from.')))
.addSubcommand(subcommand => .addSubcommand(subcommand =>
subcommand subcommand
.setName('updatemutedrolepermissions') .setName('updatemutedrolepermissions')
.setDescription('Update the permissions of the muted role.')) .setDescription('Update the permissions of the muted role.'))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false), .setDMPermission(false),
@@ -60,11 +60,11 @@ module.exports = {
const slothPixel = "https://api.slothpixel.me/api/guilds/" const slothPixel = "https://api.slothpixel.me/api/guilds/"
const verifiedUsers = await verify.find() const verifiedUsers = await verify.find()
verifiedUsers.forEach(async (user) => { verifiedUsers.forEach(async (user) => {
const userGuild = await fetch(slothPixel + user.uuid); const userGuild = await fetch(slothPixel + user.uuid);
if (userGuild.data.id !== hypixelGuildID) { if (userGuild.data.id !== hypixelGuildID) {
await verify.deleteOne({ uuid: user.uuid }) await verify.deleteOne({ uuid: user.uuid })
} }
@@ -77,8 +77,13 @@ module.exports = {
if (subcommand === 'reload') { if (subcommand === 'reload') {
await interaction.reply({ content: 'In development', ephemeral: true }) const { exec } = require('child_process');
return 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'); const count = interaction.options.getInteger('count');
await interaction.deferReply({}) await interaction.deferReply({})
if (user.id !== dev) { if (user.id !== dev) {
interaction.editReply({ content: 'Due to you not screwing something up this command is restricted to only ' + userMentioned, ephemeral: true }) interaction.editReply({ content: 'Due to you not screwing something up this command is restricted to only ' + userMentioned, ephemeral: true })
return return
} }
const messages = await interaction.channel.messages.fetch({ limit: count }); const messages = await interaction.channel.messages.fetch({ limit: count });
messages.forEach(async (message) => { messages.forEach(async (message) => {
await message.reactions.removeAll(); 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; await interaction.deferReply({ ephemeral: true })
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);
// for (const channel of voiceChannels) { const guild = interaction.guild;
// await channel[1].permissionOverwrites.create(mutedRole, [ const voiceChannels = guild.channels.cache.filter(channel => channel.type === ChannelType.GuildVoice);
// { const textChannels = guild.channels.cache.filter(channel => channel.type === ChannelType.GuildText);
// id: mutedRole, const mutedRole = guild.roles.cache.get(muted);
// deny: [PermissionFlagsBits.Speak, PermissionFlagsBits.SendMessages]
// },
// {
// id: guild.roles.everyone,
// deny: [PermissionFlagsBits.Connect, PermissionFlagsBits.ViewChannel]
// },
// {
// id: "722386801930797056",
// allow: [PermissionFlagsBits.Connect, PermissionFlagsBits.ViewChannel]
// }
// ])
// }
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", { const channel = guild.channels.cache.get("1108161929882636380");
2097152: true,
2048: true
})
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 })
}
} }
}; };