Revert "Beautifying"

This reverts commit 3a3bb89635
This commit is contained in:
2023-04-24 22:02:52 +00:00
parent 6dbb92241a
commit 510f6afd23
40 changed files with 3329 additions and 3951 deletions

View File

@@ -1,282 +1,262 @@
const { SlashCommandBuilder } = require("discord.js");
const env = require("dotenv").config();
const { SlashCommandBuilder } = require('discord.js');
const env = require('dotenv').config();
const hypixelApiKey = process.env.HYPIXELAPIKEY;
const fetch = require("axios");
const verify = require("../schemas/verifySchema.js");
const { color, hypixelGuildID } = require("../config/options.json");
const {
gm,
manager,
moderator,
beast,
member,
trialmember,
guildRole,
guildStaff,
defaultMember
} = require("../config/roles.json");
const fetch = require('axios');
const verify = require('../schemas/verifySchema.js')
const { color, hypixelGuildID } = require('../config/options.json');
const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json');
const removeThese = [
gm,
manager,
moderator,
beast,
member,
trialmember,
guildRole,
guildStaff
];
const removeThese = [gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff];
module.exports = {
name: "update",
description: "Update your guild rank.",
type: "slash",
name: 'update',
description: 'Update your guild rank.',
type: 'slash',
data: new SlashCommandBuilder()
.setName("update")
.setDescription("Update your guild rank.")
.setDMPermission(false),
data: new SlashCommandBuilder()
.setName('update')
.setDescription('Update your guild rank.')
.setDMPermission(false),
async execute(interaction) {
await interaction.deferReply();
async execute(interaction) {
const user1 = interaction.user;
const user = interaction.guild.members.cache.get(user1.id);
const verifyData = await verify.findOne({ userID: user.id });
const roleManage = user.roles;
if (!verifyData) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
await interaction.editReply({
embeds: [
{
description: "Updated your roles to `Default Member`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
await interaction.deferReply();
const user1 = interaction.user;
const user = interaction.guild.members.cache.get(user1.id);
const verifyData = await verify.findOne({ userID: user.id })
const roleManage = user.roles;
if (!verifyData) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
}
]
});
return;
}
const slothPixel = "https://api.slothpixel.me/api/players/";
const guildAPI = "https://api.slothpixel.me/api/guilds/";
const mojangAPI = "https://api.mojang.com/user/profile/";
const minotar = "https://minotar.net/helm/";
await interaction.editReply({
embeds: [{
description: "Updated your roles to `Default Member`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
const userCheck = await fetch(mojangAPI + verifyData.uuid);
const hypixelCheck = await fetch(slothPixel + verifyData.uuid);
const slothPixel = "https://api.slothpixel.me/api/players/";
const guildAPI = "https://api.slothpixel.me/api/guilds/"
const mojangAPI = "https://api.mojang.com/user/profile/"
const minotar = "https://minotar.net/helm/";
const userCheck = await fetch(mojangAPI + verifyData.uuid);
const hypixelCheck = await fetch(slothPixel + verifyData.uuid);
try {
const guildCheck = await fetch(guildAPI + verifyData.uuid);
var responseGuildID = guildCheck.data.id;
} catch (err) {
var responseGuildID = null;
}
try {
const guildCheck = await fetch(guildAPI + verifyData.uuid);
var responseGuildID = guildCheck.data.id;
} catch (err) {
var responseGuildID = null;
}
if (responseGuildID !== hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
if (responseGuildID !== hypixelGuildID) {
await roleManage.add(defaultMember, "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 + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
}
]
});
return;
}
const guildCheck = await fetch(guildAPI + verifyData.uuid);
const head = minotar + userCheck.data.name;
await roleManage.add(defaultMember, "User used the update command")
const embedColor = Number(color.replace("#", "0x"));
const GuildMembers = guildCheck.data.members;
const guildRank = GuildMembers.find(
(member) => member.uuid === verifyData.uuid
).rank;
await interaction.editReply({
embeds: [{
description: "Updated your roles to `Default Member`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
const guildCheck = await fetch(guildAPI + verifyData.uuid);
const head = minotar + userCheck.data.name;
if (guildRank === "Guild Master" && responseGuildID === hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
const embedColor = Number(color.replace("#", "0x"));
const GuildMembers = guildCheck.data.members;
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank;
await roleManage.add(guildRole, "User used the update command");
await roleManage.add(guildStaff, "User used the update command");
await roleManage.add(gm, "User used the update command");
await roleManage.add(defaultMember, "User used the update command");
if (guildRank === 'Guild Master' && responseGuildID === hypixelGuildID) {
await interaction.editReply({
embeds: [
{
description: "Your rank has been updated to `Guild Master`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
}
]
});
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(guildStaff, "User used the update command")
await roleManage.add(gm, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
if (guildRank === "Manager" && responseGuildID === hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Guild Master`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
await roleManage.add(guildRole, "User used the update command");
await roleManage.add(guildStaff, "User used the update command");
await roleManage.add(manager, "User used the update command");
await roleManage.add(defaultMember, "User used the update command");
if (guildRank === 'Manager' && responseGuildID === hypixelGuildID) {
await interaction.editReply({
embeds: [
{
description: "Your rank has been updated to `Manager`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
}
]
});
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(guildStaff, "User used the update command")
await roleManage.add(manager, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
if (guildRank === "Moderator" && responseGuildID === hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Manager`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
await roleManage.add(guildRole, "User used the update command");
await roleManage.add(guildStaff, "User used the update command");
await roleManage.add(moderator, "User used the update command");
await roleManage.add(defaultMember, "User used the update command");
if (guildRank === 'Moderator' && responseGuildID === hypixelGuildID) {
await interaction.editReply({
embeds: [
{
description: "Your rank has been updated to `Moderator`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
}
]
});
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(guildStaff, "User used the update command")
await roleManage.add(moderator, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
if (guildRank === "Beast" && responseGuildID === hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Moderator`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
await roleManage.add(guildRole, "User used the update command");
await roleManage.add(beast, "User used the update command");
await roleManage.add(defaultMember, "User used the update command");
}
await interaction.editReply({
embeds: [
{
description: "Your rank has been updated to `Beast`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
if (guildRank === 'Beast' && responseGuildID === hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
}
]
});
return;
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(beast, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
if (guildRank === "Member" && responseGuildID === hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Beast`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
await roleManage.add(guildRole, "User used the update command");
await roleManage.add(member, "User used the update command");
await roleManage.add(defaultMember, "User used the update command");
if (guildRank === 'Member' && responseGuildID === hypixelGuildID) {
await interaction.editReply({
embeds: [
{
description: "Your rank has been updated to `Member`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
}
]
});
return;
}
if (guildRank === "Trial Member" && responseGuildID === hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(member, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
await roleManage.add(guildRole, "User used the update command");
await roleManage.add(trialmember, "User used the update command");
await roleManage.add(defaultMember, "User used the update command");
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Member`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
await interaction.editReply({
embeds: [
{
description: "Your rank has been updated to `Trial Member`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
if (guildRank === 'Trial Member' && responseGuildID === hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
}
]
});
return;
await roleManage.add(guildRole, "User used the update command")
await roleManage.add(trialmember, "User used the update command")
await roleManage.add(defaultMember, "User used the update command")
await interaction.editReply({
embeds: [{
description: "Your rank has been updated to `Trial Member`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
}
}
};
};