Merge branch 'dev' into 'main'
Updating scripts and removing useless commands See merge request illegitimate/illegitimate-bot!16
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,3 @@ node_modules/*
|
||||
.env
|
||||
.prettierrc
|
||||
.editorconfig
|
||||
dev-deploy.js
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'maketestembed',
|
||||
description: 'Make a test embed',
|
||||
type: 'slash',
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('maketestembed')
|
||||
.setDescription('Make a test embed')
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
title: 'Test Embed',
|
||||
description: 'This is a test embed',
|
||||
color: 0xff0000,
|
||||
fields: [
|
||||
{
|
||||
name: 'Field 1',
|
||||
value: 'This is field 1',
|
||||
},
|
||||
{
|
||||
name: 'Field 2',
|
||||
value: 'This is field 2',
|
||||
},
|
||||
{
|
||||
name: 'Field 3',
|
||||
value: 'This is field 3',
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
text: 'This is a test embed',
|
||||
},
|
||||
}]
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,6 @@ module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('devel')
|
||||
.setDescription('Admin command.')
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('dbclearnonguildmembers')
|
||||
.setDescription('Clears the database of non-guild members.'))
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('reload')
|
||||
@@ -34,10 +30,6 @@ module.exports = {
|
||||
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),
|
||||
|
||||
@@ -49,32 +41,6 @@ module.exports = {
|
||||
const guild = interaction.guild;
|
||||
const embedColor = Number(color.replace("#", "0x"));
|
||||
|
||||
if (subcommand === 'dbclearnonguildmembers') {
|
||||
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
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 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 })
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
interaction.editReply({ content: 'Done!', ephemeral: true })
|
||||
|
||||
}
|
||||
|
||||
if (subcommand === 'reload') {
|
||||
|
||||
const { exec } = require('child_process');
|
||||
@@ -137,45 +103,5 @@ module.exports = {
|
||||
await interaction.editReply(`Purged reactions from ${count} message(s).`)
|
||||
|
||||
}
|
||||
|
||||
if (subcommand === 'updatemutedrolepermissions') {
|
||||
|
||||
await interaction.reply({ content: 'In development', ephemeral: true })
|
||||
return
|
||||
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
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);
|
||||
|
||||
// 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 channel = guild.channels.cache.get("1108161929882636380");
|
||||
|
||||
await channel.permissionOverwrites.edit("961891974472953906", {
|
||||
2097152: true,
|
||||
2048: true
|
||||
})
|
||||
|
||||
await interaction.editReply({ content: 'Updated permissions for voice channels.', ephemeral: true })
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -4,9 +4,8 @@
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prod:build": "node deploy-commands.js --prod",
|
||||
"prod:build:context": "node deploy-commands.js --contextmenu",
|
||||
"dev:build": "node deploy-commands.js --dev"
|
||||
"prod:build": "node scripts/deploy-commands.js --prod",
|
||||
"dev:build": "node scripts/deploy-commands.js --dev"
|
||||
},
|
||||
"author": "Taken",
|
||||
"license": "ISC",
|
||||
|
||||
@@ -18,12 +18,12 @@ else if (arg === '--prod') {
|
||||
|
||||
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./commands/${file}`);
|
||||
const command = require(`../commands/${file}`);
|
||||
commands.push(command.data.toJSON());
|
||||
}
|
||||
|
||||
for (const file of contentMenuCommands) {
|
||||
const command = require(`./commands-contextmenu/${file}`);
|
||||
const command = require(`../commands-contextmenu/${file}`);
|
||||
commands.push(command.data.toJSON());
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ else if (arg === '--dev') {
|
||||
|
||||
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./commands-testing/${file}`);
|
||||
const command = require(`../commands-testing/${file}`);
|
||||
commands.push(command.data.toJSON());
|
||||
}
|
||||
|
||||
41
scripts/dev-deploy.js
Normal file
41
scripts/dev-deploy.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const { REST, Routes } = require('discord.js');
|
||||
const env = require('dotenv').config();
|
||||
const token = process.env.TOKEN;
|
||||
const clientId = process.env.DEVID;
|
||||
const guildId = process.env.GUILDID;
|
||||
|
||||
const commands = [];
|
||||
// Grab all the command files from the commands directory you created earlier
|
||||
// const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js'));
|
||||
|
||||
const commandFiles = [
|
||||
'./commands/config.js',
|
||||
]
|
||||
|
||||
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`${file}`);
|
||||
commands.push(command.data.toJSON());
|
||||
}
|
||||
|
||||
// Construct and prepare an instance of the REST module
|
||||
const rest = new REST({ version: '10' }).setToken(token);
|
||||
|
||||
|
||||
// and deploy your commands!
|
||||
(async () => {
|
||||
try {
|
||||
console.log(`Started refreshing ${commands.length} application (/) commands.`);
|
||||
|
||||
// The put method is used to fully refresh all commands in the guild with the current set
|
||||
const data = await rest.put(
|
||||
Routes.applicationGuildCommands(clientId, guildId),
|
||||
{ body: commands },
|
||||
);
|
||||
|
||||
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
|
||||
} catch (error) {
|
||||
// And of course, make sure you catch and log any errors!
|
||||
console.error(error);
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user