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