@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember, } from "discord.js"
|
||||||
SlashCommandBuilder,
|
|
||||||
PermissionFlagsBits,
|
|
||||||
userMention,
|
|
||||||
GuildMember,
|
|
||||||
} from "discord.js"
|
|
||||||
import { admin, helper } from "config/roles.json"
|
import { admin, helper } from "config/roles.json"
|
||||||
import { color, devMessage } from "config/options.json"
|
import { color, devMessage } from "config/options.json"
|
||||||
import { Command } from "interfaces"
|
import { Command } from "interfaces"
|
||||||
@@ -22,10 +17,12 @@ export = {
|
|||||||
option
|
option
|
||||||
.setName("user")
|
.setName("user")
|
||||||
.setDescription("User to ban")
|
.setDescription("User to ban")
|
||||||
.setRequired(true),
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.addStringOption(option =>
|
.addStringOption(option =>
|
||||||
option.setName("reason").setDescription("Reason for ban"),
|
option
|
||||||
|
.setName("reason")
|
||||||
|
.setDescription("Reason for ban")
|
||||||
)
|
)
|
||||||
.addNumberOption(option =>
|
.addNumberOption(option =>
|
||||||
option
|
option
|
||||||
@@ -39,7 +36,7 @@ export = {
|
|||||||
{ name: "5 days", value: 5 },
|
{ name: "5 days", value: 5 },
|
||||||
{ name: "6 days", value: 6 },
|
{ name: "6 days", value: 6 },
|
||||||
{ name: "7 days", value: 7 },
|
{ name: "7 days", value: 7 },
|
||||||
),
|
)
|
||||||
)
|
)
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
.setDMPermission(false),
|
.setDMPermission(false),
|
||||||
@@ -47,13 +44,9 @@ export = {
|
|||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply()
|
await interaction.deferReply()
|
||||||
|
|
||||||
const member = interaction.options.getMember(
|
const member = interaction.options.getMember("user") as GuildMember | null
|
||||||
"user",
|
const reason = interaction.options.getString("reason") ?? "No reason provided."
|
||||||
) as GuildMember | null
|
const messageDeletionDays = interaction.options.getNumber("messagedeletiondays") ?? 0
|
||||||
const reason =
|
|
||||||
interaction.options.getString("reason") ?? "No reason provided."
|
|
||||||
const messageDeletionDays =
|
|
||||||
interaction.options.getNumber("messagedeletiondays") ?? 0
|
|
||||||
const embedColor = Number(color.replace("#", "0x"))
|
const embedColor = Number(color.replace("#", "0x"))
|
||||||
|
|
||||||
if (!member) {
|
if (!member) {
|
||||||
@@ -67,15 +60,12 @@ export = {
|
|||||||
|
|
||||||
if (!modRoles.includes(admin)) {
|
if (!modRoles.includes(admin)) {
|
||||||
await interaction.editReply(
|
await interaction.editReply(
|
||||||
"You do not have permission to use this command.",
|
"You do not have permission to use this command."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (interaction.guild!.members.me!.roles.highest.position <= member.roles.highest.position) {
|
||||||
interaction.guild!.members.me!.roles.highest.position <=
|
|
||||||
member.roles.highest.position
|
|
||||||
) {
|
|
||||||
await interaction.editReply("I cannot ban this member.")
|
await interaction.editReply("I cannot ban this member.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -105,17 +95,13 @@ export = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await member.ban({
|
await member.ban({ reason: reason, deleteMessageDays: messageDeletionDays })
|
||||||
reason: reason,
|
|
||||||
deleteMessageDays: messageDeletionDays,
|
|
||||||
})
|
|
||||||
|
|
||||||
await logToChannel("mod", {
|
await logToChannel("mod", {
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
|
||||||
author: {
|
author: {
|
||||||
name: mod.user.username,
|
name: mod.user.username,
|
||||||
icon_url: mod.user.avatarURL() || undefined,
|
icon_url: mod.user.avatarURL() || undefined
|
||||||
},
|
},
|
||||||
title: "Member Banned",
|
title: "Member Banned",
|
||||||
description: `
|
description: `
|
||||||
@@ -126,41 +112,31 @@ export = {
|
|||||||
`,
|
`,
|
||||||
color: embedColor,
|
color: embedColor,
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url: mod.user.avatarURL() || "",
|
url: mod.user.avatarURL() || ""
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
text: "ID: " + member.user.id,
|
text: "ID: " + member.user.id,
|
||||||
icon_url: member.user.avatarURL() || undefined,
|
icon_url: member.user.avatarURL() || undefined
|
||||||
},
|
},
|
||||||
timestamp: new Date().toISOString(),
|
timestamp: new Date().toISOString()
|
||||||
},
|
}]
|
||||||
],
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
|
||||||
title: "Member Banned",
|
title: "Member Banned",
|
||||||
description:
|
description: "**User:** " + userMention(member.user.id) + "\n" +
|
||||||
"**User:** " +
|
"**Reason:** " + reason + "\n" +
|
||||||
userMention(member.user.id) +
|
"**Messages Deleted:** " + messageDeletionDays + " days",
|
||||||
"\n" +
|
|
||||||
"**Reason:** " +
|
|
||||||
reason +
|
|
||||||
"\n" +
|
|
||||||
"**Messages Deleted:** " +
|
|
||||||
messageDeletionDays +
|
|
||||||
" days",
|
|
||||||
color: embedColor,
|
color: embedColor,
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url: member.user.avatarURL() || "",
|
url: member.user.avatarURL() || ""
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
icon_url: interaction.guild!.iconURL() || undefined,
|
icon_url: interaction.guild!.iconURL() || undefined,
|
||||||
text: interaction.guild!.name + " | " + devMessage,
|
text: interaction.guild!.name + " | " + devMessage
|
||||||
},
|
}
|
||||||
},
|
}]
|
||||||
],
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
} as Command
|
} as Command
|
||||||
|
|||||||
@@ -1,23 +1,7 @@
|
|||||||
import { SlashCommandBuilder } from "discord.js"
|
import { SlashCommandBuilder } from "discord.js"
|
||||||
import {
|
import { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } from "config/reqs.json"
|
||||||
bwfkdr,
|
|
||||||
bwstars,
|
|
||||||
bwwins,
|
|
||||||
swstars,
|
|
||||||
swkdr,
|
|
||||||
duelswins,
|
|
||||||
duelswlr,
|
|
||||||
} from "config/reqs.json"
|
|
||||||
import { color, devMessage } from "config/options.json"
|
import { color, devMessage } from "config/options.json"
|
||||||
import {
|
import { hypixelLevel, bedwarsLevel, skywarsLevel, getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||||
hypixelLevel,
|
|
||||||
bedwarsLevel,
|
|
||||||
skywarsLevel,
|
|
||||||
getUUID,
|
|
||||||
getPlayer,
|
|
||||||
getGuild,
|
|
||||||
getHeadURL,
|
|
||||||
} from "utils/Hypixel"
|
|
||||||
import { Command } from "interfaces"
|
import { Command } from "interfaces"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
@@ -33,7 +17,7 @@ export = {
|
|||||||
option
|
option
|
||||||
.setName("ign")
|
.setName("ign")
|
||||||
.setDescription("The player's IGN.")
|
.setDescription("The player's IGN.")
|
||||||
.setRequired(true),
|
.setRequired(true)
|
||||||
)
|
)
|
||||||
.setDMPermission(false),
|
.setDMPermission(false),
|
||||||
|
|
||||||
@@ -44,47 +28,38 @@ export = {
|
|||||||
const embedColor = Number(color.replace("#", "0x"))
|
const embedColor = Number(color.replace("#", "0x"))
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
|
||||||
description: "Fetching your uuid...",
|
description: "Fetching your uuid...",
|
||||||
color: embedColor,
|
color: embedColor
|
||||||
},
|
}]
|
||||||
],
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const uuid = await getUUID(ign)
|
const uuid = await getUUID(ign)
|
||||||
if (!uuid) {
|
if (!uuid) {
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
|
||||||
description: "That player doesn't exist.",
|
description: "That player doesn't exist.",
|
||||||
color: embedColor,
|
color: embedColor
|
||||||
},
|
}]
|
||||||
],
|
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
|
||||||
description: "Fetching your player data...",
|
description: "Fetching your player data...",
|
||||||
color: embedColor,
|
color: embedColor
|
||||||
},
|
}]
|
||||||
],
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const head = await getHeadURL(ign)
|
const head = await getHeadURL(ign)
|
||||||
const player = await getPlayer(uuid)
|
const player = await getPlayer(uuid)
|
||||||
if (!player) {
|
if (!player) {
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: "That player hasn't played Hypixel before.",
|
||||||
description:
|
color: embedColor
|
||||||
"That player hasn't played Hypixel before.",
|
}]
|
||||||
color: embedColor,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -106,12 +81,10 @@ export = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
|
||||||
description: "Fetching your guild data...",
|
description: "Fetching your guild data...",
|
||||||
color: embedColor,
|
color: embedColor
|
||||||
},
|
}]
|
||||||
],
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const guild = await getGuild(uuid)
|
const guild = await getGuild(uuid)
|
||||||
@@ -143,135 +116,97 @@ export = {
|
|||||||
if (!player.stats) {
|
if (!player.stats) {
|
||||||
statsFields.push({
|
statsFields.push({
|
||||||
name: "<a:_warning:1178350183457751100> This player never played any games.",
|
name: "<a:_warning:1178350183457751100> This player never played any games.",
|
||||||
value: "**➺ Stats:** `None`",
|
value: "**➺ Stats:** `None`"
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
if (player.stats.Bedwars) {
|
if (player.stats.Bedwars) {
|
||||||
const hsbwexp = player.stats.Bedwars.Experience || 0
|
const hsbwexp = player.stats?.Bedwars?.Experience || 0
|
||||||
const hsbwstars = bedwarsLevel(hsbwexp)
|
|
||||||
const hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0
|
const hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0
|
||||||
const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0
|
const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0
|
||||||
|
const hsbwwins = player.stats?.Bedwars?.wins_bedwars || 0
|
||||||
|
const hsbwstars = bedwarsLevel(hsbwexp)
|
||||||
const hsbwfkdr = hsbwfk / hsbwfd || 0
|
const hsbwfkdr = hsbwfk / hsbwfd || 0
|
||||||
const hsbwwins = player.stats.Bedwars.wins_bedwars || 0
|
|
||||||
|
|
||||||
let bwtitle = ""
|
let bwtitle = ""
|
||||||
if (
|
if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
|
||||||
hsbwstars < bwstars ||
|
bwtitle = "<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
|
||||||
hsbwfkdr < bwfkdr ||
|
|
||||||
hsbwwins < bwwins
|
|
||||||
) {
|
|
||||||
bwtitle =
|
|
||||||
"<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
|
|
||||||
} else {
|
} else {
|
||||||
bwtitle =
|
bwtitle = "<a:check_a:1087808632172847134> This player meets the BedWars requirements."
|
||||||
"<a:check_a:1087808632172847134> This player meets the BedWars requirements."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
statsFields.push({
|
statsFields.push({
|
||||||
name: bwtitle,
|
name: bwtitle,
|
||||||
value:
|
value: "**➺ Stars:** `" + hsbwstars.toFixed(2).toString() +
|
||||||
"**➺ Stars:** `" +
|
" / " + bwstars.toString() + "`\n" +
|
||||||
hsbwstars.toFixed(2).toString() +
|
"**➺ FKDR:** `" + hsbwfkdr.toFixed(2).toString() +
|
||||||
" / " +
|
" / " + bwfkdr.toString() + "`\n" +
|
||||||
bwstars.toString() +
|
"**➺ Wins:** `" + hsbwwins.toString() +
|
||||||
"`\n" +
|
" / " + bwwins.toString() + "`"
|
||||||
"**➺ FKDR:** `" +
|
|
||||||
hsbwfkdr.toFixed(2).toString() +
|
|
||||||
" / " +
|
|
||||||
bwfkdr.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ Wins:** `" +
|
|
||||||
hsbwwins.toString() +
|
|
||||||
" / " +
|
|
||||||
bwwins.toString() +
|
|
||||||
"`",
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
statsFields.push({
|
statsFields.push({
|
||||||
name: "<a:_warning:1178350183457751100> This player never played BedWars.",
|
name: "<a:_warning:1178350183457751100> This player never played BedWars.",
|
||||||
value: "**➺ Stats:** `None`",
|
value: "**➺ Stats:** `None`"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.stats.SkyWars) {
|
if (player.stats.SkyWars) {
|
||||||
const hsswexp = player.stats?.SkyWars?.skywars_experience || 0
|
const hsswexp = player.stats?.SkyWars?.skywars_experience || 0
|
||||||
const hsswstars = skywarsLevel(hsswexp)
|
|
||||||
const hsswkills = player.stats?.SkyWars?.kills || 0
|
const hsswkills = player.stats?.SkyWars?.kills || 0
|
||||||
const hsswdeaths = player.stats?.SkyWars?.deaths || 0
|
const hsswdeaths = player.stats?.SkyWars?.deaths || 0
|
||||||
const hsswkd = hsswkills / hsswdeaths || 0
|
|
||||||
const hsswwins = player.stats?.SkyWars?.wins || 0
|
const hsswwins = player.stats?.SkyWars?.wins || 0
|
||||||
|
const hsswstars = skywarsLevel(hsswexp)
|
||||||
|
const hsswkd = hsswkills / hsswdeaths || 0
|
||||||
|
|
||||||
let swtitle = ""
|
let swtitle = ""
|
||||||
if (hsswstars < swstars || hsswkd < swkdr) {
|
if (hsswstars < swstars || hsswkd < swkdr) {
|
||||||
swtitle =
|
swtitle = "<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."
|
||||||
"<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements."
|
|
||||||
} else {
|
} else {
|
||||||
swtitle =
|
swtitle = "<a:check_a:1087808632172847134> This player meets the SkyWars requirements."
|
||||||
"<a:check_a:1087808632172847134> This player meets the SkyWars requirements."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
statsFields.push({
|
statsFields.push({
|
||||||
name: swtitle,
|
name: swtitle,
|
||||||
value:
|
value: "**➺ Stars:** `" + hsswstars.toFixed(2).toString() +
|
||||||
"**➺ Stars:** `" +
|
" / " + swstars.toString() + "`\n" +
|
||||||
hsswstars.toFixed(2).toString() +
|
"**➺ KDR:** `" + hsswkd.toFixed(2).toString() +
|
||||||
" / " +
|
" / " + swkdr.toString() + "`\n" +
|
||||||
swstars.toString() +
|
"**➺ Wins:** `" + hsswwins.toString() + "`"
|
||||||
"`\n" +
|
|
||||||
"**➺ KDR:** `" +
|
|
||||||
hsswkd.toFixed(2).toString() +
|
|
||||||
" / " +
|
|
||||||
swkdr.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ Wins:** `" +
|
|
||||||
hsswwins.toString() +
|
|
||||||
"`",
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
statsFields.push({
|
statsFields.push({
|
||||||
name: "<a:_warning:1178350183457751100> This player never played SkyWars.",
|
name: "<a:_warning:1178350183457751100> This player never played SkyWars.",
|
||||||
value: "**➺ Stats:** `None`",
|
value: "**➺ Stats:** `None`"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.stats.Duels) {
|
if (player.stats.Duels) {
|
||||||
const hsduelskills = player.stats?.Duels?.kills || 0
|
const hsduelskills = player.stats?.Duels?.kills || 0
|
||||||
const hsduelsdeaths = player.stats?.Duels?.deaths || 0
|
const hsduelsdeaths = player.stats?.Duels?.deaths || 0
|
||||||
const hsduelskd = hsduelskills / hsduelsdeaths || 0
|
|
||||||
const hsduelswins = player.stats?.Duels?.wins || 0
|
const hsduelswins = player.stats?.Duels?.wins || 0
|
||||||
const hsduelslosses = player.stats?.Duels?.losses || 0
|
const hsduelslosses = player.stats?.Duels?.losses || 0
|
||||||
|
const hsduelskd = hsduelskills / hsduelsdeaths || 0
|
||||||
const hsduelswlr = hsduelswins / hsduelslosses || 0
|
const hsduelswlr = hsduelswins / hsduelslosses || 0
|
||||||
|
|
||||||
let duelstitle = ""
|
let duelstitle = ""
|
||||||
if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
|
if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
|
||||||
duelstitle =
|
duelstitle = "<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."
|
||||||
"<a:cross_a:1087808606897983539> This player does not meet the Duels requirements."
|
|
||||||
} else {
|
} else {
|
||||||
duelstitle =
|
duelstitle = "<a:check_a:1087808632172847134> This player meets the Duels requirements."
|
||||||
"<a:check_a:1087808632172847134> This player meets the Duels requirements."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
statsFields.push({
|
statsFields.push({
|
||||||
name: duelstitle,
|
name: duelstitle,
|
||||||
value:
|
value: "**➺ Wins:** `" + hsduelswins.toString() +
|
||||||
"**➺ Wins:** `" +
|
" / " + duelswins.toString() + "`\n" +
|
||||||
hsduelswins.toString() +
|
"**➺ WLR:** `" + hsduelswlr.toFixed(2).toString() +
|
||||||
" / " +
|
" / " + duelswlr.toString() + "`\n" +
|
||||||
duelswins.toString() +
|
"**➺ KDR:** `" + hsduelskd.toFixed(2).toString() + "`",
|
||||||
"`\n" +
|
|
||||||
"**➺ WLR:** `" +
|
|
||||||
hsduelswlr.toFixed(2).toString() +
|
|
||||||
" / " +
|
|
||||||
duelswlr.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ KDR:** `" +
|
|
||||||
hsduelskd.toFixed(2).toString() +
|
|
||||||
"`\n",
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
statsFields.push({
|
statsFields.push({
|
||||||
name: "<a:_warning:1178350183457751100> This player never played Duels.",
|
name: "<a:_warning:1178350183457751100> This player never played Duels.",
|
||||||
value: "**➺ Stats:** `None`",
|
value: "**➺ Stats:** `None`"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,30 +216,21 @@ export = {
|
|||||||
const level = hypixelLevel(hypixelExp)
|
const level = hypixelLevel(hypixelExp)
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
|
||||||
title: rank + player.displayname + guildTag,
|
title: rank + player.displayname + guildTag,
|
||||||
description:
|
description: "**Network Level:** `" + level.toFixed(2).toString() + "`\n" +
|
||||||
"**Network Level:** `" +
|
"**Current Guild:** `" + guildName + "`\n" +
|
||||||
level.toFixed(2).toString() +
|
"**Guild Rank:** `" + guildRank + "`",
|
||||||
"`\n" +
|
|
||||||
"**Current Guild:** `" +
|
|
||||||
guildName +
|
|
||||||
"`\n" +
|
|
||||||
"**Guild Rank:** `" +
|
|
||||||
guildRank +
|
|
||||||
"`",
|
|
||||||
color: embedColor,
|
color: embedColor,
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url: head!,
|
url: head!
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
text: interaction.guild!.name + " | " + devMessage,
|
text: interaction.guild!.name + " | " + devMessage,
|
||||||
icon_url: interaction.guild!.iconURL() || undefined,
|
icon_url: interaction.guild!.iconURL() || undefined
|
||||||
},
|
},
|
||||||
fields: statsFields,
|
fields: statsFields
|
||||||
},
|
}]
|
||||||
],
|
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
} as Command
|
} as Command
|
||||||
|
|||||||
Reference in New Issue
Block a user