Revert "Making all files use prettier"

This reverts commit 5aa85986cd.
This commit is contained in:
2023-08-31 23:13:47 +02:00
parent 99167be941
commit 0952d89809
49 changed files with 3777 additions and 4018 deletions

View File

@@ -7,212 +7,198 @@ const fetch = require("axios");
const { getExactLevel, skywarsLevel, getLevelForExp } = require("../utils/functions.js");
module.exports = {
name: "check",
description: "Check a player's stats.",
type: "slash",
name: "check",
description: "Check a player's stats.",
type: "slash",
data: new SlashCommandBuilder()
.setName("check")
.setDescription("Check a player's stats.")
.addStringOption((option) => option.setName("ign").setDescription("The player's IGN.").setRequired(true))
.setDMPermission(false),
data: new SlashCommandBuilder()
.setName("check")
.setDescription("Check a player's stats.")
.addStringOption((option) => option.setName("ign")
.setDescription("The player's IGN.")
.setRequired(true))
.setDMPermission(false),
async execute(interaction) {
await interaction.deferReply({});
async execute(interaction) {
await interaction.deferReply({});
const ign = interaction.options.getString("ign");
const mojang = "https://api.mojang.com/users/profiles/minecraft/";
const hypixel = "https://api.hypixel.net/player";
const guildAPI = "https://api.hypixel.net/guild";
const minotar = "https://minotar.net/helm/";
const embedColor = Number(color.replace("#", "0x"));
const head = minotar + ign;
const ign = interaction.options.getString("ign");
const mojang = "https://api.mojang.com/users/profiles/minecraft/";
const hypixel = "https://api.hypixel.net/player"
const guildAPI = "https://api.hypixel.net/guild"
const minotar = "https://minotar.net/helm/";
const embedColor = Number(color.replace("#", "0x"));
const head = minotar + ign;
if (!ign) {
await interaction.editReply("Please provide a player's IGN.");
return;
if (!ign) {
await interaction.editReply("Please provide a player's IGN.");
return;
}
try {
await fetch(mojang + ign);
} catch (error) {
interaction.editReply({
embeds: [
{ description: "That player doesn't exist.", color: embedColor }
]
});
return;
}
const userCheck = await fetch(mojang + ign);
const uuid = userCheck.data.id;
const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid
const stats = await fetch(player);
if (!stats.data.player) {
interaction.editReply({
embeds: [{
description: "That player hasn't played Hypixel before.",
color: embedColor
}]
});
return;
}
const rank2 = stats.data.player.newPackageRank;
const monthlyRank = stats.data.player.monthlyPackageRank;
if (rank2 === 'VIP') {
var rank = "[VIP] "
} else if (rank2 === 'VIP_PLUS') {
var rank = "[VIP+] "
} else if (rank2 === 'MVP') {
var rank = "[MVP] "
} else if (rank2 === 'MVP_PLUS' && monthlyRank === 'NONE') {
var rank = "[MVP+] "
} else if (rank2 === 'MVP_PLUS' && monthlyRank === 'SUPERSTAR') {
var rank = "[MVP++] "
}
try {
await fetch(mojang + ign);
} catch (error) {
interaction.editReply({
embeds: [{ description: "That player doesn't exist.", color: embedColor }],
});
return;
}
const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid
const guildCheck = await fetch(guild);
const userCheck = await fetch(mojang + ign);
const uuid = userCheck.data.id;
if (!guildCheck.data.guild) {
var guildName = "None";
} else {
var guildName = guildCheck.data.guild.name;
}
const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + uuid;
const stats = await fetch(player);
if (!guildCheck.data.guild) {
var guildTag = ""
} else if (!guildCheck.data.guild.tag) {
var guildTag = ""
} else {
var guildTag = " [" + guildCheck.data.guild.tag + "]"
}
if (!stats.data.player) {
interaction.editReply({
embeds: [
{
description: "That player hasn't played Hypixel before.",
color: embedColor,
},
],
});
return;
}
//bedwars level
const hsbwexp = stats.data.player.stats.Bedwars.Experience;
const hsbwstars = getLevelForExp(hsbwexp);
// bedwars fkdr
const hsbwfk = stats.data.player.stats.Bedwars.final_kills_bedwars;
const hsbwfd = stats.data.player.stats.Bedwars.final_deaths_bedwars;
const hsbwfkdr = hsbwfk / hsbwfd;
// bedwars wins
const hsbwwins = stats.data.player.stats.Bedwars.wins_bedwars;
// skywars level
const hsswexp = stats.data.player.stats.SkyWars.skywars_experience;
const hsswstars = skywarsLevel(hsswexp);
// skywars kdr
const hsswkills = stats.data.player.stats.SkyWars.kills;
const hsswdeaths = stats.data.player.stats.SkyWars.deaths;
const hsswkd = hsswkills / hsswdeaths;
//skywars wins
const hsswwins = stats.data.player.stats.SkyWars.wins;
// dueks kdr
const hsduelskills = stats.data.player.stats.Duels.kills
const hsduelsdeaths = stats.data.player.stats.Duels.deaths
const hsduelskd = hsduelskills / hsduelsdeaths
// duels wins
const hsduelswins = stats.data.player.stats.Duels.wins;
// duels wlr
const hsduelslosses = stats.data.player.stats.Duels.losses;
const hsduelswlr = hsduelswins / hsduelslosses;
// network level
const hypixelExp = stats.data.player.networkExp;
const level = getExactLevel(hypixelExp);
if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
var bwtitle =
"<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements.";
} else {
var bwtitle =
"<a:check_a:1087808632172847134> This player meets the BedWars requirements.";
}
const rank2 = stats.data.player.newPackageRank;
const monthlyRank = stats.data.player.monthlyPackageRank;
if (hsswstars < swstars) {
var swtitle =
"<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements.";
} else {
var swtitle =
"<a:check_a:1087808632172847134> This player meets the SkyWars requirements.";
}
if (rank2 === "VIP") {
var rank = "[VIP] ";
} else if (rank2 === "VIP_PLUS") {
var rank = "[VIP+] ";
} else if (rank2 === "MVP") {
var rank = "[MVP] ";
} else if (rank2 === "MVP_PLUS" && monthlyRank === "NONE") {
var rank = "[MVP+] ";
} else if (rank2 === "MVP_PLUS" && monthlyRank === "SUPERSTAR") {
var rank = "[MVP++] ";
}
if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
var duelstitle =
"<a:cross_a:1087808606897983539> This player does not meet the Duels requirements.";
} else {
var duelstitle =
"<a:check_a:1087808632172847134> This player meets the Duels requirements.";
}
const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + uuid;
const guildCheck = await fetch(guild);
if (!guildCheck.data.guild) {
var guildName = "None";
} else {
var guildName = guildCheck.data.guild.name;
}
if (!guildCheck.data.guild) {
var guildTag = "";
} else if (!guildCheck.data.guild.tag) {
var guildTag = "";
} else {
var guildTag = " [" + guildCheck.data.guild.tag + "]";
}
//bedwars level
const hsbwexp = stats.data.player.stats.Bedwars.Experience;
const hsbwstars = getLevelForExp(hsbwexp);
// bedwars fkdr
const hsbwfk = stats.data.player.stats.Bedwars.final_kills_bedwars;
const hsbwfd = stats.data.player.stats.Bedwars.final_deaths_bedwars;
const hsbwfkdr = hsbwfk / hsbwfd;
// bedwars wins
const hsbwwins = stats.data.player.stats.Bedwars.wins_bedwars;
// skywars level
const hsswexp = stats.data.player.stats.SkyWars.skywars_experience;
const hsswstars = skywarsLevel(hsswexp);
// skywars kdr
const hsswkills = stats.data.player.stats.SkyWars.kills;
const hsswdeaths = stats.data.player.stats.SkyWars.deaths;
const hsswkd = hsswkills / hsswdeaths;
//skywars wins
const hsswwins = stats.data.player.stats.SkyWars.wins;
// dueks kdr
const hsduelskills = stats.data.player.stats.Duels.kills;
const hsduelsdeaths = stats.data.player.stats.Duels.deaths;
const hsduelskd = hsduelskills / hsduelsdeaths;
// duels wins
const hsduelswins = stats.data.player.stats.Duels.wins;
// duels wlr
const hsduelslosses = stats.data.player.stats.Duels.losses;
const hsduelswlr = hsduelswins / hsduelslosses;
// network level
const hypixelExp = stats.data.player.networkExp;
const level = getExactLevel(hypixelExp);
if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || hsbwwins < bwwins) {
var bwtitle = "<a:cross_a:1087808606897983539> This player does not meet the BedWars requirements.";
} else {
var bwtitle = "<a:check_a:1087808632172847134> This player meets the BedWars requirements.";
}
if (hsswstars < swstars) {
var swtitle = "<a:cross_a:1087808606897983539> This player does not meet the SkyWars requirements.";
} else {
var swtitle = "<a:check_a:1087808632172847134> This player meets the SkyWars requirements.";
}
if (hsduelswins < duelswins || hsduelswlr < duelswlr) {
var duelstitle = "<a:cross_a:1087808606897983539> This player does not meet the Duels requirements.";
} else {
var duelstitle = "<a:check_a:1087808632172847134> This player meets the Duels requirements.";
}
await interaction.editReply({
embeds: [
{
title: rank + stats.data.player.displayname + guildTag,
description:
"**Network Level:** `" +
level.toFixed(2).toString() +
"`\n" +
"**Current Guild:** `" +
guildName +
"`",
color: embedColor,
thumbnail: { url: head },
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL(),
},
fields: [
{
name: bwtitle,
value:
"**➺ Stars:** `" +
hsbwstars.toFixed(2).toString() +
" / " +
bwstars.toString() +
"`\n" +
"**➺ FKDR:** `" +
hsbwfkdr.toFixed(2).toString() +
" / " +
bwfkdr.toString() +
"`\n" +
"**➺ Wins:** `" +
hsbwwins.toString() +
" / " +
bwwins.toString() +
"`",
},
{
name: swtitle,
value:
"**➺ Stars:** `" +
hsswstars.toFixed(2).toString() +
" / " +
swstars.toString() +
"`\n" +
"**➺ KDR:** `" +
hsswkd.toFixed(2).toString() +
"`\n" +
"**➺ Wins:** `" +
hsswwins.toString() +
"`",
},
{
name: duelstitle,
value:
"**➺ Wins:** `" +
hsduelswins.toString() +
" / " +
duelswins.toString() +
"`\n" +
"**➺ WLR:** `" +
hsduelswlr.toFixed(2).toString() +
" / " +
duelswlr.toString() +
"`\n" +
"**➺ KDR:** `" +
hsduelskd.toFixed(2).toString() +
"`",
},
],
},
],
});
},
await interaction.editReply({
embeds: [{
title: rank + stats.data.player.displayname + guildTag,
description: "**Network Level:** `" +
level.toFixed(2).toString() + "`\n" +
"**Current Guild:** `" + guildName + "`",
color: embedColor,
thumbnail: { url: head },
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL()
},
fields: [
{
name: bwtitle,
value: "**➺ Stars:** `" +
hsbwstars.toFixed(2).toString() + " / " +
bwstars.toString() + "`\n" +
"**➺ FKDR:** `" +
hsbwfkdr.toFixed(2).toString() +
" / " + bwfkdr.toString() + "`\n" +
"**➺ Wins:** `" +
hsbwwins.toString() + " / " +
bwwins.toString() + "`"
},
{
name: swtitle,
value:
"**➺ Stars:** `" +
hsswstars.toFixed(2).toString() +
" / " + swstars.toString() + "`\n" +
"**➺ KDR:** `" +
hsswkd.toFixed(2).toString() +
"`\n" +
"**➺ Wins:** `" +
hsswwins.toString() + "`"
},
{
name: duelstitle,
value: "**➺ Wins:** `" +
hsduelswins.toString() +
" / " + duelswins.toString() + "`\n" +
"**➺ WLR:** `" +
hsduelswlr.toFixed(2).toString() +
" / " + duelswlr.toString() + "`\n" +
"**➺ KDR:** `" +
hsduelskd.toFixed(2).toString() + "`"
}
]
}]
});
}
};

View File

@@ -1,239 +1,219 @@
const {
SlashCommandBuilder,
PermissionFlagsBits,
ButtonBuilder,
ActionRowBuilder,
ButtonStyle,
} = require("discord.js");
const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, } = require("discord.js");
const { color } = require("../config/options.json");
module.exports = {
name: "config",
description: "Configure the bot.",
type: "slash",
name: "config",
description: "Configure the bot.",
type: "slash",
data: new SlashCommandBuilder()
.setName("config")
.setDescription("Configure the bot.")
.addSubcommand((subcommand) =>
data: new SlashCommandBuilder()
.setName("config")
.setDescription("Configure the bot.")
.addSubcommand((subcommand) =>
subcommand
.setName("sendguildapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.setRequired(true))
)
.addSubcommand((subcommand) =>
subcommand
.setName("sendstaffapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.setRequired(true)))
.addSubcommand((subcommand) =>
subcommand
.setName("sendguildapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
.setName("sendverfiymessage")
.setDescription("Send the verfiy message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
.setName("channel")
.setDescription("The channel to send the verfiy message to.")
.setRequired(true)))
.addSubcommand((subcommand) =>
subcommand
.setName("sendstaffapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
.setName("sendwaitinglistmessage")
.setDescription("Send the waiting list message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("sendverfiymessage")
.setDescription("Send the verfiy message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the verfiy message to.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("sendwaitinglistmessage")
.setDescription("Send the waiting list message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the waiting list message to.")
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("sendinactivityapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.setRequired(true),
),
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
.setName("channel")
.setDescription("The channel to send the waiting list message to.")
.setRequired(true)))
.addSubcommand((subcommand) =>
subcommand
.setName("sendinactivityapplication")
.setDescription("Send the application message to a channel.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The channel to send the application to.")
.setRequired(true)))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
async execute(interaction) {
const user = interaction.user;
const guild = interaction.guild;
const subcommand = interaction.options.getSubcommand();
const embedColor = Number(color.replace("#", "0x"));
async execute(interaction) {
const user = interaction.user;
const guild = interaction.guild;
const subcommand = interaction.options.getSubcommand();
const embedColor = Number(color.replace("#", "0x"));
if (subcommand === "sendguildapplication") {
const channel = interaction.options.getChannel("channel");
await channel.send({
embeds: [
{
title: "Guild Application",
description: "You can apply for the guild by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true }),
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("guildapply")
.setLabel("Apply")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }),
),
],
});
await interaction.reply({ content: "Message sent", ephemeral: true });
}
if (subcommand === "sendguildapplication") {
const channel = interaction.options.getChannel("channel");
if (subcommand === "sendstaffapplication") {
const channel = interaction.options.getChannel("channel");
await channel.send({
embeds: [
{
title: "Guild Application",
description: "You can apply for the guild by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true })
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
}
}
],
components: [
new ActionRowBuilder()
.addComponents(new ButtonBuilder()
.setCustomId("guildapply")
.setLabel("Apply")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }))
]
});
await interaction.reply({ content: "Message sent", ephemeral: true });
}
await channel.send({
embeds: [
{
title: "Staff Application",
description: "You can apply for the staff team by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true }),
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("staffapply")
.setLabel("Apply")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }),
),
],
});
if (subcommand === "sendstaffapplication") {
const channel = interaction.options.getChannel("channel");
await interaction.reply({ content: "Message sent", ephemeral: true });
}
await channel.send({
embeds: [
{
title: "Staff Application",
description: "You can apply for the staff team by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true })
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
}
}
],
components: [
new ActionRowBuilder()
.addComponents(new ButtonBuilder()
.setCustomId("staffapply")
.setLabel("Apply")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }))
]
});
if (subcommand === "sendinactivityapplication") {
const channel = interaction.options.getChannel("channel");
await interaction.reply({ content: "Message sent", ephemeral: true });
}
await channel.send({
embeds: [
{
title: "Inactivity Log",
description: "You can send an inactivity log by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true }),
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("guildinactivitylog")
.setLabel("Submit")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }),
),
],
});
if (subcommand === "sendinactivityapplication") {
const channel = interaction.options.getChannel("channel");
await interaction.reply({ content: "Message sent", ephemeral: true });
}
await channel.send({
embeds: [
{
title: "Inactivity Log",
description: "You can send an inactivity log by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true })
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
}
}
],
components: [
new ActionRowBuilder()
.addComponents(new ButtonBuilder()
.setCustomId("guildinactivitylog")
.setLabel("Submit")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }))
]
});
await interaction.reply({ content: "Message sent", ephemeral: true });
}
if (subcommand === "sendverfiymessage") {
const channel = interaction.options.getChannel("channel");
await channel.send({
embeds: [
{
title: "Verification",
description: "You can verify by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true }),
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("verifybutton")
.setLabel("Verify")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }),
),
],
});
await interaction.reply({ content: "Message sent", ephemeral: true });
await channel.send({
embeds: [{
title: "Verification",
description: "You can verify by clicking the button below.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true })
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
}
}],
components: [
new ActionRowBuilder()
.addComponents(new ButtonBuilder()
.setCustomId("verifybutton")
.setLabel("Verify")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "✅" }))
]
});
await interaction.reply({ content: "Message sent", ephemeral: true });
}
if (subcommand === "sendwaitinglistmessage") {
const channel = interaction.options.getChannel("channel");
if (subcommand === "sendwaitinglistmessage") {
const channel = interaction.options.getChannel("channel");
await channel.send({
embeds: [
{
title: "Waiting List",
description: "The people below were accepted into the guild\n" + "Try to invite them in order.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true }),
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("waitinglistupdate")
.setLabel("Update")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "🔄" }),
),
],
});
await interaction.reply({ content: "Message sent", ephemeral: true });
}
},
};
await channel.send({
embeds: [{
title: "Waiting List",
description: "The people below were accepted into the guild\n" +
"Try to invite them in order.",
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
iconURL: interaction.guild.iconURL({ dynamic: true })
},
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
}
}],
components: [
new ActionRowBuilder()
.addComponents(new ButtonBuilder()
.setCustomId("waitinglistupdate")
.setLabel("Update")
.setStyle(ButtonStyle.Primary)
.setEmoji({ name: "🔄" }))
]
});
await interaction.reply({ content: "Message sent", ephemeral: true });
}
}
};

View File

@@ -1,60 +1,70 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention, EmbedBuilder, ChannelType } = require("discord.js");
const { hypixelGuildID, color } = require("../config/options.json");
const { muted } = require("../config/roles.json");
const verify = require("../schemas/verifySchema.js");
const env = require("dotenv").config();
const { SlashCommandBuilder, PermissionFlagsBits, userMention, EmbedBuilder, ChannelType } = require('discord.js');
const { hypixelGuildID, color } = require('../config/options.json');
const { muted } = require('../config/roles.json');
const verify = require('../schemas/verifySchema.js');
const env = require('dotenv').config();
const dev = process.env.DEV;
const fetch = require("axios");
const fetch = require('axios');
module.exports = {
name: "admin",
description: "Admin command.",
type: "slash",
name: 'admin',
description: 'Admin command.',
type: 'slash',
data: new SlashCommandBuilder()
.setName("devel")
.setDescription("Admin command.")
.addSubcommand((subcommand) => subcommand.setName("reload").setDescription("Reload the bot."))
.addSubcommand((subcommand) => subcommand.setName("listallverified").setDescription("List all verified users."))
.addSubcommand((subcommand) =>
.setName('devel')
.setDescription('Admin command.')
.addSubcommand(subcommand =>
subcommand
.setName("purgereactions")
.setDescription("Purge all reactions from a messages.")
.addIntegerOption((option) =>
option.setName("count").setDescription("Count of messages to purge reactions from."),
),
)
.setName('reload')
.setDescription('Reload the bot.'))
.addSubcommand(subcommand =>
subcommand
.setName('listallverified')
.setDescription('List all verified users.'))
.addSubcommand(subcommand =>
subcommand
.setName('purgereactions')
.setDescription('Purge all reactions from a messages.')
.addIntegerOption(option =>
option
.setName('count')
.setDescription('Count of messages to purge reactions from.')))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
async execute(interaction) {
const subcommand = interaction.options.getSubcommand();
const user = interaction.user;
const userMentioned = userMention(user.id);
const guild = interaction.guild;
const embedColor = Number(color.replace("#", "0x"));
if (subcommand === "reload") {
const { exec } = require("child_process");
await interaction.reply({ content: "Reloading...", ephemeral: true });
if (subcommand === 'reload') {
exec("pm2 restart 0", async (err, stdout, stderr) => {
const { exec } = require('child_process');
await interaction.reply({ content: 'Reloading...', ephemeral: true })
exec('pm2 restart 0', async (err, stdout, stderr) => {
if (err) {
await interaction.reply({ content: "Error while reloading: " + err, ephemeral: true });
await interaction.reply({ content: 'Error while reloading: ' + err, ephemeral: true })
}
});
})
}
if (subcommand === "listallverified") {
const verifiedUsers = await verify.find();
const mojang = "https://api.mojang.com/user/profile/";
if (subcommand === 'listallverified') {
const verifiedUsers = await verify.find()
const mojang = "https://api.mojang.com/user/profile/"
let embed = new EmbedBuilder()
.setTitle(guild.name)
.setColor(embedColor)
.setDescription("List of all verified users");
.setDescription('List of all verified users')
for (let i = 0; i < verifiedUsers.length; i++) {
const user = verifiedUsers[i];
const userCheck = await fetch(mojang + user.uuid);
@@ -64,34 +74,34 @@ module.exports = {
embed.addFields({
name: "**IGN:** " + ign,
value: "**Discord:** " + mentionedUser,
});
value: "**Discord:** " + mentionedUser
})
}
await interaction.reply({
embeds: [embed],
});
embeds: [embed]
})
}
if (subcommand === "purgereactions") {
const count = interaction.options.getInteger("count");
await interaction.deferReply({});
if (subcommand === 'purgereactions') {
const count = interaction.options.getInteger('count');
await interaction.deferReply({})
if (user.id !== dev) {
interaction.editReply({
content: "Due to you not screwing something up this command is restricted to only " + userMentioned,
ephemeral: true,
});
return;
interaction.editReply({ content: 'Due to you not screwing something up this command is restricted to only ' + userMentioned, ephemeral: true })
return
}
const messages = await interaction.channel.messages.fetch({ limit: count });
messages.forEach(async (message) => {
await message.reactions.removeAll();
});
})
await interaction.editReply(`Purged reactions from ${count} message(s).`)
await interaction.editReply(`Purged reactions from ${count} message(s).`);
}
},
};
}
};

View File

@@ -1,67 +1,55 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js");
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js');
const { color } = require("../config/options.json");
const verify = require("../schemas/verifySchema.js");
const mongoose = require("mongoose");
const {
gm,
manager,
moderator,
beast,
member,
trialmember,
guildRole,
guildStaff,
defaultMember,
} = require("../config/roles.json");
const removeThese = [gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember];
const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require("../config/roles.json");
const removeThese = [ gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember ]
module.exports = {
name: "forceunverify",
description: "Force unverify a user",
type: "slash",
type: 'slash',
data: new SlashCommandBuilder()
.setName("forceunverify")
.setDescription("Force unverify a user")
.addUserOption((option) =>
option.setName("user").setDescription("The user to force unverify").setRequired(true),
)
.setName('forceunverify')
.setDescription('Force unverify a user')
.addUserOption(option =>
option
.setName('user')
.setDescription('The user to force unverify')
.setRequired(true))
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction) {
const member1 = interaction.options.getUser("user");
const member = interaction.guild.members.cache.get(member1.id);
const embedColor = Number(color.replace("#", "0x"));
const verifiedUser = await verify.findOne({ userID: member1.id });
const user = interaction.user;
const member1 = interaction.options.getUser('user');
const member = interaction.guild.members.cache.get(member1.id)
const embedColor = Number(color.replace('#', '0x'))
const verifiedUser = await verify.findOne({ userID: member1.id })
const user = interaction.user
if (!verifiedUser) {
return interaction.reply({
embeds: [
{
description: "This user is not verified",
color: embedColor,
},
],
});
embeds: [{
description: "This user is not verified",
color: embedColor,
}]
})
}
await verify.findOneAndDelete({ userID: member1.id });
await member.roles.remove(removeThese);
await verify.findOneAndDelete({ userID: member1.id })
await member.roles.remove(removeThese)
await interaction.reply({
embeds: [
{
description: "Successfully unverified" + userMention(member1.id),
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by taken.lua",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
});
},
};
embeds: [{
description: "Successfully unverified" + userMention(member1.id),
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by taken.lua",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
}

View File

@@ -1,41 +1,35 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js");
const env = require("dotenv").config();
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js');
const env = require('dotenv').config();
const hypixelAPIKey = process.env.HYPIXELAPIKEY;
const { hypixelGuildID, color } = require("../config/options.json");
const {
gm,
manager,
moderator,
beast,
elite,
member,
trialmember,
guildRole,
guildStaff,
defaultMember,
} = require("../config/roles.json");
const verify = require("../schemas/verifySchema.js");
const fetch = require("axios");
const removeThese = [gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff];
const { hypixelGuildID, color } = require('../config/options.json');
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json');
const verify = require('../schemas/verifySchema.js')
const fetch = require('axios');
const removeThese = [gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff]
module.exports = {
name: "forceupdate",
description: "Force update the user",
type: "slash",
name: 'forceupdate',
description: 'Force update the user',
type: 'slash',
data: new SlashCommandBuilder()
.setName("forceupdate")
.setDescription("Force update the user")
.addUserOption((option) => option.setName("user").setDescription("The user to force update").setRequired(true))
.setName('forceupdate')
.setDescription('Force update the user')
.addUserOption(option =>
option
.setName('user')
.setDescription('The user to force update')
.setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
async execute(interaction) {
await interaction.deferReply();
const user = interaction.options.getUser("user");
const user = interaction.options.getUser('user');
const usermentioned = userMention(user.id);
const verifyData = await verify.findOne({ userID: user.id });
const verifyData = await verify.findOne({ userID: user.id })
const embedColor = Number(color.replace("#", "0x"));
const user1 = interaction.guild.members.cache.get(user.id);
@@ -43,253 +37,252 @@ module.exports = {
if (!verifyData) {
await interaction.editReply({
embeds: [
{
description: "You are not verified. Please run `/verify` to verify yourself",
color: embedColor,
thumbnail: {
url: head,
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
embeds: [{
description: "You are not verified. Please run `/verify` to verify yourself",
color: embedColor,
thumbnail: {
url: head
},
],
});
return;
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
const mojangAPI = "https://api.mojang.com/user/profile/";
const guildlAPI = "https://api.hypixel.net/guild";
const mojangAPI = "https://api.mojang.com/user/profile/"
const guildlAPI = "https://api.hypixel.net/guild"
const minotar = "https://minotar.net/helm/";
const guild = guildlAPI + "?key=" + hypixelAPIKey + "&player=" + verifyData.uuid;
const guild = guildlAPI + "?key=" + hypixelAPIKey + "&player=" + verifyData.uuid;
const userCheck = await fetch(mojangAPI + verifyData.uuid);
const guildCheck = await fetch(guild);
const head = minotar + userCheck.data.name;
if (!guildCheck.data.guild) {
var responseGuildID = null;
} else {
var responseGuildID = guildCheck.data.guild._id;
}
if (!guildCheck.data.guild) {
var responseGuildID = null
} else {
var responseGuildID = guildCheck.data.guild._id
}
if (responseGuildID !== hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)");
}
await interaction.editReply({
embeds: [
{
description: usermentioned + " was given the the Default Member role.",
color: embedColor,
thumbnail: {
url: head,
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
});
await roleManage.add(defaultMember);
return;
}
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
if (responseGuildID === hypixelGuildID) {
const GuildMembers = guildCheck.data.guild.members;
const guildRank = GuildMembers.find((member) => member.uuid === verifyData.uuid).rank;
await interaction.editReply({
embeds: [{
description: usermentioned + " was given the the Default Member role.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
await roleManage.add(defaultMember)
return
}
if (guildRank === "Guild Master") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)");
}
if (responseGuildID === hypixelGuildID) {
await roleManage.add(guildRole, "User was force updated.");
await roleManage.add(guildStaff, "User was force updated.");
await roleManage.add(gm, "User was force updated.");
await roleManage.add(defaultMember, "User was force updated.");
const GuildMembers = guildCheck.data.guild.members;
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank;
await interaction.editReply({
embeds: [
{
description: usermentioned + "'s 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 }),
},
},
],
});
}
if (guildRank === 'Guild Master') {
if (guildRank === "Manager") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)");
}
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.");
await roleManage.add(guildStaff, "User was force updated.");
await roleManage.add(manager, "User was force updated.");
await roleManage.add(defaultMember, "User was force updated.");
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(guildStaff, "User was force updated.")
await roleManage.add(gm, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [
{
description: usermentioned + "'s 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 }),
},
},
],
});
}
if (guildRank === "Moderator") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)");
}
await interaction.editReply({
embeds: [{
description: usermentioned + "'s 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 was force updated.");
await roleManage.add(guildStaff, "User was force updated.");
await roleManage.add(moderator, "User was force updated.");
await roleManage.add(defaultMember, "User was force updated.");
if (guildRank === 'Manager') {
await interaction.editReply({
embeds: [
{
description: usermentioned + "'s 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. (Force Update)")
}
if (guildRank === "Beast") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)");
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(guildStaff, "User was force updated.")
await roleManage.add(manager, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await roleManage.add(guildRole, "User was force updated.");
await roleManage.add(beast, "User was force updated.");
await roleManage.add(defaultMember, "User was force updated.");
await interaction.editReply({
embeds: [
{
description: usermentioned + "'s 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 interaction.editReply({
embeds: [{
description: usermentioned + "'s 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 })
}
}]
})
}
if (guildRank === "Elite") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)");
}
if (guildRank === 'Moderator') {
await roleManage.add(guildRole, "User was force updated.");
await roleManage.add(elite, "User was force updated.");
await roleManage.add(defaultMember, "User was force updated.");
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await interaction.editReply({
embeds: [
{
description: usermentioned + "'s rank has been updated to `Elite`.",
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 was force updated.")
await roleManage.add(guildStaff, "User was force updated.")
await roleManage.add(moderator, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
if (guildRank === "Member") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)");
}
await roleManage.add(guildRole, "User was force updated.");
await roleManage.add(member, "User was force updated.");
await roleManage.add(defaultMember, "User was force updated.");
await interaction.editReply({
embeds: [{
description: usermentioned + "'s 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 interaction.editReply({
embeds: [
{
description: usermentioned + "'s 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;
}
}
if (guildRank === "Trial Member") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)");
}
if (guildRank === 'Beast') {
await roleManage.add(guildRole, "User was force updated.");
await roleManage.add(trialmember, "User was force updated.");
await roleManage.add(defaultMember, "User was force updated.");
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await interaction.editReply({
embeds: [
{
description: usermentioned + "'s 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;
}
}
},
};
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(beast, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s 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
}
if (guildRank === 'Elite') {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(elite, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s rank has been updated to `Elite`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildRank === 'Member') {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(member, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s 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
}
if (guildRank === 'Trial Member') {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
}
await roleManage.add(guildRole, "User was force updated.")
await roleManage.add(trialmember, "User was force updated.")
await roleManage.add(defaultMember, "User was force updated.")
await interaction.editReply({
embeds: [{
description: usermentioned + "'s 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
}
}
}
}

View File

@@ -1,194 +1,180 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
const env = require("dotenv").config();
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
const env = require('dotenv').config();
const hypixelApiKey = process.env.HYPIXELAPIKEY;
const fetch = require("axios");
const { color, hypixelGuildID } = require("../config/options.json");
const verify = require("../schemas/verifySchema.js");
const { mongoose } = require("mongoose");
const {
gm,
manager,
moderator,
beast,
elite,
member,
trialmember,
guildRole,
guildStaff,
defaultMember,
} = require("../config/roles.json");
const fetch = require('axios');
const { color, hypixelGuildID } = require('../config/options.json');
const verify = require('../schemas/verifySchema.js')
const {mongoose} = require('mongoose');
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json');
module.exports = {
name: "forceverify",
description: "Force verify a user.",
type: "slash",
name: 'forceverify',
description: 'Force verify a user.',
type: 'slash',
data: new SlashCommandBuilder()
.setName("forceverify")
.setDescription("Force verify a user.")
.addUserOption((option) => option.setName("user").setDescription("The user to force verify."))
.addStringOption((option) => option.setName("ign").setDescription("The user's in-game name."))
.setName('forceverify')
.setDescription('Force verify a user.')
.addUserOption(option =>
option
.setName('user')
.setDescription('The user to force verify.'))
.addStringOption(option =>
option
.setName('ign')
.setDescription('The user\'s in-game name.'))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
async execute(interaction) {
await interaction.deferReply();
const user1 = interaction.options.getUser("user");
const user1 = interaction.options.getUser('user');
const user = interaction.guild.members.cache.get(user1.id);
const ign = interaction.options.getString("ign");
const mod = interaction.user;
const ign = interaction.options.getString('ign');
const mod = interaction.user
// const slothPixel = "https://api.slothpixel.me/api/players/";
// const guildAPI = "https://api.slothpixel.me/api/guilds/"
const mojang = "https://api.mojang.com/users/profiles/minecraft/";
const hypixelApi = "https://api.hypixel.net/player";
const guildApi = "https://api.hypixel.net/guild";
const mojang = "https://api.mojang.com/users/profiles/minecraft/"
const hypixelApi = "https://api.hypixel.net/player"
const guildApi = "https://api.hypixel.net/guild"
const minotar = "https://minotar.net/helm/";
const embedColor = Number(color.replace("#", "0x"));
if (!user) {
interaction.editReply(
"Please provide a user to force verify.\nThis can also mean the user is not in the server.",
);
return;
interaction.editReply('Please provide a user to force verify.\nThis can also mean the user is not in the server.')
return
}
const verifyData = await verify.findOne({ userID: user.id });
const verifyData = await verify.findOne({ userID: user.id })
if (verifyData) {
interaction.editReply("That user is already verified.");
return;
interaction.editReply('That user is already verified.')
return
}
if (!ign) {
interaction.editReply("Please provide a player's IGN.");
return;
interaction.editReply('Please provide a player\'s IGN.')
return
}
if (user1.discriminator == "0") {
var username = user1.username;
var username = user1.username
} else {
var username = user1.username + "#" + user1.discriminator;
var username = user1.username + "#" + user1.discriminator
}
if (mod.discriminator == "0") {
var modName = mod.username;
var modName = mod.username
} else {
var modName = mod.username + "#" + mod.discriminator;
var modName = mod.username + "#" + mod.discriminator
}
try {
await fetch(mojang + ign);
} catch (err) {
interaction.editReply("That player doesn't exist. [Mojang]");
return;
interaction.editReply('That player doesn\'t exist. [Mojang]')
return
}
const userCheck = await fetch(mojang + ign);
const userUUID = userCheck.data.id;
const player = hypixelApi + "?key=" + hypixelApiKey + "&uuid=" + userUUID;
const guild = guildApi + "?key=" + hypixelApiKey + "&player=" + userUUID;
const player = hypixelApi + "?key=" + hypixelApiKey + "&uuid=" + userUUID
const guild = guildApi + "?key=" + hypixelApiKey + "&player=" + userUUID
const head = minotar + ign;
const hypixelCheck = await fetch(player);
if (!hypixelCheck.data.player) {
if (!hypixelCheck.data.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;
}
}
const guildCheck = await fetch(guild);
const guildCheck = await fetch(guild)
if (!guildCheck.data.guild) {
var responseGuildID = null;
var responseGuildID = null
} else {
var responseGuildID = guildCheck.data.guild._id;
var responseGuildID = guildCheck.data.guild._id
}
if (responseGuildID === hypixelGuildID) {
const GuildMembers = guildCheck.data.guild.members;
const guildRank = GuildMembers.find((member) => member.uuid === hypixelCheck.data.player.uuid).rank;
const GuildMembers = guildCheck.data.guild.members;
const guildRank = GuildMembers.find(member => member.uuid === hypixelCheck.data.player.uuid).rank;
if (guildRank === "Guild Master") {
await user.roles.add(gm, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName);
await user.roles.add(guildStaff, "User was force verified by " + modName);
}
if (guildRank === "Guild Master") {
await user.roles.add(gm, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName)
}
if (guildRank === "Manager") {
await user.roles.add(manager, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName);
await user.roles.add(guildStaff, "User was force verified by " + modName);
}
if (guildRank === "Manager") {
await user.roles.add(manager, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName)
}
if (guildRank === "Moderator") {
await user.roles.add(moderator, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName);
await user.roles.add(guildStaff, "User was force verified by " + modName);
}
if (guildRank === "Moderator") {
await user.roles.add(moderator, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName)
await user.roles.add(guildStaff, "User was force verified by " + modName)
}
if (guildRank === "Beast") {
await user.roles.add(beast, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName);
}
if (guildRank === "Beast") {
await user.roles.add(beast, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName)
}
if (guildRank === "Elite") {
await user.roles.add(elite, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName);
}
if (guildRank === "Elite") {
await user.roles.add(elite, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName)
}
if (guildRank === "Member") {
await user.roles.add(member, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName);
}
if (guildRank === "Member") {
await user.roles.add(member, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName)
}
if (guildRank === "Trial Member") {
await user.roles.add(trialmember, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName);
}
}
if (guildRank === "Trial Member") {
await user.roles.add(trialmember, "User was force verified by " + modName);
await user.roles.add(guildRole, "User was force verified by " + modName)
}
}
await user.roles.add(defaultMember, "User was force verified by " + modName);
const newVerify = new verify({
_id: new mongoose.Types.ObjectId(),
userID: user.id,
uuid: userUUID,
});
uuid: userUUID
})
await newVerify.save();
await interaction.editReply({
embeds: [
{
title: interaction.guild.name,
description:
"You have successfully force verified `" +
username +
"` with the account `" +
hypixelCheck.data.player.displayname +
"`.",
color: embedColor,
thumbnail: {
url: head,
},
footer: {
icon_url: interaction.guild.iconURL(),
text: interaction.guild.name + " | Developed by Taken#0002",
},
embeds: [{
title: interaction.guild.name,
description: "You have successfully force verified `" + username + "` with the account `" + hypixelCheck.data.player.displayname + "`.",
color: embedColor,
thumbnail: {
url: head
},
],
footer: {
icon_url: interaction.guild.iconURL(),
text: interaction.guild.name + " | Developed by Taken#0002"
}
}]
});
},
};
}
};

View File

@@ -1,51 +1,54 @@
const { SlashCommandBuilder, ChannelType } = require("discord.js");
const { color } = require("../config/options.json");
const { SlashCommandBuilder, ChannelType } = require('discord.js');
const { color } = require('../config/options.json');
module.exports = {
name: "help",
description: "Help command",
type: "slash",
data: new SlashCommandBuilder().setName("help").setDescription("Help command").setDMPermission(true),
name: 'help',
description: 'Help command',
type: 'slash',
data: new SlashCommandBuilder()
.setName('help')
.setDescription('Help command')
.setDMPermission(true),
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
const embedColor = Number(color.replace("#", "0x"));
const embedColor = Number(color.replace('#', '0x'));
await interaction.editReply({
embeds: [
{
title: "Commands",
description: "List of commands",
fields: [
{
name: "/check",
value: "Check the stats of a player",
},
{
name: "/reqs",
value: "Check the requirements of the guild",
},
{
name: "/update",
value: "Update's your roles",
},
{
name: "/help",
value: "Shows this message",
},
],
color: embedColor,
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }),
embeds: [{
title: 'Commands',
description: "List of commands",
fields: [
{
name: '/check',
value: 'Check the stats of a player'
},
footer: {
icon_url: interaction.guild.iconURL({ dynamic: true }),
text: interaction.guild.name + " | Developed by: @Taken#0001",
{
name: '/reqs',
value: 'Check the requirements of the guild'
},
{
name: '/update',
value: 'Update\'s your roles'
},
{
name: '/help',
value: 'Shows this message'
}
],
color: embedColor,
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true })
},
],
footer: {
icon_url: interaction.guild.iconURL({ dynamic: true }),
text: interaction.guild.name + ' | Developed by: @Taken#0001'
}
}]
});
},
};
}
};

View File

@@ -1,54 +1,51 @@
const { SlashCommandBuilder } = require("discord.js");
const { color } = require("../config/options.json");
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../config/reqs.json");
const { SlashCommandBuilder } = require('discord.js');
const { color } = require('../config/options.json');
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require('../config/reqs.json');
module.exports = {
name: "reqs",
description: "Displays the requirements for the guild.",
type: "slash",
data: new SlashCommandBuilder().setName("reqs").setDescription("Displays the requirements for the guild."),
name: 'reqs',
description: 'Displays the requirements for the guild.',
type: 'slash',
data: new SlashCommandBuilder()
.setName('reqs')
.setDescription('Displays the requirements for the guild.'),
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
const embedColor = Number(color.replace("#", "0x"));
await interaction.editReply({
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() + "`",
},
{
name: "**Duels**",
value: "**Wins:** `" + duelswins.toString() + "`\n**WLR:** `" + duelswlr.toString() + "`",
},
],
footer: {
text: interaction.guild.name + " | Developed by: @Taken#0002",
icon_url: interaction.guild.iconURL(),
},
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() + '`'
},
{
name: '**Duels**',
value: '**Wins:** `' + duelswins.toString() +
'`\n**WLR:** `' + duelswlr.toString() + '`'
}
],
footer: {
text: interaction.guild.name + ' | Developed by: @Taken#0002',
icon_url: interaction.guild.iconURL()
}
}]
})
}
}

View File

@@ -1,34 +1,41 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
const { color } = require("../config/options.json");
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
const { color } = require('../config/options.json');
module.exports = {
name: "send",
description: "Send a message to a channel.",
type: "slash",
name: 'send',
description: 'Send a message to a channel.',
type: 'slash',
data: new SlashCommandBuilder()
.setName("send")
.setDescription("Send a message to a channel.")
.addStringOption((option) => option.setName("message").setDescription("The message to send."))
.addChannelOption((option) => option.setName("channel").setDescription("The channel to send the message to."))
.setName('send')
.setDescription('Send a message to a channel.')
.addStringOption(option =>
option
.setName('message')
.setDescription('The message to send.'))
.addChannelOption(option =>
option
.setName('channel')
.setDescription('The channel to send the message to.'))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
const message = interaction.options.getString("message");
const channel = interaction.options.getChannel("channel");
const message = interaction.options.getString('message');
const channel = interaction.options.getChannel('channel');
const embedColor = Number(color.replace("#", "0x"));
if (!message) {
interaction.editReply({ content: "Please provide a message to send.", ephemeral: true });
return;
interaction.editReply({ content: 'Please provide a message to send.', ephemeral: true })
return
}
if (!channel) {
interaction.editReply({ content: "Please provide a channel to send the message to.", ephemeral: true });
return;
interaction.editReply({ content: 'Please provide a channel to send the message to.', ephemeral: true })
return
}
channel.send({
@@ -38,13 +45,13 @@ module.exports = {
description: message,
color: embedColor,
thumbnail: {
url: interaction.guild.iconURL({ dynamic: true }),
url: interaction.guild.iconURL({ dynamic: true })
},
footer: {
text: "Developed by @Taken#0002",
},
},
],
text: "Developed by @Taken#0002"
}
}
]
});
},
};
}
};

View File

@@ -1,34 +1,39 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js");
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js')
module.exports = {
name: "setnick",
description: "Set your nickname",
type: "slash",
name: 'setnick',
description: 'Set your nickname',
type: 'slash',
data: new SlashCommandBuilder()
.setName("setnick")
.setDescription("Set your nickname")
.addUserOption((option) =>
option.setName("user").setDescription("The user to set the nickname for").setRequired(true),
)
.addStringOption((option) => option.setName("nickname").setDescription("The nickname to set").setRequired(true))
.setName('setnick')
.setDescription('Set your nickname')
.addUserOption(option =>
option
.setName('user')
.setDescription('The user to set the nickname for')
.setRequired(true))
.addStringOption(option =>
option
.setName('nickname')
.setDescription('The nickname to set')
.setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames)
.setDMPermission(false),
async execute(interaction) {
const user = interaction.options.getUser("user");
const nickname = interaction.options.getString("nickname");
const user = interaction.options.getUser('user');
const nickname = interaction.options.getString('nickname');
const member = await interaction.guild.members.fetch(user.id);
if (!member.manageable) {
return interaction.reply({ content: "I cannot set the nickname for this user!", ephemeral: true });
return interaction.reply({ content: 'I cannot set the nickname for this user!', ephemeral: true });
}
await member.setNickname(nickname, `Set by ${interaction.user.tag}`);
await interaction.reply({
content: "Set the nickname of " + userMention(member.id) + " to " + nickname,
ephemeral: true,
});
},
};
await interaction.reply({ content: "Set the nickname of " + userMention(member.id) + " to " + nickname, ephemeral: true });
}
}

View File

@@ -1,57 +1,59 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
const { color } = require("../config/options.json");
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
const { color } = require('../config/options.json');
module.exports = {
name: "slowmode",
description: "Set the slowmode of a channel.",
type: "slash",
name: 'slowmode',
description: 'Set the slowmode of a channel.',
type: 'slash',
data: new SlashCommandBuilder()
.setName("slowmode")
.setDescription("Set the slowmode of a channel.")
.addIntegerOption((option) =>
option.setName("seconds").setDescription("The amount of seconds to set the slowmode to."),
)
.addChannelOption((option) => option.setName("channel").setDescription("The channel to set the slowmode of."))
.setName('slowmode')
.setDescription('Set the slowmode of a channel.')
.addIntegerOption(option =>
option
.setName('seconds')
.setDescription('The amount of seconds to set the slowmode to.'))
.addChannelOption(option =>
option
.setName('channel')
.setDescription('The channel to set the slowmode of.'))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
async execute(interaction) {
await interaction.deferReply({ ephermeral: true });
const seconds = interaction.options.getInteger("seconds") ?? 5;
const channel = interaction.options.getChannel("channel") ?? interaction.channel;
const seconds = interaction.options.getInteger('seconds') ?? 5
const channel = interaction.options.getChannel('channel') ?? interaction.channel
const embedColor = Number(color.replace("#", "0x"));
if (seconds > 21600) {
await channel.setRateLimitPerUser(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 + " | Developed by: @Taken#0001",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
});
return;
}
await interaction.editReply({
embeds: [
{
description: `Set the slowmode of ${channel} to ${seconds} seconds.`,
embeds: [{
description: `Set the slowmode of ${channel} to 21600 seconds.`,
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by: @Taken#0001",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
});
await channel.setRateLimitPerUser(seconds);
},
};
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
await interaction.editReply({
embeds: [{
description: `Set the slowmode of ${channel} to ${seconds} seconds.`,
color: embedColor,
footer: {
text: interaction.guild.name + " | Developed by: @Taken#0001",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
await channel.setRateLimitPerUser(seconds)
}
}

View File

@@ -1,289 +1,281 @@
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,
elite,
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, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json');
const removeThese = [gm, manager, moderator, beast, elite, 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();
const user1 = interaction.user;
const user = interaction.guild.members.cache.get(user1.id);
const verifyData = await verify.findOne({ userID: user.id });
const verifyData = await verify.findOne({ userID: user.id })
const roleManage = user.roles;
const embedColor = Number(color.replace("#", "0x"));
if (!verifyData) {
await interaction.editReply({
embeds: [
{
description: "You are not verified. Please run `/verify` to verify yourself",
color: embedColor,
thumbnail: {
url: head,
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
embeds: [{
description: "You are not verified. Please run `/verify` to verify yourself",
color: embedColor,
thumbnail: {
url: head
},
],
});
return;
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
const mojangAPI = "https://api.mojang.com/user/profile/";
const guildAPI = "https://api.hypixel.net/guild";
const mojangAPI = "https://api.mojang.com/user/profile/"
const guildAPI = "https://api.hypixel.net/guild"
const minotar = "https://minotar.net/helm/";
const userCheck = await fetch(mojangAPI + verifyData.uuid);
const head = minotar + userCheck.data.name;
const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + verifyData.uuid;
const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + verifyData.uuid
const guildCheck = await fetch(guild);
if (!guildCheck.data.guild) {
var guildID = null;
var guildID = null
} else {
var guildID = guildCheck.data.guild._id;
var guildID = guildCheck.data.guild._id
}
if (guildID !== hypixelGuildID) {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
}
await roleManage.add(defaultMember, "User used the update command");
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 }),
},
embeds: [{
description: "Updated your roles to `Default Member`",
color: embedColor,
thumbnail: {
url: head
},
],
});
return;
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildID === hypixelGuildID) {
const GuildMembers = guildCheck.data.guild.members;
const guildRank = GuildMembers.find((member) => member.uuid === verifyData.uuid).rank;
if (guildID === hypixelGuildID) {
if (guildRank === "Guild Master") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
const GuildMembers = guildCheck.data.guild.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') {
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)")
}
if (guildRank === "Manager") {
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")
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");
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 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 })
}
}]
})
}
if (guildRank === "Moderator") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
if (guildRank === 'Manager') {
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");
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(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 === "Beast") {
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(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 `Manager`",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
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;
}
if (guildRank === 'Moderator') {
if (guildRank === "Elite") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
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(elite, "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(guildStaff, "User used the update command")
await roleManage.add(moderator, "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 `Elite`.",
color: embedColor,
thumbnail: {
url: head,
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
},
],
});
return;
}
if (guildRank === "Member") {
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(member, "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;
}
if (guildRank === 'Beast') {
if (guildRank === "Trial Member") {
for (let i = 0; i < removeThese.length; i++) {
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
}
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(trialmember, "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(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 `Trial 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 `Beast`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildRank === 'Elite') {
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(elite, "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 `Elite`.",
color: embedColor,
thumbnail: {
url: head
},
footer: {
text: interaction.guild.name + " | Developed by @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
return
}
if (guildRank === 'Member') {
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 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
}
if (guildRank === 'Trial Member') {
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(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
}
}
}
};

View File

@@ -5,18 +5,7 @@ const fetch = require("axios");
const { color, hypixelGuildID } = require("../config/options.json");
const verify = require("../schemas/verifySchema.js");
const mongoose = require("mongoose");
const {
gm,
manager,
moderator,
beast,
elite,
member,
trialmember,
guildRole,
guildStaff,
defaultMember,
} = require("../config/roles.json");
const { gm, manager, moderator, beast, elite, member, trialmember, guildRole, guildStaff, defaultMember } = require("../config/roles.json");
module.exports = {
name: "verify",
@@ -26,18 +15,21 @@ module.exports = {
data: new SlashCommandBuilder()
.setName("verify")
.setDescription("Verify yourself as a member of the server.")
.addStringOption((option) => option.setName("ign").setDescription("Your in-game name."))
.addStringOption((option) =>
option
.setName("ign")
.setDescription("Your in-game name."))
.setDMPermission(false),
async execute(interaction) {
await interaction.deferReply();
const user1 = interaction.user;
const user1 = interaction.user
const user = interaction.guild.members.cache.get(user1.id);
const ign = interaction.options.getString("ign");
const mojang = "https://api.mojang.com/users/profiles/minecraft/";
const hypixel = "https://api.hypixel.net/player";
const guildAPI = "https://api.hypixel.net/guild";
const hypixel = "https://api.hypixel.net/player"
const guildAPI = "https://api.hypixel.net/guild"
const minotar = "https://minotar.net/helm/";
const embedColor = Number(color.replace("#", "0x"));
const head = minotar + ign;
@@ -45,19 +37,17 @@ module.exports = {
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;
}
@@ -65,12 +55,10 @@ module.exports = {
await fetch(mojang + ign);
} catch (err) {
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;
}
@@ -78,126 +66,111 @@ module.exports = {
const userCheck = await fetch(mojang + ign);
const userUUID = userCheck.data.id;
const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + userUUID;
const player = hypixel + "?key=" + hypixelApiKey + "&uuid=" + userUUID
const stats = await fetch(player);
if (!stats.data.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;
}
if (user1.discriminator === "0") {
var username = user1.username;
var username = user1.username
} else {
var username = user1.username + "#" + user1.discriminator;
var username = user1.username + "#" + user1.discriminator
}
if (!stats.data.player.socialMedia.links.DISCORD) {
interaction.editReply({
embeds: [
{
description:
"<a:cross_a:1087808606897983539> There is no Discord account linked to `" +
stats.data.player.displayname +
"`.\n\n" +
"**Please set your Discord tag on hypixel to `" +
username +
"` and try again.**",
color: embedColor,
},
],
description: "<a:cross_a:1087808606897983539> There is no Discord account linked to `" + stats.data.player.displayname + "`.\n\n" +
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
color: embedColor
}
]
});
return;
}
const linkedDiscord = stats.data.player.socialMedia.links.DISCORD;
const linkedDiscord = stats.data.player.socialMedia.links.DISCORD
if (linkedDiscord !== username) {
interaction.editReply({
embeds: [
{
description:
"<a:cross_a:1087808606897983539> The Discord account linked to `" +
stats.data.player.displayname +
"` is currently `" +
linkedDiscord +
"`\n\n" +
"**Please set your Discord tag on hypixel to `" +
username +
"` and try again.**",
color: embedColor,
},
],
description: "<a:cross_a:1087808606897983539> The Discord account linked to `" + stats.data.player.displayname + "` is currently `" + linkedDiscord + "`\n\n" +
"**Please set your Discord tag on hypixel to `" + username + "` and try again.**",
color: embedColor
}
]
});
return;
}
const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + userUUID;
const guild = guildAPI + "?key=" + hypixelApiKey + "&player=" + userUUID
const guildCheck = await fetch(guild);
if (!guildCheck.data.guild) {
var guildID = null;
var guildID = null
} else {
var guildID = guildCheck.data.guild._id;
var guildID = guildCheck.data.guild._id
}
if (guildID === hypixelGuildID) {
const GuildMembers = guildCheck.data.guild.members;
const guildRank = GuildMembers.find((member) => member.uuid === stats.data.player.uuid).rank;
if (guildID === hypixelGuildID) {
const GuildMembers = guildCheck.data.guild.members
const guildRank = GuildMembers.find((member) => member.uuid === stats.data.player.uuid).rank;
if (guildRank === "Guild Master" && guildID === hypixelGuildID) {
await user.roles.add(gm, "Verification");
await user.roles.add(guildRole, "Verification");
await user.roles.add(guildStaff, "Verification");
}
if (guildRank === "Guild Master" && guildID === hypixelGuildID) {
await user.roles.add(gm, "Verification");
await user.roles.add(guildRole, "Verification");
await user.roles.add(guildStaff, "Verification");
}
if (guildRank === "Manager" && guildID === hypixelGuildID) {
await user.roles.add(manager, "Verification");
await user.roles.add(guildRole, "Verification");
await user.roles.add(guildStaff, "Verification");
}
if (guildRank === "Manager" && guildID === hypixelGuildID) {
await user.roles.add(manager, "Verification");
await user.roles.add(guildRole, "Verification");
await user.roles.add(guildStaff, "Verification");
}
if (guildRank === "Moderator" && guildID === hypixelGuildID) {
await user.roles.add(moderator, "Verification");
await user.roles.add(guildRole, "Verification");
await user.roles.add(guildStaff, "Verification");
}
if (guildRank === "Moderator" && guildID === hypixelGuildID) {
await user.roles.add(moderator, "Verification");
await user.roles.add(guildRole, "Verification");
await user.roles.add(guildStaff, "Verification");
}
if (guildRank === "Beast" && guildID === hypixelGuildID) {
await user.roles.add(beast, "Verification");
await user.roles.add(guildRole, "Verification");
}
if (guildRank === "Beast" && guildID === hypixelGuildID) {
await user.roles.add(beast, "Verification");
await user.roles.add(guildRole, "Verification");
}
if (guildRank === "Elite" && guildID === hypixelGuildID) {
await user.roles.add(elite, "Verification");
await user.roles.add(guildRole, "Verification");
}
if (guildRank === "Elite" && guildID === hypixelGuildID) {
await user.roles.add(elite, "Verification");
await user.roles.add(guildRole, "Verification");
}
if (guildRank === "Member" && guildID === hypixelGuildID) {
await user.roles.add(member, "Verification");
await user.roles.add(guildRole, "Verification");
}
if (guildRank === "Member" && guildID === hypixelGuildID) {
await user.roles.add(member, "Verification");
await user.roles.add(guildRole, "Verification");
}
if (guildRank === "Trial Member" && guildID === hypixelGuildID) {
await user.roles.add(trialmember, "Verification");
await user.roles.add(guildRole, "Verification");
}
}
if (guildRank === "Trial Member" && guildID === hypixelGuildID) {
await user.roles.add(trialmember, "Verification");
await user.roles.add(guildRole, "Verification");
}
}
await user.roles.add(defaultMember, "Verification");
const newVerify = new verify({
_id: new mongoose.Types.ObjectId(),
userID: user.id,
uuid: userUUID,
uuid: userUUID
});
await newVerify.save();
@@ -206,22 +179,17 @@ module.exports = {
embeds: [
{
title: interaction.guild.name,
description:
"You have successfully verified `" +
username +
"` with the account `" +
stats.data.player.displayname +
"`.",
description: "You have successfully verified `" + username + "` with the account `" + stats.data.player.displayname + "`.",
color: embedColor,
thumbnail: {
url: head,
url: head
},
footer: {
icon_url: interaction.guild.iconURL(),
text: interaction.guild.name + " | Developed by Taken#0002",
},
},
],
text: interaction.guild.name + " | Developed by Taken#0002"
}
}
]
});
},
};
}
};

View File

@@ -1,35 +1,38 @@
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require("discord.js");
const { color } = require("../config/options.json");
const verify = require("../schemas/verifySchema.js");
const fetch = require("axios");
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js');
const { color } = require('../config/options.json');
const verify = require('../schemas/verifySchema.js');
const fetch = require('axios');
module.exports = {
name: "whois",
description: "Get's the ign of a user.",
type: "slash",
name: 'whois',
description: 'Get\'s the ign of a user.',
type: 'slash',
data: new SlashCommandBuilder()
.setName("whois")
.setDescription("Get's the ign of a user.")
.addUserOption((option) =>
option.setName("user").setDescription("The user to get the ign of.").setRequired(true),
)
.setName('whois')
.setDescription('Get\'s the ign of a user.')
.addUserOption(option =>
option
.setName('user')
.setDescription('The user to get the ign of.')
.setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
async execute(interaction) {
await interaction.deferReply();
const user = interaction.options.getUser("user");
const user = interaction.options.getUser('user');
const embedColor = Number(color.replace("#", "0x"));
const mojang = "https://api.mojang.com/user/profile/";
const mojang = "https://api.mojang.com/user/profile/"
const minotar = "https://minotar.net/helm/";
const verifiedUser = await verify.findOne({ userID: user.id });
if (!verifiedUser) {
interaction.editReply({ content: "This user has not verified their account." });
return;
interaction.editReply({ content: 'This user has not verified their account.' });
return
}
const userCheck = await fetch(mojang + verifiedUser.uuid);
@@ -37,20 +40,19 @@ module.exports = {
const head = minotar + 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 + " | Developed by: @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true }),
},
embeds: [{
title: interaction.guild.name,
description: "**User:** " + userMention(user.id) + "\n**IGN:** " + ign,
color: embedColor,
thumbnail: {
url: head
},
],
});
},
};
footer: {
text: interaction.guild.name + " | Developed by: @Taken#0002",
icon_url: interaction.guild.iconURL({ dynamic: true })
}
}]
})
}
};