Merge branch 'dev' into 'main'
Fixed formatting See merge request illegitimate/illegitimate-bot!183
This commit is contained in:
@@ -11,7 +11,6 @@ scripts
|
||||
.eslintrc.js
|
||||
.gitignore
|
||||
.gitlab-ci.yml
|
||||
.prettierrc.js
|
||||
docker-compose.yml
|
||||
Dockerfile
|
||||
Dockerfile.cache
|
||||
|
||||
92
.eslintrc.js
92
.eslintrc.js
@@ -1,75 +1,59 @@
|
||||
module.exports = {
|
||||
"env": {
|
||||
"node": true,
|
||||
"es2021": true,
|
||||
"browser": true
|
||||
env: {
|
||||
node: true,
|
||||
es2021: true,
|
||||
browser: true,
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"overrides": [
|
||||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
||||
overrides: [
|
||||
{
|
||||
"env": {
|
||||
"node": true
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
"files": [
|
||||
".eslintrc.{js,cjs}"
|
||||
],
|
||||
"parserOptions": {
|
||||
"sourceType": "script"
|
||||
}
|
||||
}
|
||||
files: [".eslintrc.{js,cjs}"],
|
||||
parserOptions: {
|
||||
sourceType: "script",
|
||||
},
|
||||
},
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
4
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"windows"
|
||||
],
|
||||
"quotes": [
|
||||
"warn",
|
||||
"double"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
plugins: ["@typescript-eslint"],
|
||||
rules: {
|
||||
indent: ["error", 4, { SwitchCase: 1 }],
|
||||
"linebreak-style": ["error", "windows"],
|
||||
quotes: ["warn", "double"],
|
||||
semi: ["error", "never"],
|
||||
"no-unused-vars": "off",
|
||||
"prefer-const": "warn",
|
||||
"no-var": "error",
|
||||
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }],
|
||||
"no-multiple-empty-lines": ["error", { max: 2, maxEOF: 1, maxBOF: 0 }],
|
||||
"no-lonely-if": "error",
|
||||
"no-empty-function": "error",
|
||||
"no-inline-comments": "error",
|
||||
"no-trailing-spaces": ["error"],
|
||||
"arrow-spacing": ["warn", { "before": true, "after": true }],
|
||||
"space-before-function-paren": ["error", {
|
||||
"anonymous": "never",
|
||||
"named": "never",
|
||||
"asyncArrow": "always"
|
||||
}],
|
||||
"arrow-spacing": ["warn", { before: true, after: true }],
|
||||
"space-before-function-paren": [
|
||||
"error",
|
||||
{
|
||||
anonymous: "never",
|
||||
named: "never",
|
||||
asyncArrow: "always",
|
||||
},
|
||||
],
|
||||
"comma-spacing": "error",
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
"vars": "all",
|
||||
"args": "after-used",
|
||||
"ignoreRestSiblings": false
|
||||
}
|
||||
vars: "all",
|
||||
args: "after-used",
|
||||
ignoreRestSiblings: false,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
src/config/
|
||||
@@ -1,17 +0,0 @@
|
||||
/** @type { import('prettier').Config } */
|
||||
|
||||
const config = {
|
||||
printWidth: 80,
|
||||
tabWidth: 4,
|
||||
useTabs: false,
|
||||
semi: false,
|
||||
singleQuote: false,
|
||||
quoteProps: "as-needed",
|
||||
trailingComma: "all",
|
||||
bracketSpacing: true,
|
||||
arrowParens: "avoid",
|
||||
parser: "typescript",
|
||||
endOfLine: "crlf"
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
@@ -11,7 +11,6 @@
|
||||
"dev:js": "nodemon --config nodemon-js.json dist/index.js",
|
||||
"dev:build": "ts-node scripts/dev-deploy.ts",
|
||||
"dev:delete": "ts-node scripts/delete-commands.ts",
|
||||
"format": "prettier --write src/",
|
||||
"lint": "eslint src",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"prod:build": "ts-node scripts/deploy-commands.ts"
|
||||
@@ -35,7 +34,6 @@
|
||||
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
||||
"@typescript-eslint/parser": "^6.18.1",
|
||||
"eslint": "^8.56.0",
|
||||
"prettier": "^3.2.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
ContextMenuCommandBuilder,
|
||||
ApplicationCommandType,
|
||||
PermissionFlagsBits,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention } from "discord.js"
|
||||
import { ContextMenu } from "interfaces"
|
||||
|
||||
export = {
|
||||
@@ -23,25 +18,23 @@ export = {
|
||||
if (!message) {
|
||||
return interaction.reply({
|
||||
content: "That user does not exist.",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
|
||||
const target = message.author
|
||||
|
||||
await message.reply({
|
||||
embeds: [
|
||||
{
|
||||
title: "Congratulations!",
|
||||
description: `GG to ${userMention(target.id)}!`,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "Congratulations!",
|
||||
description: `GG to ${userMention(target.id)}!`
|
||||
}]
|
||||
})
|
||||
await message.react("🎉")
|
||||
|
||||
await interaction.reply({
|
||||
content: "Sent a congrats message",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
},
|
||||
}
|
||||
} as ContextMenu
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
ContextMenuCommandBuilder,
|
||||
ApplicationCommandType,
|
||||
PermissionFlagsBits,
|
||||
} from "discord.js"
|
||||
import { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits } from "discord.js"
|
||||
import { ContextMenu } from "interfaces"
|
||||
|
||||
export = {
|
||||
@@ -22,7 +18,7 @@ export = {
|
||||
if (!target) {
|
||||
interaction.reply({
|
||||
content: "That user does not exist.",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -30,7 +26,7 @@ export = {
|
||||
if (target.id === interaction.user.id) {
|
||||
interaction.reply({
|
||||
content: "You can't reset your own nickname.",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -38,21 +34,18 @@ export = {
|
||||
if (!target.manageable) {
|
||||
interaction.reply({
|
||||
content: "I cannot reset that user's nickname.",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await target.setNickname(
|
||||
target.user.username,
|
||||
"Reset by " +
|
||||
interaction.user.username +
|
||||
"#" +
|
||||
interaction.user.discriminator,
|
||||
"Reset by " + interaction.user.username + "#" + interaction.user.discriminator
|
||||
)
|
||||
interaction.reply({
|
||||
content: `Reset ${target.user.username}'s nickname.`,
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
},
|
||||
}
|
||||
} as ContextMenu
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
ApplicationCommandType,
|
||||
ContextMenuCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { ApplicationCommandType, ContextMenuCommandBuilder, PermissionFlagsBits, userMention } from "discord.js"
|
||||
import { color, devMessage, hypixelGuildID } from "config/options.json"
|
||||
import { ContextMenu } from "interfaces"
|
||||
import verifySchema from "schemas/verifySchema"
|
||||
@@ -32,39 +27,33 @@ export = {
|
||||
|
||||
if (!verifyData) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "User is not verified.",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "User is not verified.",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching ign...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching ign...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const ign = (await getIGN(verifyData.uuid)) as string
|
||||
const head = await getHeadURL(ign)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(verifyData.uuid)
|
||||
@@ -78,141 +67,87 @@ export = {
|
||||
|
||||
if (responseGuildID !== hypixelGuildID) {
|
||||
const roles = roleManage("default")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
usermentioned +
|
||||
" was given the the Default Member role.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
description: usermentioned + " was given the the Default Member role.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (responseGuildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(
|
||||
member => member.uuid === verifyData.uuid,
|
||||
)!.rank
|
||||
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid)!.rank
|
||||
let replyRank: string | null = null
|
||||
|
||||
await user.roles.add(
|
||||
roleManage("default").rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(roleManage("default").rolesToAdd, "User was force updated.")
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Guild Master"
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Manager"
|
||||
}
|
||||
|
||||
if (guildRank === "Moderator") {
|
||||
const roles = roleManage("moderator")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Moderator"
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Beast"
|
||||
}
|
||||
|
||||
if (guildRank === "Elite") {
|
||||
const roles = roleManage("elite")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Elite"
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Member"
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
usermentioned +
|
||||
" was given the " +
|
||||
replyRank +
|
||||
" role.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
description: usermentioned + " was given the " + replyRank + " role.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
} as ContextMenu
|
||||
|
||||
@@ -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) {
|
||||
@@ -66,16 +59,11 @@ export = {
|
||||
const modRoles = mod.roles.cache.map(role => role.id)
|
||||
|
||||
if (!modRoles.includes(admin)) {
|
||||
await interaction.editReply(
|
||||
"You do not have permission to use this command.",
|
||||
)
|
||||
await interaction.editReply("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 +93,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,168 +116,121 @@ 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 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 hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0
|
||||
const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0
|
||||
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 hsswexp = player.stats.SkyWars?.skywars_experience || 0
|
||||
const hsswkills = player.stats.SkyWars?.kills || 0
|
||||
const hsswdeaths = player.stats.SkyWars?.deaths || 0
|
||||
const hsswwins = player.stats.SkyWars?.wins || 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
|
||||
|
||||
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 hsduelskills = player.stats.Duels?.kills || 0
|
||||
const hsduelsdeaths = player.stats.Duels?.deaths || 0
|
||||
const hsduelswins = player.stats.Duels?.wins || 0
|
||||
const hsduelslosses = player.stats.Duels?.losses || 0
|
||||
const hsduelskd = hsduelskills / hsduelsdeaths || 0
|
||||
const hsduelswins = player.stats?.Duels?.wins || 0
|
||||
const hsduelslosses = player.stats?.Duels?.losses || 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`"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// network level
|
||||
const hypixelExp = player.networkExp || 0
|
||||
const hypixelExp = player?.networkExp || 0
|
||||
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
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
TextChannel,
|
||||
channelMention,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, TextChannel, channelMention, userMention } from "discord.js"
|
||||
import { color } from "config/options.json"
|
||||
import { Command } from "interfaces"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
@@ -22,7 +16,7 @@ export = {
|
||||
option
|
||||
.setName("amount")
|
||||
.setDescription("Amount of messages to clear")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -36,62 +30,52 @@ export = {
|
||||
|
||||
if (amount < 1 || amount > 100) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Please provide an amount of messages to clear between 1 and 100.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Please provide an amount of messages to clear between 1 and 100.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
channel.messages.fetch({ limit: amount }).then(async messages => {
|
||||
const messagesToDelete = messages
|
||||
.map(m => m)
|
||||
.filter(
|
||||
m =>
|
||||
m.pinned === false &&
|
||||
m.system === false &&
|
||||
m.createdTimestamp > Date.now() - 1209600000,
|
||||
)
|
||||
const messagesToDelete = messages.map(m => m).filter(m =>
|
||||
m.pinned === false &&
|
||||
m.system === false &&
|
||||
m.createdTimestamp > Date.now() - 1209600000
|
||||
)
|
||||
|
||||
await channel.bulkDelete(messagesToDelete, true)
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [
|
||||
{
|
||||
author: {
|
||||
name: interaction.user.username,
|
||||
icon_url: interaction.user.avatarURL() || undefined,
|
||||
},
|
||||
title: "Messages Cleared",
|
||||
description: `
|
||||
embeds: [{
|
||||
author: {
|
||||
name: interaction.user.username,
|
||||
icon_url: interaction.user.avatarURL() || undefined
|
||||
},
|
||||
title: "Messages Cleared",
|
||||
description: `
|
||||
**Channel:** ${channelMention(channel.id)}
|
||||
**Amount:** \`${messages.size}\` messages
|
||||
**Mod:** ${userMention(interaction.user.id)}
|
||||
`,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.user.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
text: "ID: " + channel.id,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.user.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: "ID: " + channel.id,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: `Deleted ${messages.size} messages`,
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: `Deleted ${messages.size} messages`,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -19,15 +19,15 @@ export = {
|
||||
.setDescription("The setting to configure")
|
||||
.setChoices({
|
||||
name: "Staff Application status",
|
||||
value: "staffAppStatus",
|
||||
value: "staffAppStatus"
|
||||
})
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("value")
|
||||
.setDescription("The value to set")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||
@@ -44,39 +44,26 @@ export = {
|
||||
const newSetting = new settings({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
name: setting,
|
||||
value: value,
|
||||
value: value
|
||||
})
|
||||
|
||||
await newSetting.save()
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Successfully created `" +
|
||||
setting +
|
||||
"` with value `" +
|
||||
value +
|
||||
"`.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Successfully created `" + setting + "` with value `" + value + "`.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
await settings.findOneAndUpdate({ name: setting }, { value: value })
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Successfully updated `" +
|
||||
setting +
|
||||
"` to value `" +
|
||||
value +
|
||||
"`.",
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Successfully updated `" + setting + "` to value `" + value + "`.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
ChannelType,
|
||||
PermissionFlagsBits,
|
||||
SlashCommandBuilder,
|
||||
} from "discord.js"
|
||||
import { ChannelType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import { Command } from "interfaces"
|
||||
import setup from "./counting/setup"
|
||||
@@ -28,11 +24,8 @@ export = {
|
||||
.setName("channel")
|
||||
.setDescription("The channel to setup counting in")
|
||||
.setRequired(true)
|
||||
.addChannelTypes(
|
||||
ChannelType.GuildText,
|
||||
ChannelType.GuildAnnouncement,
|
||||
),
|
||||
),
|
||||
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
@@ -42,8 +35,8 @@ export = {
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to ban")
|
||||
.setRequired(true),
|
||||
),
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
@@ -53,8 +46,8 @@ export = {
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to ban")
|
||||
.setRequired(true),
|
||||
),
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -79,16 +72,14 @@ export = {
|
||||
}
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description: "This command is currently under development",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "This command is currently under development",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,48 +1,34 @@
|
||||
import {
|
||||
ChatInputCommandInteraction,
|
||||
GuildMember,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { ChatInputCommandInteraction, GuildMember, userMention } from "discord.js"
|
||||
import { countingBanned } from "config/roles.json"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
|
||||
export default async function ban(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
export default async function ban(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
const member = interaction.options.getMember("user")! as GuildMember
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (member.roles.cache.has(countingBanned)) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
userMention(member.user.id) +
|
||||
" is currently banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: userMention(member.user.id) + " is currently banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
await member.roles.add(countingBanned)
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
userMention(member.user.id) +
|
||||
" has been banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: userMention(member.user.id) + " has been banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
import {
|
||||
ChatInputCommandInteraction,
|
||||
TextChannel,
|
||||
channelMention,
|
||||
} from "discord.js"
|
||||
import { ChatInputCommandInteraction, TextChannel, channelMention } from "discord.js"
|
||||
import settingsSchema from "schemas/settingsSchema"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import mongoose from "mongoose"
|
||||
|
||||
export default async function setup(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
export default async function setup(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
await interaction.deferReply()
|
||||
|
||||
const channel = interaction.options.getChannel("channel") as TextChannel
|
||||
@@ -18,44 +12,36 @@ export default async function setup(
|
||||
if (await settingsSchema.findOne({ name: "counting" })) {
|
||||
await settingsSchema.findOneAndUpdate(
|
||||
{ name: "counting" },
|
||||
{ name: "counting", channel: channel.id },
|
||||
{ name: "counting", channel: channel.id }
|
||||
)
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Counting channel has been updated to " +
|
||||
channelMention(channel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Counting channel has been updated to " + channelMention(channel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
const counting = new settingsSchema({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
name: "counting",
|
||||
value: channel.id,
|
||||
value: channel.id
|
||||
})
|
||||
|
||||
await counting.save()
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Counting channel has been set to " +
|
||||
channelMention(channel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Counting channel has been set to " + channelMention(channel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,34 @@
|
||||
import {
|
||||
ChatInputCommandInteraction,
|
||||
GuildMember,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { ChatInputCommandInteraction, GuildMember, userMention } from "discord.js"
|
||||
import { countingBanned } from "config/roles.json"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
|
||||
export default async function ban(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
export default async function ban(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
const member = interaction.options.getMember("user")! as GuildMember
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (!member.roles.cache.has(countingBanned)) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
userMention(member.user.id) +
|
||||
" is currently not banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: userMention(member.user.id) + " is currently not banned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
await member.roles.remove(countingBanned)
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
userMention(member.user.id) +
|
||||
" has been unbanned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: userMention(member.user.id) + " has been unbanned from counting",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
ChatInputCommandInteraction,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits } from "discord.js"
|
||||
import { Command } from "interfaces"
|
||||
|
||||
export = {
|
||||
@@ -15,12 +11,14 @@ export = {
|
||||
.setName("dev-info")
|
||||
.setDescription("Test command for the bot.")
|
||||
.addStringOption(option =>
|
||||
option.setName("test").setDescription("Test option."),
|
||||
option
|
||||
.setName("test")
|
||||
.setDescription("Test option.")
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute(interaction: ChatInputCommandInteraction) {
|
||||
async execute(interaction) {
|
||||
const test = interaction.options.getString("test")!
|
||||
|
||||
const message = await interaction.channel!.messages.fetch(test)
|
||||
@@ -31,5 +29,5 @@ export = {
|
||||
console.log(field1.value)
|
||||
|
||||
await interaction.reply({ content: "Test command.", ephemeral: true })
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -11,7 +11,9 @@ export = {
|
||||
.setName("devel")
|
||||
.setDescription("Admin command.")
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand.setName("reload").setDescription("Reload the bot."),
|
||||
subcommand
|
||||
.setName("reload")
|
||||
.setDescription("Reload the bot.")
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -23,17 +25,17 @@ export = {
|
||||
const { exec } = require("child_process")
|
||||
await interaction.reply({
|
||||
content: "Reloading...",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
|
||||
exec("pm2 restart 0", async (err: Error) => {
|
||||
if (err) {
|
||||
await interaction.reply({
|
||||
content: "Error while reloading: " + err,
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
userMention,
|
||||
GuildMember,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import verify from "schemas/verifySchema"
|
||||
import { Command } from "interfaces"
|
||||
@@ -24,7 +19,7 @@ export = {
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to force unverify")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
||||
@@ -37,12 +32,10 @@ export = {
|
||||
|
||||
if (!verifiedUser) {
|
||||
return interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description: "This user is not verified",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "This user is not verified",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -51,49 +44,43 @@ export = {
|
||||
await verify.findOneAndDelete({ userID: member.user.id })
|
||||
await member.roles.remove(
|
||||
roleManage("all").rolesToRemove,
|
||||
"User force unverified by " + interaction.user.username,
|
||||
"User force unverified by " + interaction.user.username
|
||||
)
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Force Unverified",
|
||||
author: {
|
||||
name: mod.username,
|
||||
icon_url: mod.avatarURL() || undefined,
|
||||
},
|
||||
description: `
|
||||
embeds: [{
|
||||
title: "Force Unverified",
|
||||
author: {
|
||||
name: mod.username,
|
||||
icon_url: mod.avatarURL() || undefined
|
||||
},
|
||||
description: `
|
||||
**User:** ${userMention(member.user.id)}
|
||||
**Mod:** ${userMention(mod.id)}
|
||||
**IGN:** \`${ign}\`
|
||||
**UUID:** \`${uuid}\`
|
||||
`,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: member.user.avatarURL() || undefined,
|
||||
text: "ID: " + member.user.id,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: member.user.avatarURL() || undefined,
|
||||
text: "ID: " + member.user.id
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Successfully unverified " +
|
||||
userMention(member.user.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Successfully unverified " + userMention(member.user.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
userMention,
|
||||
GuildMember,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||
import { getGuild, getHeadURL, getIGN } from "utils/Hypixel"
|
||||
import { hypixelGuildID, color, devMessage } from "config/options.json"
|
||||
import verify from "schemas/verifySchema"
|
||||
@@ -23,7 +18,7 @@ export = {
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to force update")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -38,39 +33,33 @@ export = {
|
||||
|
||||
if (!verifyData) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "User is not verified.",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "User is not verified.",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching ign...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching ign...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const ign = (await getIGN(verifyData.uuid)) as string
|
||||
const head = await getHeadURL(ign)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(verifyData.uuid)
|
||||
@@ -84,141 +73,87 @@ export = {
|
||||
|
||||
if (responseGuildID !== hypixelGuildID) {
|
||||
const roles = roleManage("default")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
usermentioned +
|
||||
" was given the the Default Member role.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
description: usermentioned + " was given the the Default Member role.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (responseGuildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(
|
||||
member => member.uuid === verifyData.uuid,
|
||||
)!.rank
|
||||
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid)!.rank
|
||||
let replyRank: string | null = null
|
||||
|
||||
await user.roles.add(
|
||||
roleManage("default").rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(roleManage("default").rolesToAdd, "User was force updated.")
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Guild Master"
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Manager"
|
||||
}
|
||||
|
||||
if (guildRank === "Moderator") {
|
||||
const roles = roleManage("moderator")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Moderator"
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Beast"
|
||||
}
|
||||
|
||||
if (guildRank === "Elite") {
|
||||
const roles = roleManage("elite")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Elite"
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force updated.",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User was force updated.")
|
||||
await user.roles.add(roles.rolesToAdd, "User was force updated.")
|
||||
replyRank = "Member"
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
usermentioned +
|
||||
" was given the the " +
|
||||
replyRank +
|
||||
" role.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
description: usermentioned + " was given the the " + replyRank + " role.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
GuildMember,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, GuildMember, userMention } from "discord.js"
|
||||
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||
import { color, hypixelGuildID, devMessage } from "config/options.json"
|
||||
import verify from "schemas/verifySchema"
|
||||
@@ -22,10 +17,14 @@ export = {
|
||||
.setName("forceverify")
|
||||
.setDescription("Force verify a user.")
|
||||
.addUserOption(option =>
|
||||
option.setName("user").setDescription("The user to force verify."),
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to force verify.")
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option.setName("ign").setDescription("The user's in-game name."),
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("The user's in-game name.")
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -45,9 +44,8 @@ export = {
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
interaction.editReply(
|
||||
"Please provide a user to force verify.\nThis can also mean the user is not in the server.",
|
||||
)
|
||||
interaction.editReply("Please provide a user to force verify.\n" +
|
||||
"This can also mean the user is not in the server.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -71,58 +69,46 @@ export = {
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching their uuid...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching their uuid...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const uuid = await getUUID(ign)
|
||||
if (!uuid) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"<a:questionmark_pink:1130206038008803488> That player doesn't exist.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:questionmark_pink:1130206038008803488> That player doesn't exist.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching their player data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching their player data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const player = await getPlayer(uuid)
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching their guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching their guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
@@ -136,119 +122,87 @@ export = {
|
||||
const head = await getHeadURL(ign)
|
||||
if (responseGuildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(
|
||||
member => member.uuid === player.uuid,
|
||||
)!.rank
|
||||
const guildRank = GuildMembers.find(member => member.uuid === player.uuid)!.rank
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force verified by " + modName,
|
||||
)
|
||||
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force verified by " + modName,
|
||||
)
|
||||
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
|
||||
}
|
||||
|
||||
if (guildRank === "Moderator") {
|
||||
const roles = roleManage("moderator")
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force verified by " + modName,
|
||||
)
|
||||
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force verified by " + modName,
|
||||
)
|
||||
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
|
||||
}
|
||||
|
||||
if (guildRank === "Elite") {
|
||||
const roles = roleManage("elite")
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force verified by " + modName,
|
||||
)
|
||||
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User was force verified by " + modName,
|
||||
)
|
||||
await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName)
|
||||
}
|
||||
}
|
||||
|
||||
await user.roles.add(
|
||||
roleManage("default").rolesToAdd,
|
||||
"User was force verified by " + modName,
|
||||
)
|
||||
await user.roles.add( roleManage("default").rolesToAdd, "User was force verified by " + modName)
|
||||
|
||||
const newVerify = new verify({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
userID: user.id,
|
||||
uuid: uuid,
|
||||
uuid: uuid
|
||||
})
|
||||
|
||||
await newVerify.save()
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [
|
||||
{
|
||||
author: {
|
||||
name: modName,
|
||||
icon_url: mod.avatarURL() || undefined,
|
||||
},
|
||||
title: "Force Verified",
|
||||
description: `
|
||||
embeds: [{
|
||||
author: {
|
||||
name: modName,
|
||||
icon_url: mod.avatarURL() || undefined
|
||||
},
|
||||
title: "Force Verified",
|
||||
description: `
|
||||
**User:** ${userMention(user.id)}
|
||||
**Mod:** ${userMention(mod.id)}
|
||||
**IGN:** \`${player.displayname}\`
|
||||
**UUID:** \`${uuid}\`
|
||||
`,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: user.user.avatarURL() || undefined,
|
||||
text: "ID: " + user.user.id,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: user.user.avatarURL() || undefined,
|
||||
text: "ID: " + user.user.id
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: interaction.guild!.name,
|
||||
description:
|
||||
"You have successfully force verified `" +
|
||||
username +
|
||||
"` with the account `" +
|
||||
player.displayname +
|
||||
"`.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
embeds: [{
|
||||
title: interaction.guild!.name,
|
||||
description: "You have successfully force verified `" + username + "` with the account `" + player.displayname + "`.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -23,8 +23,8 @@ export = {
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("The IGN of the player.")
|
||||
.setRequired(true),
|
||||
),
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
@@ -33,10 +33,8 @@ export = {
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("query")
|
||||
.setDescription(
|
||||
"The query to search for. [Default: player]",
|
||||
)
|
||||
.setRequired(true),
|
||||
.setDescription("The query to search for. [Default: player]")
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
@@ -45,9 +43,9 @@ export = {
|
||||
.addChoices(
|
||||
{ name: "Guild Member", value: "ign" },
|
||||
{ name: "Guild Name", value: "name" },
|
||||
{ name: "Guild Id", value: "id" },
|
||||
),
|
||||
),
|
||||
{ name: "Guild Id", value: "id" }
|
||||
)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
@@ -56,10 +54,8 @@ export = {
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("query")
|
||||
.setDescription(
|
||||
"The query to search for. [Default: player]",
|
||||
)
|
||||
.setRequired(true),
|
||||
.setDescription("The query to search for. [Default: player]")
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
@@ -68,16 +64,14 @@ export = {
|
||||
.addChoices(
|
||||
{ name: "Guild Member", value: "ign" },
|
||||
{ name: "Guild Name", value: "name" },
|
||||
{ name: "Guild Id", value: "id" },
|
||||
),
|
||||
{ name: "Guild Id", value: "id" }
|
||||
)
|
||||
)
|
||||
.addNumberOption(option =>
|
||||
option
|
||||
.setName("amount")
|
||||
.setDescription(
|
||||
"The amount of guild members to show. [Default: 10]",
|
||||
),
|
||||
),
|
||||
.setDescription("The amount of guild members to show. [Default: 10]")
|
||||
)
|
||||
)
|
||||
.setDMPermission(false),
|
||||
|
||||
@@ -101,16 +95,14 @@ export = {
|
||||
}
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description: "This command is currently under development",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "This command is currently under development",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -3,9 +3,7 @@ import { color, devMessage } from "config/options.json"
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
import { GuildData } from "interfaces"
|
||||
|
||||
export default async function guildInfo(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
export default async function guildInfo(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
await interaction.deferReply()
|
||||
|
||||
const query = interaction.options.getString("query")!
|
||||
@@ -15,111 +13,91 @@ export default async function guildInfo(
|
||||
|
||||
if (type === "ign") {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const uuid = await getUUID(query)
|
||||
if (!uuid) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "That player doen't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That player doen'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 player = await getPlayer(uuid)
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "That player has never joined the server!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That player has never joined the server!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
guild = await getGuild(uuid, "player")
|
||||
if (!guild) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "That player is not in a guild!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That player is not in a guild!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
} else if (type === "name") {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
guild = await getGuild(query, "name")
|
||||
if (!guild) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
} else if (type === "id") {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
guild = await getGuild(query, "id")
|
||||
if (!guild) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -142,95 +120,55 @@ export default async function guildInfo(
|
||||
const guildCreatedSecond = guildCreated.getSeconds()
|
||||
|
||||
const guildCreatedTime =
|
||||
guildCreatedDate +
|
||||
"." +
|
||||
guildCreatedMonth +
|
||||
"." +
|
||||
guildCreatedYear +
|
||||
" " +
|
||||
guildCreatedHour +
|
||||
":" +
|
||||
guildCreatedMinute +
|
||||
":" +
|
||||
guildCreatedDate + "." +
|
||||
guildCreatedMonth + "." +
|
||||
guildCreatedYear + " " +
|
||||
guildCreatedHour + ":" +
|
||||
guildCreatedMinute + ":" +
|
||||
guildCreatedSecond
|
||||
|
||||
const guildOwner = guildMembers.find(m => m.rank === "Guild Master")!.uuid
|
||||
const guildOwnerName = await getIGN(guildOwner)
|
||||
const guildRanksUnsorted = guild!.ranks.sort(
|
||||
(a, b) => b.priority - a.priority,
|
||||
)
|
||||
const guildRanks = guildRanksUnsorted
|
||||
.map(r => "**➺ " + r.name + "** `[" + r.tag + "]`")
|
||||
.join("\n")
|
||||
const guildRanksUnsorted = guild!.ranks.sort((a, b) => b.priority - a.priority)
|
||||
const guildRanks = guildRanksUnsorted.map(r => "**➺ " + r.name + "** `[" + r.tag + "]`").join("\n")
|
||||
|
||||
const allGuildMembersWeeklyXP = guildMembers.map(
|
||||
member => member.expHistory,
|
||||
)
|
||||
const guildMembersWeeklyXP = allGuildMembersWeeklyXP.map(member => {
|
||||
return Object.values(member).reduce((a, b) => a + b, 0)
|
||||
})
|
||||
const allGuildMembersWeeklyXP = guildMembers.map(member => member.expHistory)
|
||||
const guildMembersWeeklyXP = allGuildMembersWeeklyXP.map(member => { return Object.values(member).reduce((a, b) => a + b, 0) })
|
||||
|
||||
const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce(
|
||||
(a, b) => a + b,
|
||||
0,
|
||||
)
|
||||
const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(
|
||||
totalGuildMembersWeeklyXPUnformatted,
|
||||
)
|
||||
const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce((a, b) => a + b, 0)
|
||||
const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(totalGuildMembersWeeklyXPUnformatted)
|
||||
|
||||
const averageGuildMembersWeeklyXPUnformatted = Math.round(
|
||||
totalGuildMembersWeeklyXPUnformatted / 7,
|
||||
)
|
||||
const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(
|
||||
averageGuildMembersWeeklyXPUnformatted,
|
||||
)
|
||||
const averageGuildMembersWeeklyXPUnformatted = Math.round(totalGuildMembersWeeklyXPUnformatted / 7)
|
||||
const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(averageGuildMembersWeeklyXPUnformatted)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Info on** " + guildName,
|
||||
description:
|
||||
"**Guild Name: **`" +
|
||||
guildName +
|
||||
"`\n" +
|
||||
"**Guild Tag: **`" +
|
||||
guildTag +
|
||||
"`\n" +
|
||||
"**Guild Level: **`" +
|
||||
guildLvl +
|
||||
"`\n" +
|
||||
"**Guild Owner: **`" +
|
||||
guildOwnerName +
|
||||
"`",
|
||||
fields: [
|
||||
{
|
||||
name: "**Guild Ranks**",
|
||||
value: guildRanks,
|
||||
},
|
||||
{
|
||||
name: "**GEXP**",
|
||||
value:
|
||||
"**➺ Total weekly GEXP:** `" +
|
||||
totalGuildMembersWeeklyXP +
|
||||
"`\n" +
|
||||
"**➺ Daily avarage:** `" +
|
||||
averageGuildMembersWeeklyXP +
|
||||
"`\n" +
|
||||
"**➺ Total GEXP:** `" +
|
||||
guildExp +
|
||||
"`",
|
||||
},
|
||||
{
|
||||
name: "**Guild Created**",
|
||||
value: "**➺ **`" + guildCreatedTime + "`",
|
||||
},
|
||||
],
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
embeds: [{
|
||||
title: "**Info on** " + guildName,
|
||||
description: "**Guild Name: **`" + guildName + "`\n" +
|
||||
"**Guild Tag: **`" + guildTag + "`\n" +
|
||||
"**Guild Level: **`" + guildLvl + "`\n" +
|
||||
"**Guild Owner: **`" + guildOwnerName + "`",
|
||||
fields: [
|
||||
{
|
||||
name: "**Guild Ranks**",
|
||||
value: guildRanks
|
||||
},
|
||||
},
|
||||
],
|
||||
{
|
||||
name: "**GEXP**",
|
||||
value: "**➺ Total weekly GEXP:** `" + totalGuildMembersWeeklyXP + "`\n" +
|
||||
"**➺ Daily avarage:** `" + averageGuildMembersWeeklyXP + "`\n" +
|
||||
"**➺ Total GEXP:** `" + guildExp + "`"
|
||||
},
|
||||
{
|
||||
name: "**Guild Created**",
|
||||
value: "**➺ **`" + guildCreatedTime + "`"
|
||||
}
|
||||
],
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,62 +2,52 @@ import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
|
||||
export default async function guildMember(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
export default async function guildMember(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
await interaction.deferReply()
|
||||
|
||||
const ign = interaction.options.getString("ign")!
|
||||
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: "This user does not exist",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "This user does not 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) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "This user never logged on to hypixel",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
description: "This user never logged on to hypixel",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -80,30 +70,26 @@ export default async function guildMember(
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
if (!guild) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "This user is not in a guild",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
description: "This user is not in a guild",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -116,30 +102,13 @@ export default async function guildMember(
|
||||
const guildRank = guildMember!.rank
|
||||
const memberGexp = guildMember!.expHistory
|
||||
const allDaysGexp = Object.keys(memberGexp).map(key => {
|
||||
return (
|
||||
"**➺ " +
|
||||
key +
|
||||
":** " +
|
||||
"`" +
|
||||
new Intl.NumberFormat("en-US").format(memberGexp[key]) +
|
||||
"`" +
|
||||
"\n"
|
||||
)
|
||||
return ("**➺ " + key + ":** " + "`" + new Intl.NumberFormat("en-US").format(memberGexp[key]) + "`" + "\n")
|
||||
})
|
||||
const expValue = allDaysGexp.join("")
|
||||
const totalWeeklyGexpUnformatted = Object.values(memberGexp).reduce(
|
||||
(a, b) => a + b,
|
||||
0,
|
||||
)
|
||||
const totalWeeklyGexp = new Intl.NumberFormat("en-US").format(
|
||||
totalWeeklyGexpUnformatted,
|
||||
)
|
||||
const averageWeeklyGexpUnformatted = Math.round(
|
||||
totalWeeklyGexpUnformatted / 7,
|
||||
)
|
||||
const averageWeeklyGexp = new Intl.NumberFormat("en-US").format(
|
||||
averageWeeklyGexpUnformatted,
|
||||
)
|
||||
const totalWeeklyGexpUnformatted = Object.values(memberGexp).reduce((a, b) => a + b, 0)
|
||||
const totalWeeklyGexp = new Intl.NumberFormat("en-US").format(totalWeeklyGexpUnformatted)
|
||||
const averageWeeklyGexpUnformatted = Math.round(totalWeeklyGexpUnformatted / 7)
|
||||
const averageWeeklyGexp = new Intl.NumberFormat("en-US").format(averageWeeklyGexpUnformatted)
|
||||
|
||||
const guildMemberJoinMS = guildMember!.joined
|
||||
const guildMemberJoinTime = new Date(guildMemberJoinMS)
|
||||
@@ -151,58 +120,41 @@ export default async function guildMember(
|
||||
const guildMemberJoinSeconds = guildMemberJoinTime.getSeconds()
|
||||
|
||||
const guildMemberJoin =
|
||||
guildMemberJoinDate +
|
||||
"." +
|
||||
guildMemberJoinMonth +
|
||||
"." +
|
||||
guildMemberJoinYear +
|
||||
" " +
|
||||
guildMemberJoinHours +
|
||||
":" +
|
||||
guildMemberJoinMinutes +
|
||||
":" +
|
||||
guildMemberJoinDate + "." +
|
||||
guildMemberJoinMonth + "." +
|
||||
guildMemberJoinYear + " " +
|
||||
guildMemberJoinHours + ":" +
|
||||
guildMemberJoinMinutes + ":" +
|
||||
guildMemberJoinSeconds
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: rank + displayName + guildTag,
|
||||
description:
|
||||
"**Guild Name:** `" +
|
||||
guildName +
|
||||
"`\n" +
|
||||
"**Guild Rank:** `" +
|
||||
guildRank +
|
||||
"`\n",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: "**Daily GEXP**",
|
||||
value: expValue,
|
||||
},
|
||||
{
|
||||
name: "**Weekly GEXP**",
|
||||
value:
|
||||
"**➺ Total:** `" +
|
||||
totalWeeklyGexp +
|
||||
"`\n" +
|
||||
"**➺ Daily avarage:** `" +
|
||||
averageWeeklyGexp +
|
||||
"`",
|
||||
},
|
||||
{
|
||||
name: "**Join date**",
|
||||
value: "**➺ **`" + guildMemberJoin + "`",
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
title: rank + displayName + guildTag,
|
||||
description: "**Guild Name:** `" + guildName + "`\n" +
|
||||
"**Guild Rank:** `" + guildRank + "`\n",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
fields: [
|
||||
{
|
||||
name: "**Daily GEXP**",
|
||||
value: expValue
|
||||
},
|
||||
{
|
||||
name: "**Weekly GEXP**",
|
||||
value: "**➺ Total:** `" + totalWeeklyGexp + "`\n" +
|
||||
"**➺ Daily avarage:** `" + averageWeeklyGexp + "`"
|
||||
},
|
||||
{
|
||||
name: "**Join date**",
|
||||
value: "**➺ **`" + guildMemberJoin + "`"
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@ import { GuildData } from "interfaces"
|
||||
import Illegitimate from "utils/Illegitimate"
|
||||
const redis = Illegitimate.redis
|
||||
|
||||
export default async function guildTop(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
export default async function guildTop(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
await interaction.deferReply()
|
||||
|
||||
const query = interaction.options.getString("query")!
|
||||
@@ -18,123 +16,101 @@ export default async function guildTop(
|
||||
|
||||
if (interaction.channel!.type === ChannelType.DM) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "You can't use this command in DMs!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "You can't use this command in DMs!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (type === "ign") {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your uuid...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const uuid = await getUUID(query)
|
||||
if (!uuid) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "That player doen't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That player doen'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 player = await getPlayer(uuid)
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "That player has never joined the server!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That player has never joined the server!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
guild = await getGuild(uuid, "player")
|
||||
if (!guild) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "That player is not in a guild!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That player is not in a guild!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
} else if (type === "name") {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
guild = await getGuild(query, "name")
|
||||
if (!guild) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
} else if (type === "id") {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
guild = await getGuild(query, "id")
|
||||
if (!guild) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That guild doesn't exist!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -146,26 +122,18 @@ export default async function guildTop(
|
||||
|
||||
const cachedData = await redis.get("guildTop+" + guildId)
|
||||
|
||||
const gexpTodayUnformatted = guildMembers
|
||||
.map(member => {
|
||||
return member.expHistory[Object.keys(member.expHistory)[0]]
|
||||
})
|
||||
.reduce((a, b) => a + b, 0)
|
||||
const gexpToday = new Intl.NumberFormat("en-US").format(
|
||||
gexpTodayUnformatted,
|
||||
)
|
||||
const gexpTodayUnformatted = guildMembers.map(member => {
|
||||
return member.expHistory[Object.keys(member.expHistory)[0]]
|
||||
}).reduce((a, b) => a + b, 0)
|
||||
const gexpToday = new Intl.NumberFormat("en-US").format(gexpTodayUnformatted)
|
||||
|
||||
const averageGuildMemberGEXPUnformatted = Math.floor(
|
||||
gexpTodayUnformatted / guildMembers.length,
|
||||
)
|
||||
const averageGuildMemberGEXP = new Intl.NumberFormat("en-US").format(
|
||||
averageGuildMemberGEXPUnformatted,
|
||||
)
|
||||
const averageGuildMemberGEXPUnformatted = Math.floor(gexpTodayUnformatted / guildMembers.length)
|
||||
const averageGuildMemberGEXP = new Intl.NumberFormat("en-US").format(averageGuildMemberGEXPUnformatted)
|
||||
|
||||
const allMembersDailyGEXP = guildMembers.map(member => {
|
||||
return {
|
||||
uuid: member.uuid,
|
||||
gexp: member.expHistory[Object.keys(member.expHistory)[0]],
|
||||
gexp: member.expHistory[Object.keys(member.expHistory)[0]]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -184,24 +152,15 @@ export default async function guildTop(
|
||||
let guildData: GuildTopData = []
|
||||
const fieldsValueRaw: string[] = []
|
||||
const allMembersSorted = allMembersDailyGEXP.sort((a, b) => b.gexp - a.gexp)
|
||||
const allMembersSortedUUIDArray = allMembersSorted.map(member => {
|
||||
return member.uuid
|
||||
})
|
||||
const allMembersSortedUUIDArray = allMembersSorted.map(member => member.uuid)
|
||||
|
||||
if (!cachedData) {
|
||||
cacheStatus = false
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Fetching the top " +
|
||||
amount +
|
||||
" members of " +
|
||||
guildName +
|
||||
"...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching the top " + amount + " members of " + guildName + "...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
for (let i = 0; i < allMembersSortedUUIDArray.length; i++) {
|
||||
@@ -210,30 +169,18 @@ export default async function guildTop(
|
||||
|
||||
guildData.push({
|
||||
ign: ign!,
|
||||
uuid: uuid,
|
||||
uuid: uuid
|
||||
})
|
||||
}
|
||||
|
||||
await redis.set(
|
||||
"guildTop+" + guildId,
|
||||
JSON.stringify(guildData),
|
||||
"EX",
|
||||
60 * 30,
|
||||
)
|
||||
await redis.set("guildTop+" + guildId, JSON.stringify(guildData), "EX", 60 * 30)
|
||||
} else {
|
||||
cacheStatus = true
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Fetching the top " +
|
||||
amount +
|
||||
" members of " +
|
||||
guildName +
|
||||
"using cache...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching the top " + amount + " members of " + guildName + "using cache...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
guildData = JSON.parse(cachedData)
|
||||
}
|
||||
@@ -243,18 +190,14 @@ export default async function guildTop(
|
||||
|
||||
for (let i = 0; i < amount; i++) {
|
||||
const gexp = new Intl.NumberFormat("en-US").format(topMembers[i].gexp)
|
||||
const ign = guildData.find(
|
||||
member => member.uuid === topMembers[i].uuid,
|
||||
)?.ign
|
||||
const ign = guildData.find(member => member.uuid === topMembers[i].uuid)?.ign
|
||||
|
||||
const position = i + 1
|
||||
|
||||
fieldsValueRaw.push("**#" + position + " " + ign + ":** `" + gexp + "`")
|
||||
}
|
||||
|
||||
const list = Array.from({ length: sliceSize }, (_, i) =>
|
||||
fieldsValueRaw.slice(i * sliceSize, (i + 1) * sliceSize),
|
||||
)
|
||||
const list = Array.from({ length: sliceSize }, (_, i) => fieldsValueRaw.slice(i * sliceSize, (i + 1) * sliceSize))
|
||||
const newList: NewList = []
|
||||
|
||||
list.forEach((item, index) => {
|
||||
@@ -263,34 +206,23 @@ export default async function guildTop(
|
||||
newList[index] = {
|
||||
name: "",
|
||||
value: item.join("\n"),
|
||||
inline: false,
|
||||
inline: false
|
||||
}
|
||||
})
|
||||
|
||||
const cacheStatusText = cacheStatus ? " | [Cache]" : ""
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: "Top members of " + guildName,
|
||||
description:
|
||||
"**Total daily GEXP:** `" +
|
||||
gexpToday +
|
||||
"`\n" +
|
||||
"**Average guild memeber GEXP:** `" +
|
||||
averageGuildMemberGEXP +
|
||||
"`",
|
||||
color: embedColor,
|
||||
fields: newList,
|
||||
footer: {
|
||||
text:
|
||||
interaction.guild!.name +
|
||||
" | " +
|
||||
devMessage +
|
||||
cacheStatusText,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "Top members of " + guildName,
|
||||
description: "**Total daily GEXP:** `" + gexpToday + "`\n" +
|
||||
"**Average guild memeber GEXP:** `" + averageGuildMemberGEXP + "`",
|
||||
color: embedColor,
|
||||
fields: newList,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage + cacheStatusText,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export = {
|
||||
const commandRawList = client.commands.map(command => {
|
||||
return {
|
||||
name: command.name,
|
||||
command: command,
|
||||
command: command
|
||||
}
|
||||
})
|
||||
|
||||
@@ -34,22 +34,22 @@ export = {
|
||||
if (!command.command.subcommands && command.command.public) {
|
||||
commandList.push({
|
||||
name: "**/" + commandName + "**",
|
||||
value: "`" + command.command.description + "`",
|
||||
value: "`" + command.command.description + "`"
|
||||
})
|
||||
} else if (command.command.subcommands && command.command.public) {
|
||||
const subcommands = command.command.data.options.map(
|
||||
subcommand => {
|
||||
return {
|
||||
name: commandName + " " + subcommand.toJSON().name,
|
||||
description: subcommand.toJSON().description,
|
||||
description: subcommand.toJSON().description
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
for (const subcommand of subcommands) {
|
||||
commandList.push({
|
||||
name: "**/" + subcommand.name + "**",
|
||||
value: "`" + subcommand.description + "`",
|
||||
value: "`" + subcommand.description + "`"
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -58,21 +58,19 @@ export = {
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: "Commands",
|
||||
description: "List of commands",
|
||||
fields: commandList,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.guild!.iconURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
embeds: [{
|
||||
title: "Commands",
|
||||
description: "List of commands",
|
||||
fields: commandList,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.guild!.iconURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -18,27 +18,24 @@ export = {
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
title: "Verification",
|
||||
description:
|
||||
"1. Log onto hypixel.\n" +
|
||||
"2. Right click with the head in your hotbar.\n" +
|
||||
"3. Click on the social media icon.\n" +
|
||||
"4. Click on the discord icon.\n" +
|
||||
"5. Type your username in the chat and press enter.\n" +
|
||||
"6. Run the `/verify` command in this channel.\n",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
image: {
|
||||
url: instructionsgif,
|
||||
proxy_url: instructionsgif,
|
||||
},
|
||||
embeds: [{
|
||||
title: "Verification",
|
||||
description: "1. Log onto hypixel.\n" +
|
||||
"2. Right click with the head in your hotbar.\n" +
|
||||
"3. Click on the social media icon.\n" +
|
||||
"4. Click on the discord icon.\n" +
|
||||
"5. Type your username in the chat and press enter.\n" +
|
||||
"6. Run the `/verify` command in this channel.\n",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
},
|
||||
],
|
||||
image: {
|
||||
url: instructionsgif,
|
||||
proxy_url: instructionsgif
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -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,12 +17,12 @@ export = {
|
||||
option
|
||||
.setName("member")
|
||||
.setDescription("Member to kick.")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("reason")
|
||||
.setDescription("Reason for kicking the member."),
|
||||
.setDescription("Reason for kicking the member.")
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
|
||||
.setDMPermission(false),
|
||||
@@ -36,8 +31,7 @@ export = {
|
||||
await interaction.deferReply()
|
||||
|
||||
const member = interaction.options.getMember("member") as GuildMember
|
||||
const reason =
|
||||
interaction.options.getString("reason") ?? "No reason provided."
|
||||
const reason = interaction.options.getString("reason") ?? "No reason provided."
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
const mod = await interaction.guild!.members.fetch(interaction.user.id)
|
||||
@@ -45,9 +39,7 @@ export = {
|
||||
const modRoles = mod.roles.cache.map(role => role.id)
|
||||
|
||||
if (!modRoles.includes(helper) && !modRoles.includes(admin)) {
|
||||
await interaction.editReply(
|
||||
"You do not have permission to use this command.",
|
||||
)
|
||||
await interaction.editReply("You do not have permission to use this command.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -79,54 +71,44 @@ export = {
|
||||
await member.kick(reason + ` - ${mod.user.username}`)
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [
|
||||
{
|
||||
author: {
|
||||
name: mod.user.username,
|
||||
icon_url: mod.user.avatarURL() || undefined,
|
||||
},
|
||||
title: "Member Kicked",
|
||||
description: `
|
||||
embeds: [{
|
||||
author: {
|
||||
name: mod.user.username,
|
||||
icon_url: mod.user.avatarURL() || undefined
|
||||
},
|
||||
title: "Member Kicked",
|
||||
description: `
|
||||
**User:** ${userMention(member.user.id)}
|
||||
**Mod:** ${userMention(mod.user.id)}
|
||||
**Reason:** ${reason}
|
||||
`,
|
||||
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 Kicked",
|
||||
description:
|
||||
"**User:** " +
|
||||
userMention(member.user.id) +
|
||||
"\n" +
|
||||
"**Reason:** " +
|
||||
reason +
|
||||
"\n" +
|
||||
"**Moderator:** " +
|
||||
mod.user.username,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: member.user.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
embeds: [{
|
||||
title: "Member Kicked",
|
||||
description: "**User:** " + userMention(member.user.id) + "\n" +
|
||||
"**Reason:** " + reason + "\n" +
|
||||
"**Moderator:** " + mod.user.username,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: member.user.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -19,17 +19,15 @@ export = {
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Ping of the bot is " + client.ws.ping + "ms.",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild?.iconURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
embeds: [{
|
||||
description: "Ping of the bot is " + client.ws.ping + "ms.",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild?.iconURL() || undefined
|
||||
},
|
||||
],
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -7,7 +7,7 @@ export = {
|
||||
name: "pp",
|
||||
description: "Shows pp size",
|
||||
public: true,
|
||||
dev: true,
|
||||
dev: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("pp")
|
||||
@@ -16,13 +16,12 @@ export = {
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("User to show pp size")
|
||||
.setRequired(false),
|
||||
.setRequired(false)
|
||||
)
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute(interaction) {
|
||||
const user = (interaction.options.getUser("user") ||
|
||||
interaction.user) as User
|
||||
const user = (interaction.options.getUser("user") || interaction.user) as User
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
let size: number
|
||||
|
||||
@@ -33,13 +32,11 @@ export = {
|
||||
}
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
title: `${user.username}'s pp size`,
|
||||
description: `8${"=".repeat(size)}D`,
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: `${user.username}'s pp size`,
|
||||
description: `8${"=".repeat(size)}D`,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import waitinglistSchema from "schemas/waitinglistSchema"
|
||||
import { Command } from "interfaces"
|
||||
@@ -21,13 +17,13 @@ export = {
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to remove.")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("reason")
|
||||
.setDescription("The reason for removing the user.")
|
||||
.setRequired(false),
|
||||
.setRequired(false)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -36,8 +32,7 @@ export = {
|
||||
await interaction.deferReply()
|
||||
|
||||
const user = interaction.options.getUser("user")!
|
||||
const reason =
|
||||
interaction.options.getString("reason") ?? "No reason provided."
|
||||
const reason = interaction.options.getString("reason") ?? "No reason provided."
|
||||
const mod = interaction.user!
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
@@ -45,14 +40,10 @@ export = {
|
||||
|
||||
if (!waitinglist) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
userMention(user.id) +
|
||||
" is not on the waiting list.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: userMention(user.id) + " is not on the waiting list.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -60,49 +51,40 @@ export = {
|
||||
await waitinglistSchema.findOneAndDelete({ userID: user.id })
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [
|
||||
{
|
||||
author: {
|
||||
name: mod.username,
|
||||
icon_url: mod.avatarURL() || undefined,
|
||||
},
|
||||
title: "Waiting List - Remove User",
|
||||
description: `
|
||||
embeds: [{
|
||||
author: {
|
||||
name: mod.username,
|
||||
icon_url: mod.avatarURL() || undefined
|
||||
},
|
||||
title: "Waiting List - Remove User",
|
||||
description: `
|
||||
**User:** ${userMention(user.id)}
|
||||
**Reason:** ${reason}
|
||||
**Mod:** ${userMention(mod.id)}
|
||||
`,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: user.avatarURL() || undefined,
|
||||
text: "ID: " + user.id,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: user.avatarURL() || undefined,
|
||||
text: "ID: " + user.id
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: "Waiting List - Remove User",
|
||||
description:
|
||||
"**User:** " +
|
||||
userMention(user.id) +
|
||||
"\n" +
|
||||
"**Reason:** `" +
|
||||
reason +
|
||||
"`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "Waiting List - Remove User",
|
||||
description: "**User:** " + userMention(user.id) + "\n" +
|
||||
"**Reason:** `" + reason + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
import { SlashCommandBuilder } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
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 { Command } from "interfaces"
|
||||
|
||||
export = {
|
||||
@@ -26,52 +18,36 @@ export = {
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
title: "Requirements",
|
||||
description:
|
||||
"**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.guild!.iconURL() || "",
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: "**Bedwars**",
|
||||
value:
|
||||
"**Stars:** `" +
|
||||
bwstars.toString() +
|
||||
"`\n**Wins:** `" +
|
||||
bwwins.toString() +
|
||||
"`\n**FKDR:** `" +
|
||||
bwfkdr.toString() +
|
||||
"`",
|
||||
},
|
||||
{
|
||||
name: "**Skywars**",
|
||||
value:
|
||||
"**Stars:** `" +
|
||||
swstars.toString() +
|
||||
"`\n**KDR:** `" +
|
||||
swkdr.toString() +
|
||||
"`",
|
||||
},
|
||||
{
|
||||
name: "**Duels**",
|
||||
value:
|
||||
"**Wins:** `" +
|
||||
duelswins.toString() +
|
||||
"`\n**WLR:** `" +
|
||||
duelswlr.toString() +
|
||||
"`",
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
title: "Requirements",
|
||||
description: "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.guild!.iconURL() || ""
|
||||
},
|
||||
],
|
||||
fields: [
|
||||
{
|
||||
name: "**Bedwars**",
|
||||
value: "**Stars:** `" + bwstars.toString() +
|
||||
"`\n**Wins:** `" + bwwins.toString() +
|
||||
"`\n**FKDR:** `" + bwfkdr.toString() + "`"
|
||||
},
|
||||
{
|
||||
name: "**Skywars**",
|
||||
value: "**Stars:** `" + swstars.toString() +
|
||||
"`\n**KDR:** `" + swkdr.toString() + "`"
|
||||
},
|
||||
{
|
||||
name: "**Duels**",
|
||||
value: "**Wins:** `" + duelswins.toString() +
|
||||
"`\n**WLR:** `" + duelswlr.toString() + "`"
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
ChannelType,
|
||||
TextChannel,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, ChannelType, TextChannel } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import { Command } from "interfaces"
|
||||
|
||||
@@ -20,16 +15,13 @@ export = {
|
||||
option
|
||||
.setName("message")
|
||||
.setDescription("The message to send.")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.addChannelOption(option =>
|
||||
option
|
||||
.setName("channel")
|
||||
.setDescription("The channel to send the message to.")
|
||||
.addChannelTypes(
|
||||
ChannelType.GuildText,
|
||||
ChannelType.GuildAnnouncement,
|
||||
),
|
||||
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -38,38 +30,33 @@ export = {
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
const message = interaction.options.getString("message")!
|
||||
const channel = (interaction.options.getChannel("channel") ||
|
||||
interaction.channel) as TextChannel
|
||||
const channel = (interaction.options.getChannel("channel") || interaction.channel) as TextChannel
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
channel.send({
|
||||
embeds: [
|
||||
{
|
||||
title: interaction.guild!.name,
|
||||
description: message,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.guild!.iconURL() || "",
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.id + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
title: interaction.guild!.name,
|
||||
description: message,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.guild!.iconURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.id + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Message sent.",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Message sent.",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
userMention,
|
||||
GuildMember,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import { Command } from "interfaces"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
@@ -21,13 +16,13 @@ export = {
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to set the nickname for")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("nickname")
|
||||
.setDescription("The nickname to set")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames)
|
||||
.setDMPermission(false),
|
||||
@@ -40,7 +35,7 @@ export = {
|
||||
if (!member.manageable) {
|
||||
interaction.reply({
|
||||
content: "I cannot set the nickname for this user!",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -48,43 +43,39 @@ export = {
|
||||
await member.setNickname(nickname, `Set by ${interaction.user.tag}`)
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [
|
||||
{
|
||||
author: {
|
||||
name: interaction.user.username,
|
||||
icon_url: interaction.user.avatarURL() || undefined,
|
||||
},
|
||||
title: "Nickname",
|
||||
description: `
|
||||
embeds: [{
|
||||
author: {
|
||||
name: interaction.user.username,
|
||||
icon_url: interaction.user.avatarURL() || undefined
|
||||
},
|
||||
title: "Nickname",
|
||||
description: `
|
||||
**User:** ${userMention(member.id)}
|
||||
**Nickname:** ${nickname}
|
||||
**Moderator:** ${userMention(interaction.user.id)}
|
||||
`,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.user.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
text: "ID: " + member.user.id,
|
||||
icon_url: member.user.avatarURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.user.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: "ID: " + member.user.id,
|
||||
icon_url: member.user.avatarURL() || undefined
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description: `Successfully set the nickname of ${userMention(member.id)} to ${nickname}`,
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
ephemeral: true,
|
||||
embeds: [{
|
||||
description: `Successfully set the nickname of ${userMention(member.id)} to ${nickname}`,
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}],
|
||||
ephemeral: true
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
ButtonBuilder,
|
||||
ActionRowBuilder,
|
||||
ButtonStyle,
|
||||
ChannelType,
|
||||
TextChannel,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, ChannelType, TextChannel } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import { Command } from "interfaces"
|
||||
|
||||
@@ -27,15 +19,10 @@ export = {
|
||||
.addChannelOption(option =>
|
||||
option
|
||||
.setName("channel")
|
||||
.setDescription(
|
||||
"The channel to send the application to.",
|
||||
)
|
||||
.addChannelTypes(
|
||||
ChannelType.GuildText,
|
||||
ChannelType.GuildAnnouncement,
|
||||
)
|
||||
.setRequired(true),
|
||||
),
|
||||
.setDescription("The channel to send the application to.")
|
||||
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
@@ -44,15 +31,10 @@ export = {
|
||||
.addChannelOption(option =>
|
||||
option
|
||||
.setName("channel")
|
||||
.setDescription(
|
||||
"The channel to send the application to.",
|
||||
)
|
||||
.addChannelTypes(
|
||||
ChannelType.GuildText,
|
||||
ChannelType.GuildAnnouncement,
|
||||
)
|
||||
.setRequired(true),
|
||||
),
|
||||
.setDescription("The channel to send the application to.")
|
||||
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
@@ -61,15 +43,10 @@ export = {
|
||||
.addChannelOption(option =>
|
||||
option
|
||||
.setName("channel")
|
||||
.setDescription(
|
||||
"The channel to send the verfiy message to.",
|
||||
)
|
||||
.addChannelTypes(
|
||||
ChannelType.GuildText,
|
||||
ChannelType.GuildAnnouncement,
|
||||
)
|
||||
.setRequired(true),
|
||||
),
|
||||
.setDescription("The channel to send the verfiy message to.")
|
||||
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
@@ -78,15 +55,10 @@ export = {
|
||||
.addChannelOption(option =>
|
||||
option
|
||||
.setName("channel")
|
||||
.setDescription(
|
||||
"The channel to send the waiting list message to.",
|
||||
)
|
||||
.addChannelTypes(
|
||||
ChannelType.GuildText,
|
||||
ChannelType.GuildAnnouncement,
|
||||
)
|
||||
.setRequired(true),
|
||||
),
|
||||
.setDescription("The channel to send the waiting list message to.")
|
||||
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
@@ -95,15 +67,10 @@ export = {
|
||||
.addChannelOption(option =>
|
||||
option
|
||||
.setName("channel")
|
||||
.setDescription(
|
||||
"The channel to send the application to.",
|
||||
)
|
||||
.addChannelTypes(
|
||||
ChannelType.GuildText,
|
||||
ChannelType.GuildAnnouncement,
|
||||
)
|
||||
.setRequired(true),
|
||||
),
|
||||
.setDescription("The channel to send the application to.")
|
||||
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -112,16 +79,15 @@ export = {
|
||||
const subcommand = interaction.options.getSubcommand()
|
||||
const channel = interaction.options.getChannel("channel") as TextChannel
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
let title: string = ""
|
||||
let description: string = ""
|
||||
let customId: string = ""
|
||||
let label: string = ""
|
||||
let emoji: string = ""
|
||||
let title = ""
|
||||
let description = ""
|
||||
let customId = ""
|
||||
let label = ""
|
||||
let emoji = ""
|
||||
|
||||
if (subcommand === "sendguildapplication") {
|
||||
title = "Guild Application"
|
||||
description =
|
||||
"You can apply for the guild by clicking the button below."
|
||||
description = "You can apply for the guild by clicking the button below."
|
||||
customId = "guildapply"
|
||||
label = "Apply"
|
||||
emoji = "✅"
|
||||
@@ -129,8 +95,7 @@ export = {
|
||||
|
||||
if (subcommand === "sendstaffapplication") {
|
||||
title = "Staff Application"
|
||||
description =
|
||||
"You can apply for the staff team by clicking the button below."
|
||||
description = "You can apply for the staff team by clicking the button below."
|
||||
customId = "staffapply"
|
||||
label = "Apply"
|
||||
emoji = "✅"
|
||||
@@ -138,8 +103,7 @@ export = {
|
||||
|
||||
if (subcommand === "sendinactivityapplication") {
|
||||
title = "Inactivity Log"
|
||||
description =
|
||||
"You can send an inactivity log by clicking the button below."
|
||||
description = "You can send an inactivity log by clicking the button below."
|
||||
customId = "guildinactivitylog"
|
||||
label = "Submit"
|
||||
emoji = "✅"
|
||||
@@ -162,34 +126,32 @@ export = {
|
||||
}
|
||||
|
||||
await channel.send({
|
||||
embeds: [
|
||||
{
|
||||
title: title,
|
||||
description: description,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.guild!.iconURL() || "",
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
title: title,
|
||||
description: description,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.guild!.iconURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}],
|
||||
components: [
|
||||
new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(customId)
|
||||
.setLabel(label)
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setEmoji({ name: emoji }),
|
||||
),
|
||||
],
|
||||
.setEmoji({ name: emoji })
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
await interaction.reply({
|
||||
content: "Message sent",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
ChannelType,
|
||||
TextChannel,
|
||||
channelMention,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, ChannelType, TextChannel, channelMention, userMention } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import { Command } from "interfaces"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
@@ -22,18 +15,13 @@ export = {
|
||||
.addIntegerOption(option =>
|
||||
option
|
||||
.setName("seconds")
|
||||
.setDescription(
|
||||
"The amount of seconds to set the slowmode to.",
|
||||
),
|
||||
.setDescription("The amount of seconds to set the slowmode to.")
|
||||
)
|
||||
.addChannelOption(option =>
|
||||
option
|
||||
.setName("channel")
|
||||
.setDescription("The channel to set the slowmode of.")
|
||||
.addChannelTypes(
|
||||
ChannelType.GuildText,
|
||||
ChannelType.GuildAnnouncement,
|
||||
),
|
||||
.addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -42,65 +30,58 @@ export = {
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
const seconds = interaction.options.getInteger("seconds") ?? 5
|
||||
const channel = (interaction.options.getChannel("channel") ||
|
||||
interaction.channel) as TextChannel
|
||||
const channel = (interaction.options.getChannel("channel") || interaction.channel) as TextChannel
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (seconds > 21600) {
|
||||
await channel.setRateLimitPerUser(21600)
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: `Set the slowmode of ${channel} to 21600 seconds.`,
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: `Set the slowmode of ${channel} to 21600 seconds.`,
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [
|
||||
{
|
||||
author: {
|
||||
name: interaction.user.username,
|
||||
icon_url: interaction.user.avatarURL() || undefined,
|
||||
},
|
||||
title: "Slowmode Update",
|
||||
description: `
|
||||
embeds: [{
|
||||
author: {
|
||||
name: interaction.user.username,
|
||||
icon_url: interaction.user.avatarURL() || undefined
|
||||
},
|
||||
title: "Slowmode Update",
|
||||
description: `
|
||||
**Channel:** ${channelMention(channel.id)}
|
||||
**Slowmode:** ${seconds} seconds
|
||||
**Mod:** ${userMention(interaction.user.id)}
|
||||
`,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.user.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: " ID: " + channel.id,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.user.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: " ID: " + channel.id
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: `Set the slowmode of ${channel} to ${seconds} seconds.`,
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: `Set the slowmode of ${channel} to ${seconds} seconds.`,
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
await channel.setRateLimitPerUser(seconds)
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -8,7 +8,7 @@ export = {
|
||||
name: "snipe",
|
||||
description: "Snipes the last deleted message of a user",
|
||||
public: true,
|
||||
dev: true,
|
||||
dev: false,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("snipe")
|
||||
@@ -17,7 +17,7 @@ export = {
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to snipe")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false),
|
||||
|
||||
@@ -26,19 +26,17 @@ export = {
|
||||
const member = interaction.options.getMember("user") as GuildMember
|
||||
const snipeCache = await snipeCacheSchema.find({
|
||||
userid: member.user.id,
|
||||
channelid: interaction.channel!.id,
|
||||
channelid: interaction.channel!.id
|
||||
})
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
const messages: string[] = []
|
||||
|
||||
if (!snipeCache.length) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "No messages to snipe",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "No messages to snipe",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -50,32 +48,28 @@ export = {
|
||||
messages.push(`**Message #${i}:** ${data.content}\n`)
|
||||
} else {
|
||||
messages.push(`**Message #${i}:** ${data.content}`)
|
||||
messages.push(
|
||||
`**Attachments:** ${data.attachments.join(", ")}\n`,
|
||||
)
|
||||
messages.push(`**Attachments:** ${data.attachments.join(", ")}\n`)
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
author: {
|
||||
name: member.user.username,
|
||||
icon_url: member.user.avatarURL() || undefined,
|
||||
},
|
||||
description: messages.join("\n"),
|
||||
thumbnail: {
|
||||
url: member.user.avatarURL() || "",
|
||||
},
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + member.user.id,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
embeds: [{
|
||||
author: {
|
||||
name: member.user.username,
|
||||
icon_url: member.user.avatarURL() || undefined
|
||||
},
|
||||
],
|
||||
description: messages.join("\n"),
|
||||
thumbnail: {
|
||||
url: member.user.avatarURL() || ""
|
||||
},
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + member.user.id,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -18,7 +18,7 @@ export = {
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName("help")
|
||||
.setDescription("Get help with staff commands"),
|
||||
.setDescription("Get help with staff commands")
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
@@ -28,15 +28,13 @@ export = {
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("The IGN of the player.")
|
||||
.setRequired(true),
|
||||
),
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName("updatediscordroles")
|
||||
.setDescription(
|
||||
"Update the discord roles of all guild members",
|
||||
),
|
||||
.setDescription("Update the discord roles of all guild members")
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -61,16 +59,14 @@ export = {
|
||||
}
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description: "This command is currently under development",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "This command is currently under development",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,27 +1,9 @@
|
||||
import {
|
||||
bwwins,
|
||||
beastbwfkdr,
|
||||
beastbwstars,
|
||||
beastswkdr,
|
||||
beastswstars,
|
||||
beastduelswins,
|
||||
duelswlr,
|
||||
} from "config/reqs.json"
|
||||
import { bwwins, beastbwfkdr, beastbwstars, beastswkdr, beastswstars, beastduelswins, 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 { ChatInputCommandInteraction } from "discord.js"
|
||||
|
||||
export default async function beast(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
export default async function beast(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
await interaction.deferReply()
|
||||
|
||||
const ign = interaction.options.getString("ign")!
|
||||
@@ -33,46 +15,38 @@ export default async function beast(
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -94,12 +68,10 @@ export default async function beast(
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(uuid)
|
||||
@@ -124,164 +96,119 @@ export default async function beast(
|
||||
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 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 hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0
|
||||
const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0
|
||||
const hsbwfkdr = hsbwfk / hsbwfd || 0
|
||||
const hsbwwins = player.stats.Bedwars.wins_bedwars || 0
|
||||
|
||||
let bwtitle = ""
|
||||
if (
|
||||
hsbwstars < beastbwstars ||
|
||||
hsbwfkdr < beastbwfkdr ||
|
||||
hsbwwins < bwwins
|
||||
) {
|
||||
bwtitle =
|
||||
"<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements."
|
||||
if (hsbwstars < beastbwstars || hsbwfkdr < beastbwfkdr || 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() +
|
||||
" / " +
|
||||
beastbwstars.toString() +
|
||||
"`\n" +
|
||||
"**➺ FKDR:** `" +
|
||||
hsbwfkdr.toFixed(2).toString() +
|
||||
" / " +
|
||||
beastbwfkdr.toString() +
|
||||
"`\n" +
|
||||
"**➺ Wins:** `" +
|
||||
hsbwwins.toString() +
|
||||
" / " +
|
||||
bwwins.toString() +
|
||||
"`",
|
||||
value: "**➺ Stars:** `" + hsbwstars.toFixed(2).toString() +
|
||||
" / " + beastbwstars.toString() + "`\n" +
|
||||
"**➺ FKDR:** `" + hsbwfkdr.toFixed(2).toString() +
|
||||
" / " + beastbwfkdr.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 hsswexp = player.stats.SkyWars?.skywars_experience || 0
|
||||
const hsswkills = player.stats.SkyWars?.kills || 0
|
||||
const hsswdeaths = player.stats.SkyWars?.deaths || 0
|
||||
const hsswwins = player.stats.SkyWars?.wins || 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
|
||||
|
||||
let swtitle = ""
|
||||
if (hsswstars < beastswstars || hsswkd < beastswkdr) {
|
||||
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() +
|
||||
" / " +
|
||||
beastswstars.toString() +
|
||||
"`\n" +
|
||||
"**➺ KDR:** `" +
|
||||
hsswkd.toFixed(2).toString() +
|
||||
" / " +
|
||||
beastswkdr.toString() +
|
||||
"`\n" +
|
||||
"**➺ Wins:** `" +
|
||||
hsswwins.toString() +
|
||||
"`",
|
||||
value: "**➺ Stars:** `" + hsswstars.toFixed(2).toString() +
|
||||
" / " + beastswstars.toString() + "`\n" +
|
||||
"**➺ KDR:** `" + hsswkd.toFixed(2).toString() +
|
||||
" / " + beastswkdr.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 hsduelswlr = hsduelswins / hsduelslosses || 0
|
||||
const hsduelskills = player.stats.Duels?.kills || 0
|
||||
const hsduelsdeaths = player.stats.Duels?.deaths || 0
|
||||
const hsduelswins = player.stats.Duels?.wins || 0
|
||||
const hsduelslosses = player.stats.Duels?.losses || 0
|
||||
const hsduelskd = hsduelskills / hsduelsdeaths
|
||||
const hsduelswlr = hsduelswins / hsduelslosses
|
||||
|
||||
let duelstitle = ""
|
||||
if (hsduelswins < beastduelswins || 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() +
|
||||
" / " +
|
||||
beastduelswins.toString() +
|
||||
"`\n" +
|
||||
"**➺ WLR:** `" +
|
||||
hsduelswlr.toFixed(2).toString() +
|
||||
" / " +
|
||||
duelswlr.toString() +
|
||||
"`\n" +
|
||||
"**➺ KDR:** `" +
|
||||
hsduelskd.toFixed(2).toString() +
|
||||
"`\n",
|
||||
value: "**➺ Wins:** `" + hsduelswins.toString() +
|
||||
" / " + beastduelswins.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`"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// network level
|
||||
const hypixelExp = player.networkExp || 0
|
||||
const hypixelExp = player?.networkExp || 0
|
||||
const level = hypixelLevel(hypixelExp)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: rank + player.displayname + guildTag,
|
||||
description:
|
||||
"**Network Level:** `" +
|
||||
level.toFixed(2).toString() +
|
||||
"`\n" +
|
||||
"**Current Guild:** `" +
|
||||
guildName +
|
||||
"`",
|
||||
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 + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
},
|
||||
fields: statsFields
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@ import { ChatInputCommandInteraction } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import { ExtendedClient as Client } from "utils/Client"
|
||||
|
||||
export default async function help(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
client: Client,
|
||||
): Promise<void> {
|
||||
export default async function help(interaction: ChatInputCommandInteraction, client: Client): Promise<void> {
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
|
||||
type CommandList = {
|
||||
@@ -16,7 +13,7 @@ export default async function help(
|
||||
const commandRawList = client.commands.map(command => {
|
||||
return {
|
||||
name: command.name,
|
||||
command: command,
|
||||
command: command
|
||||
}
|
||||
})
|
||||
|
||||
@@ -26,20 +23,20 @@ export default async function help(
|
||||
if (!command.command.subcommands && !command.command.public) {
|
||||
commandList.push({
|
||||
name: "**/" + commandName + "**",
|
||||
value: "`" + command.command.description + "`",
|
||||
value: "`" + command.command.description + "`"
|
||||
})
|
||||
} else if (command.command.subcommands && !command.command.public) {
|
||||
const subcommands = command.command.data.options.map(subcommand => {
|
||||
return {
|
||||
name: commandName + " " + subcommand.toJSON().name,
|
||||
description: subcommand.toJSON().description,
|
||||
description: subcommand.toJSON().description
|
||||
}
|
||||
})
|
||||
|
||||
for (const subcommand of subcommands) {
|
||||
commandList.push({
|
||||
name: "**/" + subcommand.name + "**",
|
||||
value: "`" + subcommand.description + "`",
|
||||
value: "`" + subcommand.description + "`"
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -48,20 +45,18 @@ export default async function help(
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: "Commands",
|
||||
description: "List of commands",
|
||||
fields: commandList,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.guild!.iconURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild?.name + " | " + devMessage,
|
||||
},
|
||||
embeds: [{
|
||||
title: "Commands",
|
||||
description: "List of commands",
|
||||
fields: commandList,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: interaction.guild!.iconURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild?.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6,43 +6,36 @@ import env from "utils/Env"
|
||||
import { getGuild } from "utils/Hypixel"
|
||||
import { GuildData } from "interfaces"
|
||||
|
||||
export default async function updateDiscordRoles(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
): Promise<void> {
|
||||
export default async function updateDiscordRoles(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
const discordMember = interaction.member as GuildMember
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
await interaction.deferReply()
|
||||
|
||||
if (discordMember.user.id !== env.prod.dev) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"You do not have permission to use this command.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "You do not have permission to use this command.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const guildMembers = await interaction
|
||||
.guild!.members.fetch()
|
||||
.then(members =>
|
||||
members.map(member => {
|
||||
return {
|
||||
id: member.id,
|
||||
member: member,
|
||||
}
|
||||
}),
|
||||
)
|
||||
const guildMembers = await interaction.guild!.members.fetch().then(
|
||||
members => members.map(member => {
|
||||
return {
|
||||
id: member.id,
|
||||
member: member
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
const guildData = (await getGuild(hypixelGuildID, "id")) as GuildData
|
||||
|
||||
const hypixelGuildMembers = guildData.members.map(gmember => {
|
||||
return {
|
||||
uuid: gmember.uuid,
|
||||
rank: gmember.rank,
|
||||
rank: gmember.rank
|
||||
}
|
||||
})
|
||||
const guildMemberIDs = hypixelGuildMembers.map(gmember => gmember.uuid)
|
||||
@@ -54,138 +47,63 @@ export default async function updateDiscordRoles(
|
||||
const verifiedUsers = allVerifiedUsers.map(user => {
|
||||
return {
|
||||
userID: user.userID,
|
||||
uuid: user.uuid,
|
||||
uuid: user.uuid
|
||||
}
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: `Updating roles for ${guildMembers.length} members...`,
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: `Updating roles for ${guildMembers.length} members...`,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
for (const gmember of guildMembers) {
|
||||
const memberData = verifiedUsers.find(
|
||||
user => user.userID === gmember.id,
|
||||
)
|
||||
const memberData = verifiedUsers.find(user => user.userID === gmember.id)
|
||||
|
||||
if (!memberData) {
|
||||
const rolesToremove = roleManage("default").rolesToRemove
|
||||
await gmember.member.roles.remove(
|
||||
rolesToremove,
|
||||
"Updating all discord members",
|
||||
)
|
||||
await gmember.member.roles.remove(rolesToremove, "Updating all discord members")
|
||||
continue
|
||||
}
|
||||
|
||||
if (!guildMemberIDs.includes(memberData?.uuid || "none")) {
|
||||
const rolesToremove = roleManage("default").rolesToRemove
|
||||
await gmember.member.roles.remove(
|
||||
rolesToremove,
|
||||
"Updating all discord members",
|
||||
)
|
||||
await gmember.member.roles.remove(rolesToremove, "Updating all discord members")
|
||||
continue
|
||||
} else if (guildMemberIDs.includes(memberData!.uuid)) {
|
||||
const guildMemberRank = hypixelGuildMembers.find(
|
||||
gmember => gmember.uuid === memberData!.uuid,
|
||||
)!.rank
|
||||
const guildMemberRank = hypixelGuildMembers.find(gmember => gmember.uuid === memberData!.uuid)!.rank
|
||||
console.log("Updating roles for " + gmember.member.user.username)
|
||||
|
||||
if (guildMemberRank === "Guild Master") {
|
||||
// const rolesToRemove = removeThese.filter(role => role !== gm && role !== guildStaff && role !== guildRole)
|
||||
// await gmember.member.roles.remove(rolesToRemove, "Updating all discord members")
|
||||
// await gmember.member.roles.add( gm, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( guildStaff, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( guildRole, "Updating all discord members",)
|
||||
const rolesmanage = roleManage("gm")
|
||||
gmember.member.roles.remove(
|
||||
rolesmanage.rolesToRemove,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.add(
|
||||
rolesmanage.rolesToAdd,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members")
|
||||
gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members")
|
||||
continue
|
||||
} else if (guildMemberRank === "Manager") {
|
||||
// const rolesToRemove = removeThese.filter(role => role !== manager && role !== guildStaff && role !== guildRole)
|
||||
// await gmember.member.roles.remove( rolesToRemove, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( manager, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( guildStaff, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( guildRole, "Updating all discord members",)
|
||||
const rolesmanage = roleManage("manager")
|
||||
gmember.member.roles.remove(
|
||||
rolesmanage.rolesToRemove,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.add(
|
||||
rolesmanage.rolesToAdd,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members")
|
||||
gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members")
|
||||
continue
|
||||
} else if (guildMemberRank === "Moderator") {
|
||||
// const rolesToRemove = removeThese.filter(role => role !== moderator && role !== guildStaff && role !== guildRole)
|
||||
// await gmember.member.roles.remove( rolesToRemove, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( moderator, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( guildStaff, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( guildRole, "Updating all discord members",)
|
||||
const rolesmanage = roleManage("moderator")
|
||||
gmember.member.roles.remove(
|
||||
rolesmanage.rolesToRemove,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.add(
|
||||
rolesmanage.rolesToAdd,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members")
|
||||
gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members")
|
||||
continue
|
||||
} else if (guildMemberRank === "Beast") {
|
||||
// const rolesToRemove = removeThese.filter(role => role !== beast && role !== guildRole)
|
||||
// await gmember.member.roles.remove( rolesToRemove, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( beast, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( guildRole, "Updating all discord members",)
|
||||
const rolesmanage = roleManage("beast")
|
||||
gmember.member.roles.remove(
|
||||
rolesmanage.rolesToRemove,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.add(
|
||||
rolesmanage.rolesToAdd,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members")
|
||||
gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members")
|
||||
continue
|
||||
} else if (guildMemberRank === "Elite") {
|
||||
// const rolesToRemove = removeThese.filter(role => role !== elite && role !== guildRole)
|
||||
// await gmember.member.roles.remove( rolesToRemove, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( elite, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( guildRole, "Updating all discord members",)
|
||||
const rolesmanage = roleManage("elite")
|
||||
gmember.member.roles.remove(
|
||||
rolesmanage.rolesToRemove,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.add(
|
||||
rolesmanage.rolesToAdd,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members")
|
||||
gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members")
|
||||
continue
|
||||
} else if (guildMemberRank === "Member") {
|
||||
// const rolesToRemove = removeThese.filter(role => role !== member && role !== guildRole)
|
||||
// await gmember.member.roles.remove( rolesToRemove, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( member, "Updating all discord members",)
|
||||
// await gmember.member.roles.add( guildRole, "Updating all discord members",)
|
||||
const rolesmanage = roleManage("member")
|
||||
gmember.member.roles.remove(
|
||||
rolesmanage.rolesToRemove,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.add(
|
||||
rolesmanage.rolesToAdd,
|
||||
"Updating all discord members",
|
||||
)
|
||||
gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members")
|
||||
gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members")
|
||||
continue
|
||||
}
|
||||
continue
|
||||
@@ -195,11 +113,9 @@ export default async function updateDiscordRoles(
|
||||
console.log("Successfully updated all roles.")
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Successfully updated all roles.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Successfully updated all roles.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
userMention,
|
||||
ChatInputCommandInteraction,
|
||||
GuildMember,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, ChatInputCommandInteraction, GuildMember } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import { Command } from "interfaces"
|
||||
import ms from "ms"
|
||||
@@ -23,18 +17,18 @@ export = {
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to timeout")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("time")
|
||||
.setDescription("The time to timeout the user for")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("reason")
|
||||
.setDescription("The reason for the timeout"),
|
||||
.setDescription("The reason for the timeout")
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -44,8 +38,7 @@ export = {
|
||||
|
||||
const target = interaction.options.getMember("user")! as GuildMember
|
||||
const timeString = interaction.options.getString("time")!
|
||||
const reason =
|
||||
interaction.options.getString("reason") || "No reason provided"
|
||||
const reason = interaction.options.getString("reason") || "No reason provided"
|
||||
const mod = interaction.member! as GuildMember
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
const time = ms(timeString)
|
||||
@@ -54,65 +47,50 @@ export = {
|
||||
|
||||
if (target.user.bot) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "You cannot timeout a bot.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "You cannot timeout a bot.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (target.id == interaction.guild!.ownerId) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "You cannot timeout the server owner.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "You cannot timeout the server owner.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (
|
||||
interaction.guild!.members.me!.roles.highest.position <=
|
||||
target.roles.highest.position
|
||||
) {
|
||||
if (interaction.guild!.members.me!.roles.highest.position <= target.roles.highest.position) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"I cannot timeout this user because their role is higher than mine.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "I cannot timeout this user because their role is higher than mine.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (mod.roles.highest.position <= target.roles.highest.position) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"You cannot timeout this user because their role is higher than yours.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "You cannot timeout this user because their role is higher than yours.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (target.id == interaction.user.id) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "You cannot timeout yourself.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "You cannot timeout yourself.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -123,75 +101,55 @@ export = {
|
||||
if (target.isCommunicationDisabled()) {
|
||||
if (time === 0) {
|
||||
title = "Timeout Removed"
|
||||
;(description =
|
||||
"Removed timeout of " +
|
||||
userMention(target.id) +
|
||||
" for " +
|
||||
reason),
|
||||
(timeouttime = null)
|
||||
description = "Removed timeout of " + userMention(target.id) + " for " + reason
|
||||
timeouttime = null
|
||||
} else {
|
||||
title = "Timeout Updated"
|
||||
;(description =
|
||||
"Updated timeout of " +
|
||||
userMention(target.id) +
|
||||
" to " +
|
||||
prettyTime +
|
||||
" for " +
|
||||
reason),
|
||||
(timeouttime = time)
|
||||
description = "Updated timeout of " + userMention(target.id) + " to " + prettyTime + " for " + reason
|
||||
timeouttime = time
|
||||
}
|
||||
} else {
|
||||
title = "Member Timed Out"
|
||||
;(description =
|
||||
"Timed out " +
|
||||
userMention(target.id) +
|
||||
" for " +
|
||||
prettyTime +
|
||||
" for " +
|
||||
reason),
|
||||
(timeouttime = time)
|
||||
description = "Timed out " + userMention(target.id) + " for " + prettyTime + " for " + reason
|
||||
timeouttime = time
|
||||
}
|
||||
|
||||
await target.timeout(timeouttime, reason)
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [
|
||||
{
|
||||
author: {
|
||||
name: mod.user.username,
|
||||
icon_url: mod.user.avatarURL() || undefined,
|
||||
},
|
||||
title: title,
|
||||
description: `
|
||||
embeds: [{
|
||||
author: {
|
||||
name: mod.user.username,
|
||||
icon_url: mod.user.avatarURL() || undefined
|
||||
},
|
||||
title: title,
|
||||
description: `
|
||||
**User:** ${userMention(target.id)}
|
||||
${timeouttime === null ? "**Time:** `None`" : "**Time:** `" + prettyTime + "`"}
|
||||
**Reason:** \`${reason}\`
|
||||
**Mod:** ${userMention(mod.id)}
|
||||
`,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.user.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
text: "ID: " + target.id,
|
||||
icon_url: target.user.avatarURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.user.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: "ID: " + target.id,
|
||||
icon_url: target.user.avatarURL() || undefined
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: description,
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: description,
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
userMention,
|
||||
User,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, User } from "discord.js"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import { Command } from "interfaces"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
@@ -22,13 +17,13 @@ export = {
|
||||
.setName("user")
|
||||
.setDescription("The user to unban")
|
||||
.setAutocomplete(true)
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("reason")
|
||||
.setDescription("The reason for unbanning the user")
|
||||
.setRequired(false),
|
||||
.setRequired(false)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
|
||||
.setDMPermission(false),
|
||||
@@ -37,20 +32,17 @@ export = {
|
||||
await interaction.deferReply()
|
||||
|
||||
const userid = interaction.options.getString("user")!
|
||||
const reason =
|
||||
interaction.options.getString("reason") || "No reason provided"
|
||||
const reason = interaction.options.getString("reason") || "No reason provided"
|
||||
const mod = interaction.user
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
let user: User
|
||||
|
||||
if (userid === "none") {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "You haven't specified a user to unban",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "You haven't specified a user to unban",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -59,12 +51,10 @@ export = {
|
||||
user = await interaction.client.users.fetch(userid)
|
||||
} catch (error) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "The user you specified is not valid",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "The user you specified is not valid",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -72,54 +62,44 @@ export = {
|
||||
await interaction.guild!.members.unban(user.id, reason)
|
||||
|
||||
await logToChannel("mod", {
|
||||
embeds: [
|
||||
{
|
||||
author: {
|
||||
name: mod.username,
|
||||
icon_url: mod.avatarURL() || undefined,
|
||||
},
|
||||
title: "Member Unbanned",
|
||||
description: `
|
||||
**User:** ${userMention(user!.id)}
|
||||
**Mod:** ${userMention(mod.id)}
|
||||
**Reason:** ${reason}
|
||||
`,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
text: "ID: " + user!.id,
|
||||
icon_url: user.avatarURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
embeds: [{
|
||||
author: {
|
||||
name: mod.username,
|
||||
icon_url: mod.avatarURL() || undefined
|
||||
},
|
||||
],
|
||||
title: "Member Unbanned",
|
||||
description: `
|
||||
**User:** ${userMention(user!.id)}
|
||||
**Mod:** ${userMention(mod.id)}
|
||||
**Reason:** ${reason}
|
||||
`,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: mod.avatarURL() || ""
|
||||
},
|
||||
footer: {
|
||||
text: "ID: " + user!.id,
|
||||
icon_url: user.avatarURL() || undefined
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: "User unbanned",
|
||||
description:
|
||||
"The user " +
|
||||
user!.username +
|
||||
" has been unbanned.\n" +
|
||||
"**Reason:** `" +
|
||||
reason +
|
||||
"`\n" +
|
||||
"**Moderator:** " +
|
||||
userMention(mod.id),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user!.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
embeds: [{
|
||||
title: "User unbanned",
|
||||
description: "The user " + user!.username + " has been unbanned.\n" +
|
||||
"**Reason:** `" + reason + "`\n" +
|
||||
"**Moderator:** " + userMention(mod.id),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user!.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -25,28 +25,23 @@ export = {
|
||||
|
||||
if (!verifyData) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"You are not verified. Please run `/verify` to verify yourself",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "You are not verified. Please run `/verify` to verify yourself",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = await getGuild(verifyData.uuid)
|
||||
@@ -61,139 +56,87 @@ export = {
|
||||
const head = await getHeadURL(ign)
|
||||
if (guildID !== hypixelGuildID) {
|
||||
const roles = roleManage("default")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Updated your roles to `Default Member`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
description: "Updated your roles to `Default Member`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (guildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(
|
||||
member => member.uuid === verifyData.uuid,
|
||||
)!.rank
|
||||
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid)!.rank
|
||||
let replyRank: string | null = null
|
||||
|
||||
await user.roles.add(
|
||||
roleManage("default").rolesToAdd,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.add(roleManage("default").rolesToAdd, "User used the update command")
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Guild Master"
|
||||
}
|
||||
|
||||
if (guildRank === "Manager") {
|
||||
const roles = roleManage("manager")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Manager"
|
||||
}
|
||||
|
||||
if (guildRank === "Moderator") {
|
||||
const roles = roleManage("moderator")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Moderator"
|
||||
}
|
||||
|
||||
if (guildRank === "Beast") {
|
||||
const roles = roleManage("beast")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Beast"
|
||||
}
|
||||
|
||||
if (guildRank === "Elite") {
|
||||
const roles = roleManage("elite")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Elite"
|
||||
}
|
||||
|
||||
if (guildRank === "Member") {
|
||||
const roles = roleManage("member")
|
||||
await user.roles.remove(
|
||||
roles.rolesToRemove,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.add(
|
||||
roles.rolesToAdd,
|
||||
"User used the update command",
|
||||
)
|
||||
await user.roles.remove(roles.rolesToRemove, "User used the update command")
|
||||
await user.roles.add(roles.rolesToAdd, "User used the update command")
|
||||
replyRank = "Member"
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Updated your roles to `" + replyRank + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
description: "Updated your roles to `" + replyRank + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -16,7 +16,7 @@ export = {
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("Player's name")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false),
|
||||
|
||||
@@ -32,37 +32,28 @@ export = {
|
||||
|
||||
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: [
|
||||
{
|
||||
title: newIgn,
|
||||
description:
|
||||
"**UUID:** `" +
|
||||
uuid +
|
||||
"`\n" +
|
||||
"**Formatted UUID:** `" +
|
||||
formattedUuid +
|
||||
"`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
title: newIgn,
|
||||
description: "**UUID:** `" + uuid + "`\n" +
|
||||
"**Formatted UUID:** `" + formattedUuid + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -21,7 +21,7 @@ export = {
|
||||
option
|
||||
.setName("ign")
|
||||
.setDescription("Your in-game name.")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDMPermission(false),
|
||||
|
||||
@@ -34,69 +34,53 @@ export = {
|
||||
|
||||
const verifyData = await verify.findOne({ userID: user.id })
|
||||
if (verifyData) {
|
||||
interaction.editReply(
|
||||
"You are already verified.\n" +
|
||||
"Try running /update to update your roles.",
|
||||
)
|
||||
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
|
||||
return
|
||||
}
|
||||
|
||||
if (!ign) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"<a:cross_a:1087808606897983539> Please provide your in-game name.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:cross_a:1087808606897983539> Please provide your in-game name.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
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:
|
||||
"<a:questionmark_pink:1130206038008803488> That player does not exist.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:questionmark_pink:1130206038008803488> That player does not 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)) as PlayerData
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -109,60 +93,40 @@ export = {
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Checking your Discord tag...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Checking your Discord tag...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const linkedDiscord = player?.socialMedia?.links?.DISCORD || null
|
||||
if (!linkedDiscord) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"<a:cross_a:1087808606897983539> There is no Discord account linked to `" +
|
||||
player.displayname +
|
||||
"`.\n\n" +
|
||||
"**Please set your Discord tag on hypixel to `" +
|
||||
username +
|
||||
"` and try again.**",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:cross_a:1087808606897983539> There is no Discord account linked to `" + player.displayname + "`.\n\n" +
|
||||
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (linkedDiscord !== username) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"<a:cross_a:1087808606897983539> The Discord account linked to `" +
|
||||
player.displayname +
|
||||
"` is currently `" +
|
||||
linkedDiscord +
|
||||
"`\n\n" +
|
||||
"**Please set your Discord tag on hypixel to `" +
|
||||
username +
|
||||
"` and try again.**",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:cross_a:1087808606897983539> The Discord account linked to `" + player.displayname + "` is currently `" + linkedDiscord + "`\n\n" +
|
||||
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Fetching your guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = (await getGuild(uuid)) as GuildData | null
|
||||
@@ -175,9 +139,7 @@ export = {
|
||||
|
||||
if (guildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(
|
||||
member => member.uuid === player.uuid,
|
||||
)!.rank
|
||||
const guildRank = GuildMembers.find(member => member.uuid === player.uuid)!.rank
|
||||
|
||||
if (guildRank === "Guild Master") {
|
||||
const roles = roleManage("gm")
|
||||
@@ -215,31 +177,24 @@ export = {
|
||||
const newVerify = new verify({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
userID: user.id,
|
||||
uuid: uuid,
|
||||
uuid: uuid
|
||||
})
|
||||
|
||||
await newVerify.save()
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: interaction.guild!.name,
|
||||
description:
|
||||
"You have successfully verified `" +
|
||||
username +
|
||||
"` with the account `" +
|
||||
player.displayname +
|
||||
"`.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
embeds: [{
|
||||
title: interaction.guild!.name,
|
||||
description: "You have successfully verified `" + username + "` with the account `" + player.displayname + "`.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -24,12 +24,10 @@ export = {
|
||||
|
||||
if (!verifyData) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description: "You are not verified!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "You are not verified!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -38,25 +36,19 @@ export = {
|
||||
const head = await getHeadURL(ign!)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: "User Info",
|
||||
description:
|
||||
"**User:** " +
|
||||
userMention(user.id) +
|
||||
"\n**IGN:** `" +
|
||||
ign +
|
||||
"`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
title: "User Info",
|
||||
description: "**User:** " + userMention(user.id) +
|
||||
"\n**IGN:** `" + ign + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
userMention,
|
||||
} from "discord.js"
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention } from "discord.js"
|
||||
import { getIGN, getHeadURL } from "utils/Hypixel"
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import verify from "schemas/verifySchema"
|
||||
@@ -21,7 +17,7 @@ export = {
|
||||
option
|
||||
.setName("user")
|
||||
.setDescription("The user to get the ign of.")
|
||||
.setRequired(true),
|
||||
.setRequired(true)
|
||||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.setDMPermission(false),
|
||||
@@ -34,9 +30,7 @@ export = {
|
||||
|
||||
const verifiedUser = await verify.findOne({ userID: user.id })
|
||||
if (!verifiedUser) {
|
||||
interaction.editReply({
|
||||
content: "This user has not verified their account.",
|
||||
})
|
||||
interaction.editReply("You are not verified!")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -44,24 +38,19 @@ export = {
|
||||
const head = await getHeadURL(ign)
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: interaction.guild!.name,
|
||||
description:
|
||||
"**User:** " +
|
||||
userMention(user.id) +
|
||||
"\n**IGN:** " +
|
||||
ign,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
},
|
||||
embeds: [{
|
||||
title: interaction.guild!.name,
|
||||
description: "**User:** " + userMention(user.id) +
|
||||
"\n**IGN:** " + ign,
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
icon_url: interaction.guild!.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Command
|
||||
|
||||
@@ -9,29 +9,23 @@ export = {
|
||||
if (focusedOption.name !== "user") return
|
||||
|
||||
if (focusedOption.value === "") {
|
||||
await interaction.respond([
|
||||
{
|
||||
name: "Please start typing a username to unban",
|
||||
value: "none",
|
||||
},
|
||||
])
|
||||
await interaction.respond([{
|
||||
name: "Please start typing a username to unban",
|
||||
value: "none"
|
||||
}])
|
||||
return
|
||||
}
|
||||
|
||||
const bannedUsers = await interaction.guild!.bans.fetch()
|
||||
const filteredUsers = bannedUsers.filter(user =>
|
||||
user.user.username
|
||||
.toLowerCase()
|
||||
.includes(focusedOption.value.toLowerCase()),
|
||||
)
|
||||
const filteredUsers = bannedUsers.filter(user => user.user.username.toLowerCase().includes(focusedOption.value.toLowerCase()))
|
||||
|
||||
const results = filteredUsers.map(user => ({
|
||||
name: user.user.username,
|
||||
value: user.user.id,
|
||||
value: user.user.id
|
||||
}))
|
||||
|
||||
await interaction.respond(results.slice(0, 25)).catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Autocomplete
|
||||
|
||||
@@ -1,22 +1,7 @@
|
||||
import { color, devMessage } from "config/options.json"
|
||||
import guildapp from "schemas/guildAppSchema"
|
||||
import {
|
||||
bwfkdr,
|
||||
bwstars,
|
||||
bwwins,
|
||||
swstars,
|
||||
swkdr,
|
||||
duelswins,
|
||||
duelswlr,
|
||||
} from "config/reqs.json"
|
||||
import {
|
||||
hypixelLevel,
|
||||
bedwarsLevel,
|
||||
skywarsLevel,
|
||||
getPlayer,
|
||||
getGuild,
|
||||
getHeadURL,
|
||||
} from "utils/Hypixel"
|
||||
import { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } from "config/reqs.json"
|
||||
import { hypixelLevel, bedwarsLevel, skywarsLevel, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||
import { Button } from "interfaces"
|
||||
|
||||
export = {
|
||||
@@ -36,13 +21,10 @@ export = {
|
||||
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
|
||||
}
|
||||
@@ -93,153 +75,106 @@ 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 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 hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0
|
||||
const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0
|
||||
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() + "`"
|
||||
})
|
||||
}
|
||||
|
||||
if (player.stats.SkyWars) {
|
||||
const hsswexp = player.stats?.SkyWars?.skywars_experience || 0
|
||||
const hsswexp = player.stats.SkyWars?.skywars_experience || 0
|
||||
const hsswkills = player.stats.SkyWars?.kills || 0
|
||||
const hsswdeaths = player.stats.SkyWars?.deaths || 0
|
||||
const hsswwins = player.stats.SkyWars?.wins || 0
|
||||
const hsswstars = skywarsLevel(hsswexp)
|
||||
const hsswkills = player.stats?.SkyWars?.kills || 0
|
||||
const hsswdeaths = player.stats?.SkyWars?.deaths || 0
|
||||
const hsswkd = hsswkills / hsswdeaths
|
||||
const hsswwins = player.stats?.SkyWars?.wins || 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() + "`"
|
||||
})
|
||||
}
|
||||
|
||||
if (player.stats.Duels) {
|
||||
const hsduelskills = player.stats?.Duels?.kills || 0
|
||||
const hsduelsdeaths = player.stats?.Duels?.deaths || 0
|
||||
const hsduelskills = player.stats.Duels?.kills || 0
|
||||
const hsduelsdeaths = player.stats.Duels?.deaths || 0
|
||||
const hsduelswins = player.stats.Duels?.wins || 0
|
||||
const hsduelslosses = player.stats.Duels?.losses || 0
|
||||
const hsduelskd = hsduelskills / hsduelsdeaths
|
||||
const hsduelswins = player.stats?.Duels?.wins || 0
|
||||
const hsduelslosses = player.stats?.Duels?.losses || 0
|
||||
const hsduelswlr = hsduelswins / hsduelslosses
|
||||
|
||||
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() +
|
||||
"`",
|
||||
value: "**➺ Wins:** `" + hsduelswins.toString() +
|
||||
" / " + duelswins.toString() + "`\n" +
|
||||
"**➺ WLR:** `" + hsduelswlr.toFixed(2).toString() +
|
||||
" / " + duelswlr.toString() + "`\n" +
|
||||
"**➺ KDR:** `" + hsduelskd.toFixed(2).toString() + "`"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// network level
|
||||
const hypixelExp = player.networkExp || 0
|
||||
const hypixelExp = player?.networkExp || 0
|
||||
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 Button
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
import {
|
||||
ActionRowBuilder,
|
||||
ButtonStyle,
|
||||
ButtonBuilder,
|
||||
TextChannel,
|
||||
} from "discord.js"
|
||||
import {
|
||||
color,
|
||||
waitingListChannel,
|
||||
waitingListMessage,
|
||||
hypixelGuildID,
|
||||
} from "config/options.json"
|
||||
import { ActionRowBuilder, ButtonStyle, ButtonBuilder, TextChannel } from "discord.js"
|
||||
import { color, waitingListChannel, waitingListMessage, hypixelGuildID } from "config/options.json"
|
||||
import colorLog from "utils/functions/colors"
|
||||
import mongoose from "mongoose"
|
||||
import guildapp from "schemas/guildAppSchema"
|
||||
@@ -35,8 +25,7 @@ export = {
|
||||
const applicantIGN = embed.fields[0].value.replaceAll("`", "")
|
||||
|
||||
const applicant = await guild.members.fetch(applicantId)
|
||||
const applicantUsername =
|
||||
applicant.user.username + "#" + applicant.user.discriminator
|
||||
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator
|
||||
|
||||
await message.edit({
|
||||
components: [
|
||||
@@ -55,20 +44,17 @@ export = {
|
||||
.setCustomId("checkstats")
|
||||
.setLabel("Check Stats")
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
.setDisabled(true),
|
||||
),
|
||||
],
|
||||
.setDisabled(true)
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
await applicant.send({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Your application for the Illegitimate guild has been accepted.\n\n" +
|
||||
"Make sure to leave your current guild so that we can invite you.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Your application for the Illegitimate guild has been accepted.\n\n" +
|
||||
"Make sure to leave your current guild so that we can invite you.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const applicantEntry = await guildapp.findOne({ userID: applicantId })
|
||||
@@ -80,7 +66,7 @@ export = {
|
||||
userID: applicantId,
|
||||
uuid: applicantUUID,
|
||||
IGN: applicantIGN,
|
||||
timestamp: time,
|
||||
timestamp: time
|
||||
})
|
||||
|
||||
await waitingListAdd.save()
|
||||
@@ -89,28 +75,23 @@ export = {
|
||||
await guildapp.findOneAndDelete({ userID: applicantId })
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: applicantUsername + " - Guild Application",
|
||||
description:
|
||||
"Application has been accepted by <@" + user.id + ">.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: guild.iconURL() || undefined,
|
||||
text: "ID: " + applicant.id,
|
||||
},
|
||||
embeds: [{
|
||||
title: applicantUsername + " - Guild Application",
|
||||
description: "Application has been accepted by <@" + user.id + ">.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: guild.iconURL() || undefined,
|
||||
text: "ID: " + applicant.id
|
||||
}
|
||||
}]
|
||||
})
|
||||
|
||||
if (process.env.NODE_ENV === "dev") return
|
||||
try {
|
||||
const channel = guild.channels.cache.get(
|
||||
waitingListChannel,
|
||||
) as TextChannel
|
||||
const channel = guild.channels.cache.get(waitingListChannel) as TextChannel
|
||||
const wlmessage = await channel!.messages.fetch(waitingListMessage)
|
||||
|
||||
const wlembed = wlmessage.embeds[0]
|
||||
@@ -133,30 +114,28 @@ export = {
|
||||
|
||||
fields.push({
|
||||
name: `${i + 1}. ${accepted[i].IGN}`,
|
||||
value: `TS: <t:${timestamp}:R>`,
|
||||
value: `TS: <t:${timestamp}:R>`
|
||||
})
|
||||
}
|
||||
|
||||
await wlmessage.edit({
|
||||
embeds: [
|
||||
{
|
||||
title: wlembed.title!,
|
||||
description: wlembed.description!,
|
||||
color: wlembed.color!,
|
||||
footer: {
|
||||
text: "Last updated by " + user.username,
|
||||
icon_url: user.avatarURL() || undefined,
|
||||
},
|
||||
thumbnail: wlembed.thumbnail!,
|
||||
fields: fields,
|
||||
timestamp: new Date().toISOString(),
|
||||
embeds: [{
|
||||
title: wlembed.title!,
|
||||
description: wlembed.description!,
|
||||
color: wlembed.color!,
|
||||
footer: {
|
||||
text: "Last updated by " + user.username,
|
||||
icon_url: user.avatarURL() || undefined
|
||||
},
|
||||
],
|
||||
thumbnail: wlembed.thumbnail!,
|
||||
fields: fields,
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(
|
||||
colorLog("Error while trying to update waiting list.", "red"),
|
||||
colorLog("Error while trying to update waiting list.", "red")
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Button
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
ModalBuilder,
|
||||
ActionRowBuilder,
|
||||
TextInputBuilder,
|
||||
TextInputStyle,
|
||||
} from "discord.js"
|
||||
import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"
|
||||
import { Button } from "interfaces"
|
||||
|
||||
export = {
|
||||
@@ -20,12 +15,10 @@ export = {
|
||||
.setLabel("Deny Reason")
|
||||
.setCustomId("denyreason")
|
||||
.setStyle(TextInputStyle.Paragraph)
|
||||
.setPlaceholder(
|
||||
"Enter a reason for denying the application",
|
||||
)
|
||||
.setRequired(false),
|
||||
),
|
||||
.setPlaceholder("Enter a reason for denying the application")
|
||||
.setRequired(false)
|
||||
)
|
||||
)
|
||||
await interaction.showModal(modal)
|
||||
},
|
||||
}
|
||||
} as Button
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,35 +1,13 @@
|
||||
import {
|
||||
ButtonBuilder,
|
||||
ActionRowBuilder,
|
||||
ButtonStyle,
|
||||
EmbedBuilder,
|
||||
GuildMember,
|
||||
TextChannel,
|
||||
} from "discord.js"
|
||||
import {
|
||||
gm,
|
||||
manager,
|
||||
moderator,
|
||||
beast,
|
||||
member,
|
||||
guildStaff,
|
||||
guildRole,
|
||||
} from "config/roles.json"
|
||||
import { ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder, GuildMember, TextChannel } from "discord.js"
|
||||
import { gm, manager, moderator, beast, member, guildStaff, guildRole } from "config/roles.json"
|
||||
import { ignM, smallM, largeM } from "config/limitmessages.json"
|
||||
import { inactivity } from "config/questions.json"
|
||||
import { color, inactivityLogChannel } from "config/options.json"
|
||||
import { Button } from "interfaces"
|
||||
const guildRoles = [
|
||||
gm,
|
||||
manager,
|
||||
moderator,
|
||||
beast,
|
||||
member,
|
||||
guildStaff,
|
||||
guildRole,
|
||||
]
|
||||
import { getIGN } from "utils/Hypixel"
|
||||
const guildRoles = [gm, manager, moderator, beast, member, guildStaff, guildRole]
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
name: "guildinactivitylog",
|
||||
description: "Configure the bot.",
|
||||
|
||||
@@ -38,12 +16,11 @@ module.exports = {
|
||||
const user = interaction.member as GuildMember
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
const userRoles = user.roles.cache
|
||||
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"
|
||||
|
||||
if (!userRoles.some(role => guildRoles.includes(role.id))) {
|
||||
return await interaction.reply({
|
||||
content: "Only guild members can use this button.",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
|
||||
@@ -62,42 +39,37 @@ module.exports = {
|
||||
.setDescription("You have cancelled your application.")
|
||||
.setColor(embedColor)
|
||||
const attachments = new EmbedBuilder()
|
||||
.setDescription(
|
||||
"You have uploaded an attachment. Please do not upload images, videos, or GIFS.",
|
||||
)
|
||||
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
|
||||
.setColor(embedColor)
|
||||
|
||||
try {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "Guild Inactivity Log",
|
||||
description:
|
||||
"Please answer the following questions to submit an inactivity log for the guild.\n" +
|
||||
"If you wish to cancel your form, please press type `cancel` at any time.\n" +
|
||||
"If you wish to proceed with your form, please type `yes`.\n\n" +
|
||||
"**Do not upload images, videos, or GIFS.**\n" +
|
||||
"You have a minute to respond to this message.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "Guild Inactivity Log",
|
||||
description: "Please answer the following questions to submit an inactivity log for the guild.\n" +
|
||||
"If you wish to cancel your form, please press type `cancel` at any time.\n" +
|
||||
"If you wish to proceed with your form, please type `yes`.\n\n" +
|
||||
"**Do not upload images, videos, or GIFS.**\n" +
|
||||
"You have a minute to respond to this message.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
} catch (error) {
|
||||
return await interaction.reply({
|
||||
content: "Please enable your DMs.",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
|
||||
await interaction.reply({
|
||||
content: "Please check your DMs.",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
|
||||
const input = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60,
|
||||
time: 1000 * 60
|
||||
})
|
||||
if (input.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
@@ -113,26 +85,20 @@ module.exports = {
|
||||
}
|
||||
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Question 1**",
|
||||
description:
|
||||
sq(1) +
|
||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
||||
ignM +
|
||||
"`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 5 minutes to respond to this message.",
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "**Question 1**",
|
||||
description: sq(1) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 5 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
|
||||
const answer1 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
if (answer1.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
@@ -140,27 +106,10 @@ module.exports = {
|
||||
}
|
||||
if (answer1.first()!.content.length > 16) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 16.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
})
|
||||
return
|
||||
}
|
||||
try {
|
||||
await fetch(mojangAPI + answer1.first()!.content)
|
||||
} catch (error) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"That is not a valid Minecraft username.\n" +
|
||||
"Application cancelled.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Max character limit is 16.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -172,28 +121,32 @@ module.exports = {
|
||||
await user.send({ embeds: [cancelled] })
|
||||
return
|
||||
}
|
||||
if (await getIGN(answer1.first()!.content)) {
|
||||
await user.send({
|
||||
embeds: [{
|
||||
description: "That is not a valid Minecraft username.\n" +
|
||||
"Application cancelled.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
const answer1_1 = answer1.first()!.content
|
||||
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Question 2**",
|
||||
description:
|
||||
sq(2) +
|
||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
||||
smallM +
|
||||
"`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 5 minutes to respond to this message.",
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "**Question 2**",
|
||||
description: sq(2) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 5 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer2 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
if (answer2.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
@@ -201,12 +154,10 @@ module.exports = {
|
||||
}
|
||||
if (answer2.first()!.content.length > 128) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 128.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Max character limit is 128.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -221,25 +172,19 @@ module.exports = {
|
||||
const answer2_1 = answer1.first()!.content
|
||||
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Question 3**",
|
||||
description:
|
||||
sq(3) +
|
||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
||||
largeM +
|
||||
"`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message.",
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "**Question 3**",
|
||||
description: sq(3) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer3 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer3.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
@@ -247,12 +192,10 @@ module.exports = {
|
||||
}
|
||||
if (answer3.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 256",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Max character limit is 256",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -267,18 +210,15 @@ module.exports = {
|
||||
const answer3_1 = answer1.first()!.content
|
||||
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"If you want to submit your application, type `yes` if not, type `no`",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "If you want to submit your application, type `yes` if not, type `no`",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
const final = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
if (final.first()!.attachments.size > 0) {
|
||||
await user.send({ embeds: [attachments] })
|
||||
@@ -294,50 +234,40 @@ module.exports = {
|
||||
}
|
||||
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Your application has been submitted!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Your application has been submitted!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const appChannel = guild.channels.cache.get(
|
||||
inactivityLogChannel,
|
||||
) as TextChannel
|
||||
const appChannel = guild.channels.cache.get(inactivityLogChannel) as TextChannel
|
||||
|
||||
await appChannel.send({
|
||||
embeds: [
|
||||
{
|
||||
title:
|
||||
user.user.username +
|
||||
"#" +
|
||||
user.user.discriminator +
|
||||
" - Inactivity Application",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user.avatarURL() || "",
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: rq(1),
|
||||
value: "`" + answer1_1 + "`",
|
||||
},
|
||||
{
|
||||
name: rq(2),
|
||||
value: "`" + answer2_1 + "`",
|
||||
},
|
||||
{
|
||||
name: rq(3),
|
||||
value: "`" + answer3_1 + "`",
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: user.avatarURL() || undefined,
|
||||
text: "ID: " + user.user.id,
|
||||
},
|
||||
embeds: [{
|
||||
title: user.user.username + "#" + user.user.discriminator + " - Inactivity Application",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
fields: [
|
||||
{
|
||||
name: rq(1),
|
||||
value: "`" + answer1_1 + "`"
|
||||
},
|
||||
{
|
||||
name: rq(2),
|
||||
value: "`" + answer2_1 + "`"
|
||||
},
|
||||
{
|
||||
name: rq(3),
|
||||
value: "`" + answer3_1 + "`"
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
icon_url: user.avatarURL() || undefined,
|
||||
text: "ID: " + user.user.id
|
||||
}
|
||||
}],
|
||||
components: [
|
||||
new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
@@ -347,9 +277,9 @@ module.exports = {
|
||||
new ButtonBuilder()
|
||||
.setCustomId("inactiveapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
),
|
||||
],
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
)
|
||||
]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Button
|
||||
|
||||
@@ -7,7 +7,7 @@ export = {
|
||||
async execute(interaction) {
|
||||
await interaction.reply({
|
||||
content: "This button is currently disabled.",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Button
|
||||
|
||||
@@ -7,7 +7,7 @@ export = {
|
||||
async execute(interaction) {
|
||||
await interaction.reply({
|
||||
content: "This button is currently disabled.",
|
||||
ephemeral: true,
|
||||
ephemeral: true
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Button
|
||||
|
||||
@@ -19,17 +19,13 @@ export = {
|
||||
const applicantId = embed.footer!.text.split(" ")[1]
|
||||
|
||||
const applicant = await guild.members.fetch(applicantId)
|
||||
const applicantUsername =
|
||||
applicant.user.username + "#" + applicant.user.discriminator
|
||||
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator
|
||||
|
||||
await applicant.send({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"Your application for the Illegitimate staff team has been accepted.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Your application for the Illegitimate staff team has been accepted.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
await message.edit({
|
||||
@@ -44,28 +40,26 @@ export = {
|
||||
.setCustomId("staffapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
.setDisabled(true),
|
||||
),
|
||||
],
|
||||
.setDisabled(true)
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
await staffapp.findOneAndDelete({ userID: applicantId })
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: applicantUsername + " - Staff Application.",
|
||||
description: "Application accepted by <@" + user.id + ">.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: guild.iconURL() || undefined,
|
||||
text: "ID: " + applicantId,
|
||||
},
|
||||
embeds: [{
|
||||
title: applicantUsername + " - Staff Application.",
|
||||
description: "Application accepted by <@" + user.id + ">.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: guild.iconURL() || undefined,
|
||||
text: "ID: " + applicantId
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Button
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
ModalBuilder,
|
||||
ActionRowBuilder,
|
||||
TextInputBuilder,
|
||||
TextInputStyle,
|
||||
} from "discord.js"
|
||||
import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"
|
||||
import { Button } from "interfaces"
|
||||
|
||||
export = {
|
||||
@@ -20,12 +15,10 @@ export = {
|
||||
.setLabel("Deny Reason")
|
||||
.setCustomId("staffdenyreason")
|
||||
.setStyle(TextInputStyle.Paragraph)
|
||||
.setPlaceholder(
|
||||
"Enter a reason for denying the application",
|
||||
)
|
||||
.setRequired(false),
|
||||
),
|
||||
.setPlaceholder( "Enter a reason for denying the application")
|
||||
.setRequired(false)
|
||||
)
|
||||
)
|
||||
await interaction.showModal(modal)
|
||||
},
|
||||
}
|
||||
} as Button
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
import {
|
||||
ButtonBuilder,
|
||||
ButtonStyle,
|
||||
ActionRowBuilder,
|
||||
EmbedBuilder,
|
||||
GuildMember,
|
||||
TextChannel,
|
||||
} from "discord.js"
|
||||
import { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder, GuildMember, TextChannel } from "discord.js"
|
||||
import { color, staffApplicationsChannel } from "config/options.json"
|
||||
import { largeM, ignM } from "config/limitmessages.json"
|
||||
import questions from "config/questions.json"
|
||||
@@ -43,17 +36,13 @@ export = {
|
||||
|
||||
if (user.user.id !== env.prod.dev) {
|
||||
if (status === "0") {
|
||||
await interaction.editReply(
|
||||
"Staff applications are currently closed.",
|
||||
)
|
||||
await interaction.editReply("Staff applications are currently closed.")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (!userRoles.has(guildRole)) {
|
||||
await interaction.editReply(
|
||||
"You must be a member of the guild to apply for staff.",
|
||||
)
|
||||
await interaction.editReply("You must be a member of the guild to apply for staff.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -65,9 +54,7 @@ export = {
|
||||
const application = await staffapp.findOne({ userID: user.user.id })
|
||||
|
||||
if (application) {
|
||||
await interaction.editReply(
|
||||
"You already have an application in progress.",
|
||||
)
|
||||
await interaction.editReply("You already have an application in progress.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -78,23 +65,18 @@ export = {
|
||||
.setDescription("You have cancelled your application.")
|
||||
.setColor(embedColor)
|
||||
const attachments = new EmbedBuilder()
|
||||
.setDescription(
|
||||
"You have uploaded an attachment. Please do not upload images, videos, or GIFS.",
|
||||
)
|
||||
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
|
||||
.setColor(embedColor)
|
||||
|
||||
try {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "Staff Application",
|
||||
description:
|
||||
"If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" +
|
||||
"**Do not upload images, videos, or GIFS.**\n" +
|
||||
"You have a minute to respond to this message.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "Staff Application",
|
||||
description: "If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" +
|
||||
"**Do not upload images, videos, or GIFS.**\n" +
|
||||
"You have a minute to respond to this message.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
} catch (error) {
|
||||
await interaction.editReply("Please enable your DMs.")
|
||||
@@ -106,7 +88,7 @@ export = {
|
||||
const input = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60,
|
||||
time: 1000 * 60
|
||||
})
|
||||
if (input.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
@@ -123,25 +105,19 @@ export = {
|
||||
|
||||
// first question
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Question 1**",
|
||||
description:
|
||||
sq(1) +
|
||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
||||
ignM +
|
||||
"`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 5 minutes to respond to this message.",
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "**Question 1**",
|
||||
description: sq(1) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 5 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer1 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
if (answer1.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
@@ -157,26 +133,21 @@ export = {
|
||||
}
|
||||
if (answer1.first()!.content.length > 16) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 16.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Max character limit is 16.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
const uuid = await getUUID(answer1.first()!.content)
|
||||
if (!uuid) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"That is not a valid Minecraft username.\n" +
|
||||
"Application cancelled.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "That is not a valid Minecraft username.\n" +
|
||||
"Application cancelled.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -184,24 +155,20 @@ export = {
|
||||
|
||||
// second question
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Question 2**",
|
||||
description:
|
||||
sq(2) +
|
||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n" +
|
||||
"`(64 characters max)`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message.",
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "**Question 2**",
|
||||
description: sq(2) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" +
|
||||
"`(64 characters max)`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer2 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer2.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
@@ -217,12 +184,10 @@ export = {
|
||||
}
|
||||
if (answer2.first()!.content.length > 64) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 64.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Max character limit is 64.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -230,25 +195,19 @@ export = {
|
||||
|
||||
// third question
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Question 3**",
|
||||
description:
|
||||
sq(3) +
|
||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
||||
largeM +
|
||||
"`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message.",
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "**Question 3**",
|
||||
description: sq(3) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer3 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer3.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
@@ -264,37 +223,29 @@ export = {
|
||||
}
|
||||
if (answer3.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer3_1 = answer3.first()!.content
|
||||
|
||||
// fourth question
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Question 4**",
|
||||
description:
|
||||
sq(4) +
|
||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
||||
largeM +
|
||||
"`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message.",
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "**Question 4**",
|
||||
description: sq(4) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer4 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer4.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
@@ -310,37 +261,29 @@ export = {
|
||||
}
|
||||
if (answer4.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer4_1 = answer4.first()!.content
|
||||
|
||||
// fifth question
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Question 5**",
|
||||
description:
|
||||
sq(5) +
|
||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
||||
largeM +
|
||||
"`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message.",
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "**Question 5**",
|
||||
description: sq(5) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer5 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer5.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
@@ -356,38 +299,30 @@ export = {
|
||||
}
|
||||
if (answer5.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer5_1 = answer5.first()!.content
|
||||
|
||||
// sixth question
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Question 6**",
|
||||
description:
|
||||
sq(6) +
|
||||
"\n\nPlease type your answer below or type `cancel` to cancel your application." +
|
||||
"`(We expect a longer answer here)`\n`" +
|
||||
largeM +
|
||||
"`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message.",
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "**Question 6**",
|
||||
description: sq(6) + "\n\nPlease type your answer below or type `cancel` to cancel your application." +
|
||||
"`(We expect a longer answer here)`\n`" + largeM + "`",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "You have 15 minutes to respond to this message."
|
||||
}
|
||||
}]
|
||||
})
|
||||
const answer6 = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 15,
|
||||
time: 1000 * 60 * 15
|
||||
})
|
||||
if (answer6.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
@@ -403,30 +338,25 @@ export = {
|
||||
}
|
||||
if (answer6.first()!.content.length > 256) {
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Max character limit is 256.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
const answer6_1 = answer6.first()!.content
|
||||
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"If you want to submit your application, type `yes` if not, type `no`",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "If you want to submit your application, type `yes` if not, type `no`",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const final = await user.dmChannel!.awaitMessages({
|
||||
filter: m => m.author.id === user.user.id,
|
||||
max: 1,
|
||||
time: 1000 * 60 * 5,
|
||||
time: 1000 * 60 * 5
|
||||
})
|
||||
if (final.size === 0) {
|
||||
await user.send({ embeds: [tooLong] })
|
||||
@@ -442,71 +372,61 @@ export = {
|
||||
}
|
||||
|
||||
await user.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Your application has been submitted!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Your application has been submitted!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const newStaffApp = new staffapp({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
userID: user.user.id,
|
||||
uuid: uuid,
|
||||
uuid: uuid
|
||||
})
|
||||
|
||||
await newStaffApp.save()
|
||||
await user.deleteDM()
|
||||
|
||||
const channel = guild.channels.cache.get(
|
||||
staffApplicationsChannel,
|
||||
) as TextChannel
|
||||
const channel = guild.channels.cache.get(staffApplicationsChannel) as TextChannel
|
||||
|
||||
await channel.send({
|
||||
embeds: [
|
||||
{
|
||||
title:
|
||||
user.user.username +
|
||||
"#" +
|
||||
user.user.discriminator +
|
||||
" - Staff Application",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user.avatarURL() || "",
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: rq(1),
|
||||
value: "```" + answer1_1 + "```",
|
||||
},
|
||||
{
|
||||
name: rq(2),
|
||||
value: "```" + answer2_1 + "```",
|
||||
},
|
||||
{
|
||||
name: rq(3),
|
||||
value: "```" + answer3_1 + "```",
|
||||
},
|
||||
{
|
||||
name: rq(4),
|
||||
value: "```" + answer4_1 + "```",
|
||||
},
|
||||
{
|
||||
name: rq(5),
|
||||
value: "```" + answer5_1 + "```",
|
||||
},
|
||||
{
|
||||
name: rq(6),
|
||||
value: "```" + answer6_1 + "```",
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: guild.iconURL() || undefined,
|
||||
text: "ID: " + user.user.id,
|
||||
},
|
||||
embeds: [{
|
||||
title: user.user.username + "#" + user.user.discriminator + " - Staff Application",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: user.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
fields: [
|
||||
{
|
||||
name: rq(1),
|
||||
value: "```" + answer1_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(2),
|
||||
value: "```" + answer2_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(3),
|
||||
value: "```" + answer3_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(4),
|
||||
value: "```" + answer4_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(5),
|
||||
value: "```" + answer5_1 + "```"
|
||||
},
|
||||
{
|
||||
name: rq(6),
|
||||
value: "```" + answer6_1 + "```"
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
icon_url: guild.iconURL() || undefined,
|
||||
text: "ID: " + user.user.id
|
||||
}
|
||||
}],
|
||||
components: [
|
||||
new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
@@ -516,10 +436,10 @@ export = {
|
||||
new ButtonBuilder()
|
||||
.setCustomId("staffapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
),
|
||||
],
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
)
|
||||
]
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Button
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
ModalBuilder,
|
||||
ActionRowBuilder,
|
||||
TextInputBuilder,
|
||||
TextInputStyle,
|
||||
} from "discord.js"
|
||||
import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"
|
||||
import { Button } from "interfaces"
|
||||
|
||||
export = {
|
||||
@@ -23,9 +18,9 @@ export = {
|
||||
.setPlaceholder("Enter your ign.")
|
||||
.setRequired(true)
|
||||
.setMinLength(3)
|
||||
.setMaxLength(16),
|
||||
),
|
||||
.setMaxLength(16)
|
||||
)
|
||||
)
|
||||
await interaction.showModal(modal)
|
||||
},
|
||||
}
|
||||
} as Button
|
||||
|
||||
@@ -32,27 +32,25 @@ export = {
|
||||
|
||||
fields.push({
|
||||
name: `${i + 1}. ${accepted[i].IGN}`,
|
||||
value: `TS: <t:${timestamp}:R>`,
|
||||
value: `TS: <t:${timestamp}:R>`
|
||||
})
|
||||
}
|
||||
|
||||
await message.edit({
|
||||
embeds: [
|
||||
{
|
||||
title: embed.title!,
|
||||
description: embed.description!,
|
||||
color: embed.color!,
|
||||
footer: {
|
||||
text: "Last updated by " + user.username,
|
||||
icon_url: user.avatarURL() || undefined,
|
||||
},
|
||||
thumbnail: embed.thumbnail!,
|
||||
fields: fields,
|
||||
timestamp: new Date().toISOString(),
|
||||
embeds: [{
|
||||
title: embed.title!,
|
||||
description: embed.description!,
|
||||
color: embed.color!,
|
||||
footer: {
|
||||
text: "Last updated by " + user.username,
|
||||
icon_url: user.avatarURL() || undefined
|
||||
},
|
||||
],
|
||||
thumbnail: embed.thumbnail!,
|
||||
fields: fields,
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
|
||||
await interaction.editReply("Updated the waiting list")
|
||||
},
|
||||
}
|
||||
} as Button
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
import {
|
||||
EmbedBuilder,
|
||||
ActionRowBuilder,
|
||||
ButtonBuilder,
|
||||
ButtonStyle,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from "discord.js"
|
||||
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, Message, GuildMember } from "discord.js"
|
||||
import { color } from "config/options.json"
|
||||
import guildapp from "schemas/guildAppSchema"
|
||||
import { Modal } from "interfaces"
|
||||
@@ -22,9 +15,7 @@ export = {
|
||||
const embed = message.embeds[0]
|
||||
const applicantId = embed.footer!.text.split(" ")[1]
|
||||
|
||||
const reason =
|
||||
interaction.fields.fields.get("denyreason")!.value ||
|
||||
"No reason provided"
|
||||
const reason = interaction.fields.fields.get("denyreason")!.value || "No reason provided"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
await message.edit({
|
||||
@@ -44,9 +35,9 @@ export = {
|
||||
.setCustomId("checkstats")
|
||||
.setLabel("Check Stats")
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
.setDisabled(true),
|
||||
),
|
||||
],
|
||||
.setDisabled(true)
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
let applicant: GuildMember | null
|
||||
@@ -57,35 +48,25 @@ export = {
|
||||
}
|
||||
|
||||
const dmMessage = new EmbedBuilder()
|
||||
.setDescription(
|
||||
"Your application for the Illegitimate guild has been denied\n" +
|
||||
"**Reason:** `" +
|
||||
reason +
|
||||
"`",
|
||||
.setDescription("Your application for the Illegitimate guild has been denied\n" +
|
||||
"**Reason:** `" + reason + "`"
|
||||
)
|
||||
.setColor(embedColor)
|
||||
|
||||
const missingUser = new EmbedBuilder()
|
||||
.setDescription(
|
||||
"[WARN] User has left the server and cannot be notified.",
|
||||
)
|
||||
.setDescription("[WARN] User has left the server and cannot be notified.")
|
||||
.setColor(embedColor)
|
||||
|
||||
const responseEmbed = new EmbedBuilder()
|
||||
.setTitle("Application Denied")
|
||||
.setDescription(
|
||||
"The application has been denied by <@" +
|
||||
interaction.user.id +
|
||||
">.\n" +
|
||||
"**Reason:** `" +
|
||||
reason +
|
||||
"`",
|
||||
.setDescription("The application has been denied by <@" + interaction.user.id + ">.\n" +
|
||||
"**Reason:** `" + reason + "`"
|
||||
)
|
||||
.setColor(embedColor)
|
||||
.setThumbnail(guild.iconURL() || "")
|
||||
.setFooter({
|
||||
iconURL: guild.iconURL() || undefined,
|
||||
text: "ID: " + applicantId,
|
||||
text: "ID: " + applicantId
|
||||
})
|
||||
|
||||
if (applicant !== null) {
|
||||
@@ -102,7 +83,7 @@ export = {
|
||||
await guildapp.findOneAndDelete({ userID: applicantId })
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: responseEmbeds,
|
||||
embeds: responseEmbeds
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Modal
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
EmbedBuilder,
|
||||
ActionRowBuilder,
|
||||
ButtonBuilder,
|
||||
ButtonStyle,
|
||||
} from "discord.js"
|
||||
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"
|
||||
import { color } from "config/options.json"
|
||||
import staffapp from "schemas/staffAppSchema"
|
||||
import { Modal } from "interfaces"
|
||||
@@ -16,9 +11,7 @@ export = {
|
||||
await interaction.deferReply()
|
||||
|
||||
const guild = interaction.guild
|
||||
const reason =
|
||||
interaction.fields.fields.get("staffdenyreason")!.value ||
|
||||
"No reason provided"
|
||||
const reason = interaction.fields.fields.get("staffdenyreason")!.value || "No reason provided"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
const message = interaction.message!
|
||||
@@ -38,17 +31,14 @@ export = {
|
||||
.setCustomId("staffapplicationdeny")
|
||||
.setLabel("Deny")
|
||||
.setStyle(ButtonStyle.Danger)
|
||||
.setDisabled(true),
|
||||
),
|
||||
],
|
||||
.setDisabled(true)
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
const dmMessage = new EmbedBuilder()
|
||||
.setDescription(
|
||||
"Your application for the Illegitimate guild staff has been denied\n" +
|
||||
"**Reason:** `" +
|
||||
reason +
|
||||
"`",
|
||||
.setDescription("Your application for the Illegitimate guild staff has been denied\n" +
|
||||
"**Reason:** `" + reason + "`"
|
||||
)
|
||||
.setColor(embedColor)
|
||||
|
||||
@@ -57,26 +47,19 @@ export = {
|
||||
await staffapp.findOneAndDelete({ userID: applicantId })
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: "Application Denied",
|
||||
description:
|
||||
"The application has been denied by <@" +
|
||||
interaction.user.id +
|
||||
">.\n" +
|
||||
"**Reason:** `" +
|
||||
reason +
|
||||
"`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
icon_url: guild!.iconURL() || undefined,
|
||||
text: "ID: " + applicant.id,
|
||||
},
|
||||
embeds: [{
|
||||
title: "Application Denied",
|
||||
description: "The application has been denied by <@" + interaction.user.id + ">.\n" +
|
||||
"**Reason:** `" + reason + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: applicant.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: guild!.iconURL() || undefined,
|
||||
text: "ID: " + applicant.id
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Modal
|
||||
|
||||
@@ -2,17 +2,7 @@ import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||
import { color, hypixelGuildID, devMessage } from "config/options.json"
|
||||
import verify from "schemas/verifySchema"
|
||||
import mongoose from "mongoose"
|
||||
import {
|
||||
gm,
|
||||
manager,
|
||||
moderator,
|
||||
beast,
|
||||
elite,
|
||||
member,
|
||||
guildRole,
|
||||
guildStaff,
|
||||
defaultMember,
|
||||
} from "config/roles.json"
|
||||
import { gm, manager, moderator, beast, elite, member, guildRole, guildStaff, defaultMember } from "config/roles.json"
|
||||
import { Modal } from "interfaces"
|
||||
import { GuildMember } from "discord.js"
|
||||
|
||||
@@ -29,23 +19,17 @@ export = {
|
||||
|
||||
const verifyData = await verify.findOne({ userID: user.user.id })
|
||||
if (verifyData) {
|
||||
interaction.editReply(
|
||||
"You are already verified.\n" +
|
||||
"Try running /update to update your roles.",
|
||||
)
|
||||
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
|
||||
return
|
||||
}
|
||||
|
||||
const uuid = await getUUID(ign)
|
||||
if (!uuid) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"<a:questionmark_pink:1130206038008803488> That player does not exist.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:questionmark_pink:1130206038008803488> That player does not exist.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -54,13 +38,10 @@ export = {
|
||||
const player = await getPlayer(uuid)
|
||||
if (!player) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:questionmark_pink:1130206038008803488> That player hasn't played Hypixel before.",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -75,38 +56,22 @@ export = {
|
||||
const linkedDiscord = player?.socialMedia?.links?.DISCORD
|
||||
if (!linkedDiscord) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"<a:cross_a:1087808606897983539> There is no Discord account linked to `" +
|
||||
player.displayname +
|
||||
"`.\n\n" +
|
||||
"**Please set your Discord tag on hypixel to `" +
|
||||
username +
|
||||
"` and try again.**",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:cross_a:1087808606897983539> There is no Discord account linked to `" + player.displayname + "`.\n\n" +
|
||||
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (linkedDiscord !== username) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"<a:cross_a:1087808606897983539> The Discord account linked to `" +
|
||||
player.displayname +
|
||||
"` is currently `" +
|
||||
linkedDiscord +
|
||||
"`\n\n" +
|
||||
"**Please set your Discord tag on hypixel to `" +
|
||||
username +
|
||||
"` and try again.**",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "<a:cross_a:1087808606897983539> The Discord account linked to `" + player.displayname + "` is currently `" + linkedDiscord + "`\n\n" +
|
||||
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -121,9 +86,7 @@ export = {
|
||||
|
||||
if (guildID === hypixelGuildID) {
|
||||
const GuildMembers = guild!.members
|
||||
const guildRank = GuildMembers.find(
|
||||
member => member.uuid === player.uuid,
|
||||
)!.rank
|
||||
const guildRank = GuildMembers.find(member => member.uuid === player.uuid)!.rank
|
||||
|
||||
if (guildRank === "Guild Master" && guildID === hypixelGuildID) {
|
||||
await user.roles.add(gm, "Verification")
|
||||
@@ -163,32 +126,25 @@ export = {
|
||||
const newVerify = new verify({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
userID: user.id,
|
||||
uuid: uuid,
|
||||
uuid: uuid
|
||||
})
|
||||
|
||||
await newVerify.save()
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
title: interaction.guild!.name,
|
||||
description:
|
||||
"You have successfully verified `" +
|
||||
username +
|
||||
"` with the account `" +
|
||||
player.displayname +
|
||||
"`.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!,
|
||||
},
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage,
|
||||
},
|
||||
embeds: [{
|
||||
title: interaction.guild!.name,
|
||||
description: "You have successfully verified `" + username + "` with the account `" + player.displayname + "`.",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head!
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.guild!.name + " | " + devMessage
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Modal
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
hypixelGuildID,
|
||||
guildLogChannel,
|
||||
color,
|
||||
devMessage,
|
||||
} from "config/options.json"
|
||||
import { hypixelGuildID, guildLogChannel, color, devMessage } from "config/options.json"
|
||||
import colorLog from "utils/functions/colors"
|
||||
import { getGuild, getIGN } from "utils/Hypixel"
|
||||
import { Cron, GuildData } from "interfaces"
|
||||
@@ -22,18 +17,15 @@ async function guildWeekly() {
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
const message = await channel.send({
|
||||
embeds: [
|
||||
{
|
||||
description: "Starting to fetch guild data...",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Starting to fetch guild data...",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
|
||||
const guild = (await getGuild(hypixelGuildID, "id")) as GuildData
|
||||
const guildMembersList: string[] = []
|
||||
const topWeeklyMembers: { name: string; value: string; inline: boolean }[] =
|
||||
[]
|
||||
const topWeeklyMembers: { name: string; value: string; inline: boolean }[] = []
|
||||
|
||||
const guildName = guild.name
|
||||
const guildMembers = guild.members
|
||||
@@ -41,31 +33,22 @@ async function guildWeekly() {
|
||||
const sliceSize = guildMembers.length / 4
|
||||
|
||||
// top weekly members
|
||||
const allMembersGexpSorted = guildMembers
|
||||
.map(member => {
|
||||
return {
|
||||
uuid: member.uuid,
|
||||
exp: Object.values(member.expHistory).reduce(
|
||||
(a, b) => a + b,
|
||||
0,
|
||||
),
|
||||
}
|
||||
})
|
||||
.sort((a, b) => b.exp - a.exp)
|
||||
const allMembersGexpSorted = guildMembers.map(member => {
|
||||
return {
|
||||
uuid: member.uuid,
|
||||
exp: Object.values(member.expHistory).reduce((a, b) => a + b, 0)
|
||||
}
|
||||
}).sort((a, b) => b.exp - a.exp)
|
||||
|
||||
for (let i = 0; i < allMembersGexpSorted.length; i++) {
|
||||
const ign = await getIGN(allMembersGexpSorted[i].uuid)
|
||||
const gexp = new Intl.NumberFormat("en-US").format(
|
||||
allMembersGexpSorted[i].exp,
|
||||
)
|
||||
const gexp = new Intl.NumberFormat("en-US").format(allMembersGexpSorted[i].exp)
|
||||
const position = i + 1
|
||||
guildMembersList.push(
|
||||
"**#" + position + " " + ign + ":** `" + gexp + "`",
|
||||
)
|
||||
guildMembersList.push("**#" + position + " " + ign + ":** `" + gexp + "`")
|
||||
}
|
||||
|
||||
const list = Array.from({ length: sliceSize }, (_, i) =>
|
||||
guildMembersList.slice(i * sliceSize, (i + 1) * sliceSize),
|
||||
guildMembersList.slice(i * sliceSize, (i + 1) * sliceSize)
|
||||
)
|
||||
|
||||
list.forEach((item, index) => {
|
||||
@@ -74,51 +57,35 @@ async function guildWeekly() {
|
||||
topWeeklyMembers[index] = {
|
||||
name: "",
|
||||
value: item.join("\n"),
|
||||
inline: false,
|
||||
inline: false
|
||||
}
|
||||
})
|
||||
|
||||
// combined weekly gexp
|
||||
const allGuildMembersWeeklyXP = guildMembers.map(
|
||||
member => member.expHistory,
|
||||
)
|
||||
const allGuildMembersWeeklyXP = guildMembers.map(member => member.expHistory)
|
||||
const guildMembersWeeklyXP = allGuildMembersWeeklyXP.map(member => {
|
||||
return Object.values(member).reduce((a, b) => a + b, 0)
|
||||
})
|
||||
const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce(
|
||||
(a, b) => a + b,
|
||||
0,
|
||||
)
|
||||
const averageGuildMembersDailyXPUnformatted =
|
||||
totalGuildMembersWeeklyXPUnformatted / 7
|
||||
const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce((a, b) => a + b, 0)
|
||||
const averageGuildMembersDailyXPUnformatted = totalGuildMembersWeeklyXPUnformatted / 7
|
||||
|
||||
// final values
|
||||
const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(
|
||||
totalGuildMembersWeeklyXPUnformatted,
|
||||
)
|
||||
const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(
|
||||
averageGuildMembersDailyXPUnformatted,
|
||||
)
|
||||
const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(totalGuildMembersWeeklyXPUnformatted)
|
||||
const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(averageGuildMembersDailyXPUnformatted)
|
||||
|
||||
await message.edit({
|
||||
embeds: [
|
||||
{
|
||||
title: "**Weekly Guild XP for " + guildName + "**",
|
||||
description:
|
||||
"**Total weekly guild XP:** `" +
|
||||
totalGuildMembersWeeklyXP +
|
||||
"`\n**Average daily guild XP:** `" +
|
||||
averageGuildMembersWeeklyXP +
|
||||
"`",
|
||||
color: embedColor,
|
||||
fields: topWeeklyMembers,
|
||||
timestamp: new Date().toISOString(),
|
||||
footer: {
|
||||
text: channel.guild.name + " | " + devMessage,
|
||||
icon_url: channel.guild.iconURL() || undefined,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "**Weekly Guild XP for " + guildName + "**",
|
||||
description: "**Total weekly guild XP:** `" + totalGuildMembersWeeklyXP +
|
||||
"`\n**Average daily guild XP:** `" + averageGuildMembersWeeklyXP + "`",
|
||||
color: embedColor,
|
||||
fields: topWeeklyMembers,
|
||||
timestamp: new Date().toISOString(),
|
||||
footer: {
|
||||
text: channel.guild.name + " | " + devMessage,
|
||||
icon_url: channel.guild.iconURL() || undefined
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -129,10 +96,10 @@ export = {
|
||||
hours: 21,
|
||||
dayOfWeek: 7,
|
||||
dayOfMonth: "*",
|
||||
month: "*",
|
||||
month: "*"
|
||||
},
|
||||
execute: guildWeekly,
|
||||
onComplete: null,
|
||||
start: true,
|
||||
timeZone: "Europe/Zagreb",
|
||||
timeZone: "Europe/Zagreb"
|
||||
} as Cron
|
||||
|
||||
@@ -13,25 +13,20 @@ export = {
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
logToChannel("bot", {
|
||||
embeds: [
|
||||
{
|
||||
title: "New Member",
|
||||
description:
|
||||
userMention(member.id) +
|
||||
" has joined the server.\n" +
|
||||
"Account created: " +
|
||||
member.user.createdAt.toLocaleString(),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: member.user.avatarURL() || "",
|
||||
},
|
||||
footer: {
|
||||
text: "ID: " + member.id,
|
||||
icon_url: member.user.avatarURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
embeds: [{
|
||||
title: "New Member",
|
||||
description: userMention(member.id) + " has joined the server.\n" +
|
||||
"Account created: " + member.user.createdAt.toLocaleString(),
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: member.user.avatarURL() || ""
|
||||
},
|
||||
],
|
||||
footer: {
|
||||
text: "ID: " + member.id,
|
||||
icon_url: member.user.avatarURL() || undefined
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Event
|
||||
|
||||
@@ -12,22 +12,19 @@ export = {
|
||||
try {
|
||||
console.log(
|
||||
color(
|
||||
interaction.user.username +
|
||||
" ran " +
|
||||
interaction.commandName +
|
||||
" " +
|
||||
interaction.options.getSubcommand(),
|
||||
"pink",
|
||||
),
|
||||
interaction.user.username + " ran " +
|
||||
interaction.commandName + " " +
|
||||
interaction.options.getSubcommand(),
|
||||
"pink"
|
||||
)
|
||||
)
|
||||
} catch {
|
||||
console.log(
|
||||
color(
|
||||
interaction.user.username +
|
||||
" ran " +
|
||||
interaction.commandName,
|
||||
"pink",
|
||||
),
|
||||
interaction.user.username + " ran " +
|
||||
interaction.commandName,
|
||||
"pink"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -35,15 +32,13 @@ export = {
|
||||
if (interaction.isButton()) {
|
||||
console.log(
|
||||
color(
|
||||
interaction.user.username +
|
||||
"#" +
|
||||
interaction.user.discriminator +
|
||||
" clicked " +
|
||||
interaction.customId,
|
||||
"pink",
|
||||
),
|
||||
interaction.user.username + "#" +
|
||||
interaction.user.discriminator + " clicked " +
|
||||
interaction.customId,
|
||||
"pink"
|
||||
)
|
||||
)
|
||||
return
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Event
|
||||
|
||||
@@ -19,20 +19,16 @@ export = {
|
||||
const output = eval(code)
|
||||
const outputString = String(output)
|
||||
await message.channel.send({
|
||||
embeds: [
|
||||
{
|
||||
description: `\`\`\`js\n${outputString}\`\`\``,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: `\`\`\`js\n${outputString}\`\`\``
|
||||
}]
|
||||
})
|
||||
} catch (error) {
|
||||
await message.channel.send({
|
||||
embeds: [
|
||||
{
|
||||
description: `\`\`\`js\n${error}\`\`\``,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: `\`\`\`js\n${error}\`\`\``
|
||||
}]
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Event
|
||||
|
||||
@@ -7,11 +7,8 @@ export = {
|
||||
event: "messageCreate",
|
||||
|
||||
async execute(message: Message) {
|
||||
if (
|
||||
message.content.toLowerCase().includes("ur mom") &&
|
||||
message.author.username === "taken.lua"
|
||||
) {
|
||||
if (message.content.toLowerCase().includes("ur mom") && message.author.username === "taken.lua") {
|
||||
message.react("Woot:734345936347725885")
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Event
|
||||
|
||||
@@ -20,16 +20,16 @@ export = {
|
||||
channel: message.channel.id,
|
||||
createdAt: message.createdTimestamp,
|
||||
deletedAt: Date.now(),
|
||||
attachments: message.attachments.map(a => a.url) || [],
|
||||
attachments: message.attachments.map(a => a.url) || []
|
||||
}
|
||||
|
||||
const snipeCache = new snipeCacheSchema({
|
||||
_id: new mongoose.Types.ObjectId(),
|
||||
userid: message.author.id,
|
||||
channelid: message.channel.id,
|
||||
data: msg,
|
||||
data: msg
|
||||
})
|
||||
|
||||
await snipeCache.save()
|
||||
},
|
||||
}
|
||||
} as Event
|
||||
|
||||
@@ -9,5 +9,5 @@ export = {
|
||||
|
||||
execute(client: Client) {
|
||||
console.log(color("Logged in as " + client.user!.tag + "!", "green"))
|
||||
},
|
||||
}
|
||||
} as Event
|
||||
|
||||
@@ -13,12 +13,10 @@ export = {
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
logToChannel("online", {
|
||||
embeds: [
|
||||
{
|
||||
description: "Bot is online!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "Bot is online!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
},
|
||||
}
|
||||
} as Event
|
||||
|
||||
@@ -22,9 +22,9 @@ export = {
|
||||
let i = 1
|
||||
setInterval(
|
||||
() => user.setActivity(statuses[i++ % statuses.length]),
|
||||
1000 * 60 * 10,
|
||||
1000 * 60 * 10
|
||||
)
|
||||
|
||||
user.setStatus("dnd")
|
||||
},
|
||||
}
|
||||
} as Event
|
||||
|
||||
@@ -17,65 +17,46 @@ export = {
|
||||
|
||||
if (oldChannel === null && newChannel !== null) {
|
||||
logToChannel("bot", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Voice Channel Join",
|
||||
description:
|
||||
userMention(newState.member!.id) +
|
||||
" joined " +
|
||||
channelMention(newChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + newState.member!.id,
|
||||
icon_url:
|
||||
newState.member!.user.avatarURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
embeds: [{
|
||||
title: "Voice Channel Join",
|
||||
description: userMention(newState.member!.id) + " joined " + channelMention(newChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + newState.member!.id,
|
||||
icon_url: newState.member!.user.avatarURL() || undefined
|
||||
},
|
||||
],
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
} else if (oldChannel !== null && newChannel === null) {
|
||||
logToChannel("bot", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Voice Channel Leave",
|
||||
description:
|
||||
userMention(oldState.member!.id) +
|
||||
" left " +
|
||||
channelMention(oldChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member!.id,
|
||||
icon_url:
|
||||
oldState.member!.user.avatarURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
embeds: [{
|
||||
title: "Voice Channel Leave",
|
||||
description: userMention(oldState.member!.id) + " left " + channelMention(oldChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member!.id,
|
||||
icon_url: oldState.member!.user.avatarURL() || undefined
|
||||
},
|
||||
],
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
} else if (oldChannel !== null && newChannel !== null) {
|
||||
if (oldChannel.id === newChannel.id) return
|
||||
|
||||
logToChannel("bot", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Voice Channel Switch",
|
||||
description:
|
||||
userMention(oldState.member!.id) +
|
||||
" switched from " +
|
||||
channelMention(oldChannel.id) +
|
||||
" to " +
|
||||
channelMention(newChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member!.id,
|
||||
icon_url:
|
||||
oldState.member!.user.avatarURL() || undefined,
|
||||
},
|
||||
timestamp: new Date().toISOString(),
|
||||
embeds: [{
|
||||
title: "Voice Channel Switch",
|
||||
description: userMention(oldState.member!.id) + " switched from " +
|
||||
channelMention(oldChannel.id) + " to " + channelMention(newChannel.id),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + oldState.member!.id,
|
||||
icon_url: oldState.member!.user.avatarURL() || undefined
|
||||
},
|
||||
],
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
} as Event
|
||||
|
||||
@@ -10,8 +10,5 @@ export default interface Command {
|
||||
disabled?: boolean
|
||||
subcommands?: boolean
|
||||
data: SlashCommandBuilder
|
||||
execute: (
|
||||
interaction: ChatInputCommandInteraction,
|
||||
client: Client,
|
||||
) => Promise<void>
|
||||
execute: (interaction: ChatInputCommandInteraction, client: Client) => Promise<void>
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import {
|
||||
ContextMenuCommandInteraction,
|
||||
ContextMenuCommandBuilder,
|
||||
ContextMenuCommandBuilder
|
||||
} from "discord.js"
|
||||
|
||||
export default interface ContextMenu {
|
||||
|
||||
@@ -25,5 +25,5 @@ export {
|
||||
Guild,
|
||||
GuildData,
|
||||
Player,
|
||||
PlayerData,
|
||||
PlayerData
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Schema, model } from "mongoose"
|
||||
const guildAppSchema = new Schema({
|
||||
_id: Schema.Types.ObjectId,
|
||||
userID: { type: String, required: true },
|
||||
uuid: { type: String, required: true },
|
||||
uuid: { type: String, required: true }
|
||||
})
|
||||
|
||||
export = model("guildapp", guildAppSchema, "guildapp")
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Schema, model } from "mongoose"
|
||||
const settingsSchema = new Schema({
|
||||
_id: Schema.Types.ObjectId,
|
||||
name: { type: String, required: true },
|
||||
value: { type: String, required: true },
|
||||
value: { type: String, required: true }
|
||||
})
|
||||
|
||||
export = model("settings", settingsSchema, "settings")
|
||||
|
||||
@@ -5,7 +5,7 @@ const snipeCacheSchema = new Schema({
|
||||
userid: { type: String, required: true },
|
||||
channelid: { type: String, required: true },
|
||||
data: { type: Object, required: true },
|
||||
date: { type: Date, default: Date.now(), expires: 600 },
|
||||
date: { type: Date, default: Date.now(), expires: 600 }
|
||||
})
|
||||
|
||||
export default model("snipeCache", snipeCacheSchema, "snipeCache")
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Schema, model } from "mongoose"
|
||||
const staffAppSchema = new Schema({
|
||||
_id: Schema.Types.ObjectId,
|
||||
userID: { type: String, required: true },
|
||||
uuid: { type: String, required: true },
|
||||
uuid: { type: String, required: true }
|
||||
})
|
||||
|
||||
export = model("staffapp", staffAppSchema, "staffapp")
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Schema, model } from "mongoose"
|
||||
const verifySchema = new Schema({
|
||||
_id: Schema.Types.ObjectId,
|
||||
userID: { type: String, required: true },
|
||||
uuid: { type: String, required: true },
|
||||
uuid: { type: String, required: true }
|
||||
})
|
||||
|
||||
export = model("verify", verifySchema, "verify")
|
||||
|
||||
@@ -5,7 +5,7 @@ const waitinglistSchema = new Schema({
|
||||
userID: { type: String, required: true },
|
||||
uuid: { type: String, required: true },
|
||||
IGN: { type: String, required: true },
|
||||
timestamp: { type: Number, required: true },
|
||||
timestamp: { type: Number, required: true }
|
||||
})
|
||||
|
||||
export = model("waitinglist", waitinglistSchema, "waitinglist")
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import { Command } from "interfaces"
|
||||
import color from "./functions/colors"
|
||||
import env from "./Env"
|
||||
import {
|
||||
REST,
|
||||
RESTGetAPIApplicationGuildCommandResult,
|
||||
RESTPutAPIApplicationGuildCommandsJSONBody,
|
||||
Routes,
|
||||
} from "discord.js"
|
||||
import { REST, RESTGetAPIApplicationGuildCommandResult, RESTPutAPIApplicationGuildCommandsJSONBody, Routes } from "discord.js"
|
||||
import fs from "fs"
|
||||
type FileType = "js" | "ts"
|
||||
|
||||
@@ -16,19 +11,11 @@ export default async function autoDeployCommands(fileType: FileType) {
|
||||
let contentMenuCommands: string[] = []
|
||||
|
||||
if (fileType === "js") {
|
||||
commandFiles = fs
|
||||
.readdirSync("./dist/commands/")
|
||||
.filter(file => file.endsWith(fileType))
|
||||
contentMenuCommands = fs
|
||||
.readdirSync("./dist/commands-contextmenu/")
|
||||
.filter(file => file.endsWith(fileType))
|
||||
commandFiles = fs.readdirSync("./dist/commands/").filter(file => file.endsWith(fileType))
|
||||
contentMenuCommands = fs.readdirSync("./dist/commands-contextmenu/").filter(file => file.endsWith(fileType))
|
||||
} else if (fileType === "ts") {
|
||||
commandFiles = fs
|
||||
.readdirSync("./src/commands/")
|
||||
.filter(file => file.endsWith(fileType))
|
||||
contentMenuCommands = fs
|
||||
.readdirSync("./src/commands-contextmenu/")
|
||||
.filter(file => file.endsWith(fileType))
|
||||
commandFiles = fs.readdirSync("./src/commands/").filter(file => file.endsWith(fileType))
|
||||
contentMenuCommands = fs.readdirSync("./src/commands-contextmenu/").filter(file => file.endsWith(fileType))
|
||||
}
|
||||
|
||||
for (const file of commandFiles) {
|
||||
@@ -47,47 +34,38 @@ export default async function autoDeployCommands(fileType: FileType) {
|
||||
const rest = new REST({ version: "10" }).setToken(env.dev.devtoken!)
|
||||
|
||||
const currentCommands = (await rest.get(
|
||||
Routes.applicationGuildCommands(env.dev.devid!, env.dev.guildid!),
|
||||
Routes.applicationGuildCommands(env.dev.devid!, env.dev.guildid!)
|
||||
)) as RESTGetAPIApplicationGuildCommandResult[]
|
||||
|
||||
const currentCommandsInfo = currentCommands.map(command => {
|
||||
return {
|
||||
name: command.name,
|
||||
description: command.description,
|
||||
description: command.description
|
||||
}
|
||||
})
|
||||
const newCommandsInfo = commands.map(command => {
|
||||
return {
|
||||
name: command.name,
|
||||
description: command.description,
|
||||
description: command.description
|
||||
}
|
||||
})
|
||||
|
||||
const sortedCurrentCommandsInfo = currentCommandsInfo.sort((a, b) =>
|
||||
a.name.localeCompare(b.name),
|
||||
a.name.localeCompare(b.name)
|
||||
)
|
||||
const sortedNewCommandsInfo = newCommandsInfo.sort((a, b) =>
|
||||
a.name.localeCompare(b.name),
|
||||
a.name.localeCompare(b.name)
|
||||
)
|
||||
|
||||
const newCmds = sortedNewCommandsInfo
|
||||
.map(cmd => {
|
||||
return " " + cmd.name + " was registered."
|
||||
})
|
||||
.join("\n")
|
||||
const currentCmds = sortedCurrentCommandsInfo
|
||||
.map(cmd => {
|
||||
return " " + cmd.name + " was unregistered."
|
||||
})
|
||||
.join("\n")
|
||||
const newCmds = sortedNewCommandsInfo.map(cmd => {
|
||||
return " " + cmd.name + " was registered."
|
||||
}).join("\n")
|
||||
const currentCmds = sortedCurrentCommandsInfo.map(cmd => {
|
||||
return " " + cmd.name + " was unregistered."
|
||||
}).join("\n")
|
||||
|
||||
if (
|
||||
JSON.stringify(sortedNewCommandsInfo) ===
|
||||
JSON.stringify(sortedCurrentCommandsInfo)
|
||||
) {
|
||||
console.log(
|
||||
color("Commands are the same, skipping deploy.", "lavender"),
|
||||
)
|
||||
if (JSON.stringify(sortedNewCommandsInfo) === JSON.stringify(sortedCurrentCommandsInfo)) {
|
||||
console.log(color("Commands are the same, skipping deploy.", "lavender"))
|
||||
console.log(color(newCmds, "lavender"))
|
||||
return
|
||||
}
|
||||
@@ -95,20 +73,16 @@ export default async function autoDeployCommands(fileType: FileType) {
|
||||
try {
|
||||
console.log(color("Commands are different, starting deploy.", "red"))
|
||||
console.log(color(currentCmds, "red"))
|
||||
console.log(
|
||||
`Started refreshing ${commands.length} application (/) commands.`,
|
||||
)
|
||||
console.log(`Started refreshing ${commands.length} application (/) commands.`)
|
||||
|
||||
const data = (await rest.put(
|
||||
Routes.applicationGuildCommands(env.dev.devid!, env.dev.guildid!),
|
||||
{ body: commands },
|
||||
{ body: commands }
|
||||
)) as RESTPutAPIApplicationGuildCommandsJSONBody[]
|
||||
|
||||
console.log(color("New commands deployed.", "lavender"))
|
||||
console.log(color(newCmds, "lavender"))
|
||||
console.log(
|
||||
`Successfully reloaded ${data.length} application (/) commands.`,
|
||||
)
|
||||
console.log(`Successfully reloaded ${data.length} application (/) commands.`)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import color from "./functions/colors"
|
||||
import { Command, ContextMenu, Button, Modal, Autocomplete } from "interfaces"
|
||||
import env from "./Env"
|
||||
import autoDeployCommands from "./Autodeploy"
|
||||
import { loadAllEvents } from "./Events"
|
||||
|
||||
export class ExtendedClient extends Client {
|
||||
commands: Collection<string, Command> = new Collection()
|
||||
@@ -20,34 +19,29 @@ export class ExtendedClient extends Client {
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.MessageContent,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
GatewayIntentBits.GuildVoiceStates,
|
||||
GatewayIntentBits.GuildVoiceStates
|
||||
],
|
||||
partials: [
|
||||
Partials.GuildMember,
|
||||
Partials.User,
|
||||
Partials.Message,
|
||||
Partials.Channel,
|
||||
],
|
||||
Partials.Channel
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
async start() {
|
||||
let token: string
|
||||
if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT) {
|
||||
console.log(
|
||||
color("Running in development mode. [ts-node]", "lavender"),
|
||||
)
|
||||
loadAllEvents(this, "ts")
|
||||
console.log(color("Running in development mode. [ts-node]", "lavender"))
|
||||
token = env.dev.devtoken!
|
||||
autoDeployCommands("ts")
|
||||
} else if (process.env.NODE_ENV === "dev" && !process.env.TYPESCRIPT) {
|
||||
console.log(color("Running in development mode.", "lavender"))
|
||||
loadAllEvents(this, "js")
|
||||
token = env.dev.devtoken!
|
||||
autoDeployCommands("js")
|
||||
} else {
|
||||
console.log(color("Running in production mode.", "green"))
|
||||
loadAllEvents(this, "js")
|
||||
token = env.prod.token!
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@ const env: Env = {
|
||||
mongoURI: process.env.MONGOURI,
|
||||
dev: process.env.DEV,
|
||||
hypixelapikey: process.env.HYPIXELAPIKEY,
|
||||
redisURI: process.env.REDISURI,
|
||||
redisURI: process.env.REDISURI
|
||||
},
|
||||
dev: {
|
||||
devtoken: process.env.DEVTOKEN,
|
||||
clientid: process.env.CLIENTID,
|
||||
devid: process.env.DEVID,
|
||||
guildid: process.env.GUILDID,
|
||||
},
|
||||
guildid: process.env.GUILDID
|
||||
}
|
||||
}
|
||||
|
||||
export default env
|
||||
|
||||
@@ -10,16 +10,8 @@ type FileType = "js" | "ts"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
export default function loadAutocompleteEvents(client: Client, ft: FileType) {
|
||||
const autocompletePath = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"..",
|
||||
"components",
|
||||
"autocomplete",
|
||||
)
|
||||
const autocompleteFiles = fs
|
||||
.readdirSync(autocompletePath)
|
||||
.filter(file => file.endsWith(ft))
|
||||
const autocompletePath = path.join(__dirname, "..", "..", "components", "autocomplete")
|
||||
const autocompleteFiles = fs.readdirSync(autocompletePath).filter(file => file.endsWith(ft))
|
||||
|
||||
for (const file of autocompleteFiles) {
|
||||
const filePath = path.join(autocompletePath, file)
|
||||
@@ -31,8 +23,8 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
|
||||
console.log(
|
||||
colorLog(
|
||||
`[WARNING] The autocomplete at ${filePath} is missing a required "name", "execute" or "type" property.`,
|
||||
"red",
|
||||
),
|
||||
"red"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -43,9 +35,7 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
|
||||
const autocomplete = client.autocomplete.get(interaction.commandName)
|
||||
|
||||
if (!autocomplete) {
|
||||
console.error(
|
||||
`No autocomplete matching ${interaction.commandName} was found.`,
|
||||
)
|
||||
console.error(`No autocomplete matching ${interaction.commandName} was found.`)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -54,21 +44,15 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
|
||||
} catch (error) {
|
||||
if (process.env.NODE_ENV !== "dev") {
|
||||
await logToChannel("error", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Autocomplete error occured",
|
||||
description: String(error),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url:
|
||||
interaction.guild!.iconURL() || undefined,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
interaction.commandName,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "Autocomplete error occured",
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.user.username + " | " + interaction.commandName
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
console.error(error)
|
||||
|
||||
@@ -23,8 +23,8 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
|
||||
console.log(
|
||||
colorLog(
|
||||
`[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`,
|
||||
"red",
|
||||
),
|
||||
"red"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -35,9 +35,7 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
|
||||
const button = client.buttons.get(interaction.customId)
|
||||
|
||||
if (!button) {
|
||||
console.error(
|
||||
`No event matching ${interaction.customId} was found.`,
|
||||
)
|
||||
console.error(`No event matching ${interaction.customId} was found.`)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -46,45 +44,33 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
|
||||
} catch (error) {
|
||||
if (process.env.NODE_ENV !== "dev") {
|
||||
await logToChannel("error", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Button error occured",
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url:
|
||||
interaction.guild!.iconURL() || undefined,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
interaction.customId,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "Button error occured",
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.user.username + " | " + interaction.customId
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
console.error(error)
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this button!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
ephemeral: true,
|
||||
embeds: [{
|
||||
description: "There was an error while executing this button!",
|
||||
color: embedColor
|
||||
}],
|
||||
ephemeral: true
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this button! 2",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "There was an error while executing this button! 2",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
|
||||
console.log(
|
||||
colorLog(
|
||||
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`,
|
||||
"red",
|
||||
),
|
||||
"red"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
|
||||
|
||||
if (!command) {
|
||||
console.error(
|
||||
`No command matching ${interaction.commandName} was found.`,
|
||||
`No command matching ${interaction.commandName} was found.`
|
||||
)
|
||||
return
|
||||
}
|
||||
@@ -47,45 +47,33 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
|
||||
} catch (error) {
|
||||
if (process.env.NODE_ENV !== "dev") {
|
||||
await logToChannel("error", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Command error occured",
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url:
|
||||
interaction.guild!.iconURL() || undefined,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
interaction.commandName,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "Command error occured",
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.user.username + " | " + interaction.commandName
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
console.error(error)
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this command!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
ephemeral: true,
|
||||
embeds: [{
|
||||
description: "There was an error while executing this command!",
|
||||
color: embedColor
|
||||
}],
|
||||
ephemeral: true
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this command!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "There was an error while executing this command!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,15 +10,8 @@ type FileType = "js" | "ts"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
export default function loadContextMenuEvents(client: Client, ft: FileType) {
|
||||
const contextMenuPath = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"..",
|
||||
"commands-contextmenu",
|
||||
)
|
||||
const contextMenuFiles = fs
|
||||
.readdirSync(contextMenuPath)
|
||||
.filter(file => file.endsWith(ft))
|
||||
const contextMenuPath = path.join(__dirname, "..", "..", "commands-contextmenu")
|
||||
const contextMenuFiles = fs.readdirSync(contextMenuPath).filter(file => file.endsWith(ft))
|
||||
|
||||
for (const file of contextMenuFiles) {
|
||||
const filePath = path.join(contextMenuPath, file)
|
||||
@@ -30,8 +23,8 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
|
||||
console.log(
|
||||
colorLog(
|
||||
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`,
|
||||
"red",
|
||||
),
|
||||
"red"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -43,9 +36,7 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
|
||||
const command = client.contextmenus.get(interaction.commandName)
|
||||
|
||||
if (!command) {
|
||||
console.error(
|
||||
`No command matching ${interaction.commandName} was found.`,
|
||||
)
|
||||
console.error(`No command matching ${interaction.commandName} was found.`)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -54,45 +45,33 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
|
||||
} catch (error) {
|
||||
if (process.env.NODE_ENV !== "dev") {
|
||||
await logToChannel("error", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Contextmenu error occured",
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url:
|
||||
interaction.guild!.iconURL() || undefined,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
interaction.commandName,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "Contextmenu error occured",
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.user.username + " | " + interaction.commandName
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
console.error(error)
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this contextmenu command!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
ephemeral: true,
|
||||
embeds: [{
|
||||
description: "There was an error while executing this contextmenu command!",
|
||||
color: embedColor
|
||||
}],
|
||||
ephemeral: true
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this contextmenu command!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "There was an error while executing this contextmenu command!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,33 +5,20 @@ import { Cron } from "interfaces"
|
||||
|
||||
export default function loadCronEvents() {
|
||||
const cronPath = path.join(__dirname, "..", "..", "events", "cron")
|
||||
const cronFiles = fs
|
||||
.readdirSync(cronPath)
|
||||
.filter(file => file.endsWith(".js"))
|
||||
const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(".js"))
|
||||
|
||||
for (const file of cronFiles) {
|
||||
const filePath = path.join(cronPath, file)
|
||||
const cron: Cron = require(filePath)
|
||||
|
||||
const time =
|
||||
cron.time.seconds +
|
||||
" " +
|
||||
cron.time.minutes +
|
||||
" " +
|
||||
cron.time.hours +
|
||||
" " +
|
||||
cron.time.dayOfMonth +
|
||||
" " +
|
||||
cron.time.month +
|
||||
" " +
|
||||
cron.time.seconds + " " +
|
||||
cron.time.minutes + " " +
|
||||
cron.time.hours + " " +
|
||||
cron.time.dayOfMonth + " " +
|
||||
cron.time.month + " " +
|
||||
cron.time.dayOfWeek
|
||||
|
||||
new CronJob(
|
||||
time,
|
||||
cron.execute,
|
||||
cron.onComplete,
|
||||
cron.start,
|
||||
cron.timeZone,
|
||||
).start()
|
||||
new CronJob(time, cron.execute, cron.onComplete, cron.start, cron.timeZone).start()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,8 @@ import loadContextMenuEvents from "./contextmenu"
|
||||
import loadCronEvents from "./cron"
|
||||
import loadEvents from "./events"
|
||||
import loadModalEvents from "./modal"
|
||||
type FileType = "js" | "ts"
|
||||
|
||||
export function loadAllEvents(client: Client, ft: FileType) {
|
||||
export default function loadAllEvents(client: Client, ft: "js" | "ts") {
|
||||
loadEvents(client)
|
||||
loadButtonEvents(client, ft)
|
||||
loadSlashCommandsEvents(client, ft)
|
||||
|
||||
@@ -11,9 +11,7 @@ const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
export default function loadModalEvents(client: Client, ft: FileType) {
|
||||
const modalPath = path.join(__dirname, "..", "..", "components", "modals")
|
||||
const modalFiles = fs
|
||||
.readdirSync(modalPath)
|
||||
.filter(file => file.endsWith(ft))
|
||||
const modalFiles = fs.readdirSync(modalPath).filter(file => file.endsWith(ft))
|
||||
|
||||
for (const file of modalFiles) {
|
||||
const filePath = path.join(modalPath, file)
|
||||
@@ -25,8 +23,8 @@ export default function loadModalEvents(client: Client, ft: FileType) {
|
||||
console.log(
|
||||
colorLog(
|
||||
`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`,
|
||||
"red",
|
||||
),
|
||||
"red"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -37,9 +35,7 @@ export default function loadModalEvents(client: Client, ft: FileType) {
|
||||
const modal = client.modals.get(interaction.customId)
|
||||
|
||||
if (!modal) {
|
||||
console.error(
|
||||
`No modal matching ${interaction.customId} was found.`,
|
||||
)
|
||||
console.error(`No modal matching ${interaction.customId} was found.`)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -48,44 +44,32 @@ export default function loadModalEvents(client: Client, ft: FileType) {
|
||||
} catch (error) {
|
||||
if (process.env.NODE_ENV !== "dev") {
|
||||
await logToChannel("error", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Button error occured",
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url:
|
||||
interaction.guild!.iconURL() || undefined,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
interaction.customId,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
title: "Button error occured",
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
text: interaction.user.username + " | " + interaction.customId
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
console.error(error)
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this modal!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "There was an error while executing this modal!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this modal!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
embeds: [{
|
||||
description: "There was an error while executing this modal!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ const mojanguuid = "https://sessionserver.mojang.com/session/minecraft/profile/"
|
||||
const hypixel = "https://api.hypixel.net/player"
|
||||
const guild = "https://api.hypixel.net/guild"
|
||||
const minotar = "https://minotar.net/helm/"
|
||||
type GuildQuerqType = "player" | "name" | "id"
|
||||
type GuildQueryType = "player" | "name" | "id"
|
||||
|
||||
type Profile = {
|
||||
data: {
|
||||
@@ -47,9 +47,11 @@ async function getIGN(uuid: string): Promise<string | null> {
|
||||
async function getPlayer(uuid: string): Promise<PlayerData | null> {
|
||||
const playerReq: Player = await fetch(hypixel, {
|
||||
params: {
|
||||
key: apikey,
|
||||
uuid: uuid,
|
||||
uuid: uuid
|
||||
},
|
||||
headers: {
|
||||
"API-Key": apikey
|
||||
}
|
||||
})
|
||||
|
||||
if (!playerReq.data.player) {
|
||||
@@ -59,17 +61,16 @@ async function getPlayer(uuid: string): Promise<PlayerData | null> {
|
||||
return playerReq.data.player
|
||||
}
|
||||
|
||||
async function getGuild(
|
||||
query: string,
|
||||
type?: GuildQuerqType,
|
||||
): Promise<GuildData | null> {
|
||||
async function getGuild(query: string, type?: GuildQueryType): Promise<GuildData | null> {
|
||||
const reqType = type ? type : "player"
|
||||
|
||||
const guildReq: Guild = await fetch(guild, {
|
||||
params: {
|
||||
key: apikey,
|
||||
[reqType]: query,
|
||||
[reqType]: query
|
||||
},
|
||||
headers: {
|
||||
"API-Key": apikey
|
||||
}
|
||||
})
|
||||
|
||||
if (!guildReq.data.guild) {
|
||||
|
||||
@@ -10,14 +10,14 @@ function getExpForLevel(level: number): number {
|
||||
}
|
||||
|
||||
switch (respectedLevel) {
|
||||
case 1:
|
||||
return 500
|
||||
case 2:
|
||||
return 1000
|
||||
case 3:
|
||||
return 2000
|
||||
case 4:
|
||||
return 3500
|
||||
case 1:
|
||||
return 500
|
||||
case 2:
|
||||
return 1000
|
||||
case 3:
|
||||
return 2000
|
||||
case 4:
|
||||
return 3500
|
||||
}
|
||||
return 5000
|
||||
}
|
||||
@@ -31,7 +31,7 @@ function getLevelRespectingPrestige(level: number): number {
|
||||
}
|
||||
|
||||
const EASY_LEVELS = 4
|
||||
const EASY_LEVELS_XP = 7000
|
||||
const EASY_LEVELS_XP = 7004
|
||||
const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP
|
||||
const LEVELS_PER_PRESTIGE = 100
|
||||
const HIGHEST_PRESTIGE = 50
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
function guildLevel(exp: number): number {
|
||||
const EXP_NEEDED = [
|
||||
100000, 150000, 250000, 500000, 750000, 1000000, 1250000, 1500000,
|
||||
2000000, 2500000, 2500000, 2500000, 2500000, 2500000, 3000000,
|
||||
2000000, 2500000, 2500000, 2500000, 2500000, 2500000, 3000000
|
||||
]
|
||||
|
||||
let level = 0
|
||||
@@ -38,10 +38,8 @@ function guildLevel(exp: number): number {
|
||||
*/
|
||||
function scaledGEXP(input: number): number {
|
||||
if (input <= 200000) return Number(input)
|
||||
if (input <= 700000)
|
||||
return Number(Math.round((input - 200000) / 10 + 200000))
|
||||
if (input > 700000)
|
||||
return Number(Math.round((input - 700000) / 33 + 250000))
|
||||
if (input <= 700000) return Number(Math.round((input - 200000) / 10 + 200000))
|
||||
if (input > 700000) return Number(Math.round((input - 700000) / 33 + 250000))
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -6,16 +6,14 @@ const GROWTH = 2500
|
||||
const HALF_GROWTH = 0.5 * GROWTH
|
||||
const REVERSE_PQ_PREFIX = -(BASE - 0.5 * GROWTH) / GROWTH
|
||||
const REVERSE_CONST = REVERSE_PQ_PREFIX * REVERSE_PQ_PREFIX
|
||||
const GROWTH_DIVIDES_2 = 2 / GROWTH
|
||||
const GROWTHDIV2 = 2 / GROWTH
|
||||
|
||||
function getLevel(exp: number): number {
|
||||
return exp <= 1
|
||||
? 1
|
||||
: Math.floor(
|
||||
1 +
|
||||
REVERSE_PQ_PREFIX +
|
||||
Math.sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp),
|
||||
)
|
||||
if (exp <= 1) return 1
|
||||
|
||||
return Math.floor(
|
||||
1 + REVERSE_PQ_PREFIX + Math.sqrt(REVERSE_CONST + GROWTHDIV2 * exp)
|
||||
)
|
||||
}
|
||||
|
||||
function hypixelLevel(exp: number): number {
|
||||
|
||||
@@ -3,13 +3,25 @@ import color from "utils/functions/colors"
|
||||
import { Redis } from "ioredis"
|
||||
import env from "utils/Env"
|
||||
import { connect } from "mongoose"
|
||||
import loadAllEvents from "./Events"
|
||||
const client = new Client()
|
||||
const redis = new Redis(env.prod.redisURI!)
|
||||
let ft: "js" | "ts"
|
||||
if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT === "true") {
|
||||
ft = "ts"
|
||||
} else {
|
||||
ft = "js"
|
||||
}
|
||||
|
||||
class Bot {
|
||||
async start() {
|
||||
this.init()
|
||||
loadAllEvents(client, ft)
|
||||
client.start()
|
||||
this.databases()
|
||||
}
|
||||
|
||||
private async databases() {
|
||||
redis.on("ready", () => {
|
||||
console.log(color("Connected to Redis", "green"))
|
||||
})
|
||||
|
||||
@@ -4,7 +4,7 @@ const colors = {
|
||||
red: "#f38ba8",
|
||||
lavender: "#b4befe",
|
||||
green: "#a6e3a1",
|
||||
pink: "#f5c2e7",
|
||||
pink: "#f5c2e7"
|
||||
}
|
||||
|
||||
export default function color(text: string, type: keyof typeof colors) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
guildLogChannel,
|
||||
errorLogChannel,
|
||||
moderationLogChannel,
|
||||
devLogChannel,
|
||||
devLogChannel
|
||||
} from "config/options.json"
|
||||
import { Guild, MessageCreateOptions, TextChannel } from "discord.js"
|
||||
import Illegitimate from "utils/Illegitimate"
|
||||
@@ -16,15 +16,12 @@ const channels = {
|
||||
guild: guildLogChannel,
|
||||
error: errorLogChannel,
|
||||
mod: moderationLogChannel,
|
||||
dev: devLogChannel,
|
||||
dev: devLogChannel
|
||||
}
|
||||
|
||||
type Channel = keyof typeof channels
|
||||
|
||||
export default async function logToChannel(
|
||||
channel: Channel,
|
||||
message: MessageCreateOptions,
|
||||
): Promise<void | null> {
|
||||
export default async function logToChannel(channel: Channel, message: MessageCreateOptions): Promise<void | null> {
|
||||
const guild = Illegitimate.client.guilds.cache.get(guildid) as Guild
|
||||
let logChannel: TextChannel
|
||||
|
||||
@@ -35,9 +32,7 @@ export default async function logToChannel(
|
||||
}
|
||||
|
||||
if (!logChannel) {
|
||||
console.log(
|
||||
`[ERROR] Could not find channel used for ${channel} logging.`,
|
||||
)
|
||||
console.log(`[ERROR] Could not find channel used for ${channel} logging.`)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user