Merge branch 'dev' into 'main'
Dev See merge request illegitimate/illegitimate-bot!120
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nodemon",
|
"dev": "nodemon",
|
||||||
"dev:build": "node scripts/dev-deploy.js",
|
"dev:build": "node scripts/dev-deploy.js",
|
||||||
|
"dev:delete": "node scripts/delete-commands.js",
|
||||||
"lint": "eslint_d src",
|
"lint": "eslint_d src",
|
||||||
"lint:fix": "eslint_d --fix src",
|
"lint:fix": "eslint_d --fix src",
|
||||||
"prod:build:global": "node scripts/deploy-commands.js --prod",
|
"prod:build:global": "node scripts/deploy-commands.js --prod",
|
||||||
|
|||||||
20
scripts/delete-commands.js
Normal file
20
scripts/delete-commands.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
const { REST, Routes } = require("discord.js")
|
||||||
|
require("dotenv").config()
|
||||||
|
const token = process.env.DEVTOKEN
|
||||||
|
const clientId = process.env.DEVID
|
||||||
|
const guildId = process.env.GUILDID
|
||||||
|
const rest = new REST({ version: "10" }).setToken(token)
|
||||||
|
|
||||||
|
async function deleteCommands() {
|
||||||
|
try {
|
||||||
|
console.log("Started deleting application (/) commands.")
|
||||||
|
await rest.put(
|
||||||
|
Routes.applicationGuildCommands(clientId, guildId),
|
||||||
|
{ body: [] },
|
||||||
|
)
|
||||||
|
console.log("Successfully deleted application (/) commands.")
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deleteCommands()
|
||||||
@@ -37,6 +37,16 @@ module.exports = {
|
|||||||
const mod = interaction.user
|
const mod = interaction.user
|
||||||
const embedColor = Number(color.replace("#", "0x"))
|
const embedColor = Number(color.replace("#", "0x"))
|
||||||
|
|
||||||
|
if (userid === "none") {
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: "You haven't specified a user to unban",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const user = await interaction.client.users.fetch(userid)
|
const user = await interaction.client.users.fetch(userid)
|
||||||
await interaction.guild.members.unban(user.id, reason)
|
await interaction.guild.members.unban(user.id, reason)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,13 @@ module.exports = {
|
|||||||
const focusedOption = interaction.options.getFocused(true)
|
const focusedOption = interaction.options.getFocused(true)
|
||||||
if (focusedOption.name !== "user") return
|
if (focusedOption.name !== "user") return
|
||||||
|
|
||||||
console.log
|
if (focusedOption.value === "") {
|
||||||
|
await interaction.respond([{
|
||||||
|
name: "Please start typing a username to unban",
|
||||||
|
value: "none"
|
||||||
|
}])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const bannedUsers = await interaction.guild.bans.fetch()
|
const bannedUsers = await interaction.guild.bans.fetch()
|
||||||
const filteredUsers = bannedUsers.filter((user) =>
|
const filteredUsers = bannedUsers.filter((user) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user