@@ -1,46 +1,34 @@
|
|||||||
const {
|
const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention} = require('discord.js');
|
||||||
ContextMenuCommandBuilder,
|
|
||||||
ApplicationCommandType,
|
|
||||||
PermissionFlagsBits,
|
|
||||||
userMention
|
|
||||||
} = require("discord.js");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "congratsmessage",
|
name: 'congratsmessage',
|
||||||
description: "Congratulate a user.",
|
description: 'Congratulate a user.',
|
||||||
type: "contextmenu",
|
type: 'contextmenu',
|
||||||
|
|
||||||
data: new ContextMenuCommandBuilder()
|
data: new ContextMenuCommandBuilder()
|
||||||
.setName("Congratulate")
|
.setName('Congratulate')
|
||||||
.setType(ApplicationCommandType.Message)
|
.setType(ApplicationCommandType.Message)
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
|
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const { targetId } = interaction;
|
|
||||||
const message = await interaction.channel.messages.fetch(targetId);
|
|
||||||
|
|
||||||
if (!message) {
|
const { targetId } = interaction
|
||||||
return interaction.reply({
|
const message = await interaction.channel.messages.fetch(targetId);
|
||||||
content: "That user does not exist.",
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const target = message.author;
|
if (!message) {
|
||||||
|
return interaction.reply({ content: 'That user does not exist.', ephemeral: true });
|
||||||
await message.reply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: "Congratulations!",
|
|
||||||
description: `GG to ${userMention(target.id)}!`
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
|
||||||
await message.react("🎉");
|
|
||||||
|
|
||||||
await interaction.reply({
|
const target = message.author;
|
||||||
content: `Sent a congrats message`,
|
|
||||||
ephemeral: true
|
await message.reply({
|
||||||
});
|
embeds:[{
|
||||||
}
|
title: 'Congratulations!',
|
||||||
|
description: `GG to ${userMention(target.id)}!`,
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
await message.react('🎉');
|
||||||
|
|
||||||
|
await interaction.reply({ content: `Sent a congrats message`, ephemeral: true });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,55 +1,34 @@
|
|||||||
const {
|
const { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits } = require('discord.js');
|
||||||
ContextMenuCommandBuilder,
|
|
||||||
ApplicationCommandType,
|
|
||||||
PermissionFlagsBits
|
|
||||||
} = require("discord.js");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "resetnick",
|
name: 'resetnick',
|
||||||
description: "Reset your nickname.",
|
description: 'Reset your nickname.',
|
||||||
type: "contextmenu",
|
type: 'contextmenu',
|
||||||
|
|
||||||
data: new ContextMenuCommandBuilder()
|
data: new ContextMenuCommandBuilder()
|
||||||
.setName("Reset Nickname")
|
.setName('Reset Nickname')
|
||||||
.setType(ApplicationCommandType.User)
|
.setType(ApplicationCommandType.User)
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames),
|
.setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const { targetId } = interaction;
|
|
||||||
const target = await interaction.guild.members.fetch(targetId);
|
|
||||||
|
|
||||||
if (!target) {
|
const { targetId } = interaction
|
||||||
return interaction.reply({
|
const target = await interaction.guild.members.fetch(targetId);
|
||||||
content: "That user does not exist.",
|
|
||||||
ephemeral: true
|
if (!target) {
|
||||||
});
|
return interaction.reply({ content: 'That user does not exist.', ephemeral: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target.id === interaction.user.id) {
|
||||||
|
return interaction.reply({ content: 'You can\'t reset your own nickname.', ephemeral: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!target.manageable) {
|
||||||
|
return interaction.reply({ content: 'I cannot reset that user\'s nickname.', ephemeral: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
await target.setNickname(target.user.username, 'Reset by ' + interaction.user.username + "#" + interaction.user.discriminator);
|
||||||
|
|
||||||
|
return interaction.reply({ content: `Reset ${target.user.username}'s nickname.`, ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.id === interaction.user.id) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "You can't reset your own nickname.",
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!target.manageable) {
|
|
||||||
return interaction.reply({
|
|
||||||
content: "I cannot reset that user's nickname.",
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
await target.setNickname(
|
|
||||||
target.user.username,
|
|
||||||
"Reset by " +
|
|
||||||
interaction.user.username +
|
|
||||||
"#" +
|
|
||||||
interaction.user.discriminator
|
|
||||||
);
|
|
||||||
|
|
||||||
return interaction.reply({
|
|
||||||
content: `Reset ${target.user.username}'s nickname.`,
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
@@ -1,44 +1,49 @@
|
|||||||
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
|
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
|
||||||
const getuuid = require("../utils/functions");
|
const getuuid = require('../utils/functions');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "functest",
|
name: 'functest',
|
||||||
description: "Test command for the bot.",
|
description: 'Test command for the bot.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("functest")
|
.setName('functest')
|
||||||
.setDescription("Test command for the bot.")
|
.setDescription('Test command for the bot.')
|
||||||
.addStringOption((option) =>
|
.addStringOption(option =>
|
||||||
option.setName("test").setDescription("Test option.")
|
option
|
||||||
)
|
.setName('test')
|
||||||
.addStringOption((option) =>
|
.setDescription('Test option.'))
|
||||||
option.setName("test2").setDescription("Test option.")
|
.addStringOption(option =>
|
||||||
)
|
option
|
||||||
.addStringOption((option) =>
|
.setName('test2')
|
||||||
option.setName("test3").setDescription("Test option.")
|
.setDescription('Test option.'))
|
||||||
)
|
.addStringOption(option =>
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
option
|
||||||
.setDMPermission(false),
|
.setName('test3')
|
||||||
|
.setDescription('Test option.'))
|
||||||
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
|
.setDMPermission(false),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const test = interaction.options.getString("test");
|
|
||||||
const test2 = interaction.options.getString("test2");
|
|
||||||
const test3 = interaction.options.getString("test3");
|
|
||||||
|
|
||||||
const uuid = await getuuid(test);
|
const test = interaction.options.getString('test');
|
||||||
|
const test2 = interaction.options.getString('test2');
|
||||||
|
const test3 = interaction.options.getString('test3');
|
||||||
|
|
||||||
|
const uuid = await getuuid(test);
|
||||||
|
|
||||||
|
if (uuid === null) {
|
||||||
|
await interaction.reply({
|
||||||
|
content: 'Invalid username.',
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await interaction.reply({
|
||||||
|
content: uuid,
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
|
||||||
if (uuid === null) {
|
|
||||||
await interaction.reply({
|
|
||||||
content: "Invalid username.",
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await interaction.reply({
|
|
||||||
content: uuid,
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
@@ -1,197 +1,162 @@
|
|||||||
const {
|
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js');
|
||||||
SlashCommandBuilder,
|
const env = require('dotenv').config();
|
||||||
PermissionFlagsBits,
|
|
||||||
userMention
|
|
||||||
} = require("discord.js");
|
|
||||||
const env = require("dotenv").config();
|
|
||||||
const dev = process.env.DEV;
|
const dev = process.env.DEV;
|
||||||
const { color } = require("../config/options.json");
|
const { color } = require('../config/options.json');
|
||||||
const { admin, helper, muted } = require("../config/roles.json");
|
const { admin, helper, muted } = require('../config/roles.json');
|
||||||
const { staffOtherChannel } = require("../config/options.json");
|
const { staffOtherChannel } = require('../config/options.json');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "mute",
|
name: 'mute',
|
||||||
description: "Mute a user",
|
description: 'Mute a user',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("mute")
|
.setName('mute')
|
||||||
.setDescription("Mute a user")
|
.setDescription('Mute a user')
|
||||||
.addUserOption((option) =>
|
.addUserOption(option =>
|
||||||
option
|
option
|
||||||
.setName("user")
|
.setName('user')
|
||||||
.setDescription("The user to mute")
|
.setDescription('The user to mute')
|
||||||
.setRequired(true)
|
.setRequired(true))
|
||||||
)
|
.addStringOption(option =>
|
||||||
.addStringOption((option) =>
|
option
|
||||||
option.setName("reason").setDescription("The reason for the mute")
|
.setName('reason')
|
||||||
)
|
.setDescription('The reason for the mute'))
|
||||||
.addStringOption((option) =>
|
.addStringOption(option =>
|
||||||
option.setName("duration").setDescription("The duration of the mute")
|
option
|
||||||
)
|
.setName('duration')
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
.setDescription('The duration of the mute'))
|
||||||
.setDMPermission(false),
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
|
.setDMPermission(false),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const member1 = interaction.options.getUser("user");
|
|
||||||
const member = interaction.guild.members.cache.get(member1.id);
|
|
||||||
const reason =
|
|
||||||
interaction.options.getString("reason") ?? "No reason provided";
|
|
||||||
const duration = interaction.options.getString("duration");
|
|
||||||
const guild = interaction.guild;
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
const userRoles = await guild.members
|
const member1 = interaction.options.getUser('user');
|
||||||
.fetch(interaction.user.id)
|
const member = interaction.guild.members.cache.get(member1.id);
|
||||||
.then((member) => member.roles.cache.map((role) => role.id));
|
const reason = interaction.options.getString('reason') ?? 'No reason provided';
|
||||||
const memberRoles = await guild.members
|
const duration = interaction.options.getString('duration');
|
||||||
.fetch(member1.id)
|
const guild = interaction.guild;
|
||||||
.then((member) => member.roles.cache.map((role) => role.id));
|
const embedColor = Number(color.replace('#', '0x'));
|
||||||
|
|
||||||
await interaction.deferReply({});
|
const userRoles = await guild.members.fetch(interaction.user.id).then(member => member.roles.cache.map(role => role.id));
|
||||||
|
const memberRoles = await guild.members.fetch(member1.id).then(member => member.roles.cache.map(role => role.id));
|
||||||
|
|
||||||
if (!userRoles.includes(admin || helper)) {
|
await interaction.deferReply({});
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description: "You don't have permission to use this command.",
|
|
||||||
color: embedColor,
|
|
||||||
footer: {
|
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (member.id === interaction.user.id) {
|
if (!userRoles.includes(admin || helper)) {
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: "You don't have permission to use this command.",
|
||||||
description: "You can't mute yourself.",
|
color: embedColor,
|
||||||
color: embedColor,
|
footer: {
|
||||||
footer: {
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
}
|
||||||
}
|
}]
|
||||||
}
|
});
|
||||||
]
|
return
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (member.id === dev) {
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description: "You can't mute my developer.",
|
|
||||||
color: embedColor,
|
|
||||||
footer: {
|
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (memberRoles.includes(admin) || memberRoles.includes(helper)) {
|
|
||||||
// await interaction.editReply({
|
|
||||||
// embeds: [{
|
|
||||||
// description: "You can't mute a staff member.",
|
|
||||||
// color: embedColor,
|
|
||||||
// footer: {
|
|
||||||
// text: interaction.guild.name + " | Developed by @Taken#0002",
|
|
||||||
// icon_url: interaction.guild.iconURL({ dynamic: true })
|
|
||||||
// }
|
|
||||||
// }]
|
|
||||||
// });
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (!duration) {
|
|
||||||
await member.roles.add(muted, reason);
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description:
|
|
||||||
"Successfully muted " + userMention(member1.id) + " forever.",
|
|
||||||
color: embedColor,
|
|
||||||
footer: {
|
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(duration);
|
|
||||||
|
|
||||||
const weeks = duration.replace(/[0-9][dhms]/g, "").replace(/w/g, "");
|
|
||||||
const days = duration.replace(/[0-9][whms]/g, "").replace(/d/g, "");
|
|
||||||
const hours = duration.replace(/[0-9][wdms]/g, "").replace(/h/g, "");
|
|
||||||
const minutes = duration.replace(/[0-9][wdhs]/g, "").replace(/m/g, "");
|
|
||||||
const seconds = duration.replace(/[0-9][wdhm]/g, "").replace(/s/g, "");
|
|
||||||
|
|
||||||
const nweeks = Number(weeks) ?? 0;
|
|
||||||
const ndays = Number(days) ?? 0;
|
|
||||||
const nhours = Number(hours) ?? 0;
|
|
||||||
const nminutes = Number(minutes) ?? 0;
|
|
||||||
const nseconds = Number(seconds) ?? 0;
|
|
||||||
|
|
||||||
const time =
|
|
||||||
nweeks * 604800000 +
|
|
||||||
ndays * 86400000 +
|
|
||||||
nhours * 3600000 +
|
|
||||||
nminutes * 60000 +
|
|
||||||
nseconds * 1000;
|
|
||||||
const mutedTime =
|
|
||||||
(nweeks > 0 ? nweeks + " week(s), " : "") +
|
|
||||||
(ndays > 0 ? ndays + " day(s), " : "") +
|
|
||||||
(nhours > 0 ? nhours + " hour(s), " : "") +
|
|
||||||
(nminutes > 0 ? nminutes + " minute(s), " : "") +
|
|
||||||
(nseconds > 0 ? nseconds + " second(s)" : "");
|
|
||||||
|
|
||||||
await member.roles.add(muted, reason);
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description:
|
|
||||||
"Successfully muted " +
|
|
||||||
userMention(member1.id) +
|
|
||||||
" for " +
|
|
||||||
mutedTime +
|
|
||||||
".",
|
|
||||||
color: embedColor,
|
|
||||||
footer: {
|
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const logChannel = interaction.guild.channels.cache.get(staffOtherChannel);
|
if (member.id === interaction.user.id) {
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: "You can't mute yourself.",
|
||||||
|
color: embedColor,
|
||||||
|
footer: {
|
||||||
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(async () => {
|
if (member.id === dev) {
|
||||||
await member.roles.remove(muted, "Mute duration has ended.");
|
await interaction.editReply({
|
||||||
await logChannel.send({
|
embeds: [{
|
||||||
embeds: [
|
description: "You can't mute my developer.",
|
||||||
{
|
color: embedColor,
|
||||||
description: userMention(member1.id) + " has been unmuted.",
|
footer: {
|
||||||
color: embedColor,
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
footer: {
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
text: "ID: " + member1.id,
|
}
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
}]
|
||||||
}
|
});
|
||||||
}
|
return
|
||||||
]
|
}
|
||||||
});
|
|
||||||
}, time);
|
// if (memberRoles.includes(admin) || memberRoles.includes(helper)) {
|
||||||
}
|
// await interaction.editReply({
|
||||||
|
// embeds: [{
|
||||||
|
// description: "You can't mute a staff member.",
|
||||||
|
// color: embedColor,
|
||||||
|
// footer: {
|
||||||
|
// text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
|
// icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
|
// }
|
||||||
|
// }]
|
||||||
|
// });
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (!duration) {
|
||||||
|
await member.roles.add(muted, reason);
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: "Successfully muted " + userMention(member1.id) + " forever.",
|
||||||
|
color: embedColor,
|
||||||
|
footer: {
|
||||||
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(duration);
|
||||||
|
|
||||||
|
const weeks = duration.replace(/[0-9][dhms]/g, '').replace(/w/g, '')
|
||||||
|
const days = duration.replace(/[0-9][whms]/g, '').replace(/d/g, '')
|
||||||
|
const hours = duration.replace(/[0-9][wdms]/g, '').replace(/h/g, '')
|
||||||
|
const minutes = duration.replace(/[0-9][wdhs]/g, '').replace(/m/g, '')
|
||||||
|
const seconds = duration.replace(/[0-9][wdhm]/g, '').replace(/s/g, '')
|
||||||
|
|
||||||
|
const nweeks = Number(weeks) ?? 0;
|
||||||
|
const ndays = Number(days) ?? 0;
|
||||||
|
const nhours = Number(hours) ?? 0;
|
||||||
|
const nminutes = Number(minutes) ?? 0;
|
||||||
|
const nseconds = Number(seconds) ?? 0;
|
||||||
|
|
||||||
|
const time = nweeks * 604800000 + ndays * 86400000 + nhours * 3600000 + nminutes * 60000 + nseconds * 1000;
|
||||||
|
const mutedTime = (nweeks > 0 ? nweeks + " week(s), " : "") + (ndays > 0 ? ndays + " day(s), " : "") + (nhours > 0 ? nhours + " hour(s), " : "") + (nminutes > 0 ? nminutes + " minute(s), " : "") + (nseconds > 0 ? nseconds + " second(s)" : "");
|
||||||
|
|
||||||
|
await member.roles.add(muted, reason);
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: "Successfully muted " + userMention(member1.id) + " for " + mutedTime + ".",
|
||||||
|
color: embedColor,
|
||||||
|
footer: {
|
||||||
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
|
const logChannel = interaction.guild.channels.cache.get(staffOtherChannel);
|
||||||
|
|
||||||
|
setTimeout(async () => {
|
||||||
|
await member.roles.remove(muted, "Mute duration has ended.");
|
||||||
|
await logChannel.send({
|
||||||
|
embeds: [{
|
||||||
|
description: userMention(member1.id) + " has been unmuted.",
|
||||||
|
color: embedColor,
|
||||||
|
footer: {
|
||||||
|
text: "ID: " + member1.id,
|
||||||
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}, time);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,203 +1,147 @@
|
|||||||
const {
|
const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||||
SlashCommandBuilder,
|
const { bwfdkr, bwstars, bwwins, duelswins, swstars } = require('../config/reqs.json')
|
||||||
EmbedBuilder,
|
const getuuid = require('../utils/functions');
|
||||||
PermissionFlagsBits
|
const env = require('dotenv').config();
|
||||||
} = require("discord.js");
|
|
||||||
const {
|
|
||||||
bwfdkr,
|
|
||||||
bwstars,
|
|
||||||
bwwins,
|
|
||||||
duelswins,
|
|
||||||
swstars
|
|
||||||
} = require("../config/reqs.json");
|
|
||||||
const getuuid = require("../utils/functions");
|
|
||||||
const env = require("dotenv").config();
|
|
||||||
const hypixelApiKey = process.env.HYPIXELAPI;
|
const hypixelApiKey = process.env.HYPIXELAPI;
|
||||||
const { color } = require("../config/options.json");
|
const { color } = require('../config/options.json');
|
||||||
const fetch = require("axios");
|
const fetch = require('axios');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "check",
|
name: 'check',
|
||||||
description: "Check a player's stats.",
|
description: 'Check a player\'s stats.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("check")
|
.setName('check')
|
||||||
.setDescription("Check a player's stats.")
|
.setDescription('Check a player\'s stats.')
|
||||||
.addStringOption((option) =>
|
.addStringOption(option =>
|
||||||
option
|
option
|
||||||
.setName("ign")
|
.setName('ign')
|
||||||
.setDescription("The player's IGN.")
|
.setDescription('The player\'s IGN.')
|
||||||
.setRequired(true)
|
.setRequired(true))
|
||||||
)
|
.setDMPermission(false),
|
||||||
.setDMPermission(false),
|
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply({});
|
|
||||||
|
|
||||||
const ign = interaction.options.getString("ign");
|
await interaction.deferReply({})
|
||||||
const mojang = "https://api.mojang.com/users/profiles/minecraft/";
|
|
||||||
const slothPixel = "https://api.slothpixel.me/api/players/";
|
|
||||||
const guildAPI = "https://api.slothpixel.me/api/guilds/";
|
|
||||||
const minotar = "https://minotar.net/helm/";
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
if (!ign) {
|
const ign = interaction.options.getString('ign');
|
||||||
await interaction.editReply("Please provide a player's IGN.");
|
const mojang = "https://api.mojang.com/users/profiles/minecraft/"
|
||||||
return;
|
const slothPixel = "https://api.slothpixel.me/api/players/";
|
||||||
}
|
const guildAPI = "https://api.slothpixel.me/api/guilds/"
|
||||||
|
const minotar = "https://minotar.net/helm/";
|
||||||
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
if ((await getuuid(ign)) === null) {
|
if (!ign) {
|
||||||
await interaction.editReply("That player doesn't exist. [Mojang]");
|
await interaction.editReply('Please provide a player\'s IGN.')
|
||||||
return;
|
return
|
||||||
}
|
|
||||||
|
|
||||||
const userUUID = await getuuid(ign);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await fetch(slothPixel + userUUID);
|
|
||||||
} catch (error) {
|
|
||||||
interaction.editReply("That player doesn't exist. [Hypixel]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const stats = await fetch(slothPixel + userUUID);
|
|
||||||
const head = minotar + ign;
|
|
||||||
|
|
||||||
if (!stats.data.uuid) {
|
|
||||||
interaction.editReply("That player doesn't exist. [Hypixel]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rank_formatted = stats.data.rank_formatted;
|
|
||||||
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "");
|
|
||||||
|
|
||||||
if (rank2 === "") {
|
|
||||||
var rank = "";
|
|
||||||
} else {
|
|
||||||
var rank = rank2 + " ";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const guildCheck = await fetch(guildAPI + userUUID);
|
|
||||||
var guildName = guildCheck.data.name;
|
|
||||||
} catch (error) {
|
|
||||||
var guildName = "None";
|
|
||||||
}
|
|
||||||
|
|
||||||
const hsbwstars = stats.data.stats.BedWars.level;
|
|
||||||
const hsbwfkdr = stats.data.stats.BedWars.final_k_d;
|
|
||||||
const hsbwwins = stats.data.stats.BedWars.wins;
|
|
||||||
const hsswstars = stats.data.stats.SkyWars.level;
|
|
||||||
const hsduelswins = stats.data.stats.Duels.general.wins;
|
|
||||||
|
|
||||||
if (hsbwstars < bwstars && hsbwfkdr < bwfdkr && 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) {
|
|
||||||
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.";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const guildCheck = await fetch(guildAPI + userUUID);
|
|
||||||
const tag_formatted = guildCheck.data.tag_formatted;
|
|
||||||
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "");
|
|
||||||
var guildTag = " " + guildTag2;
|
|
||||||
} catch (error) {
|
|
||||||
var guildTag = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: rank + stats.data.username + guildTag,
|
|
||||||
description:
|
|
||||||
"**Network Level:** `" +
|
|
||||||
stats.data.level.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:** `" +
|
|
||||||
stats.data.stats.BedWars.level.toString() +
|
|
||||||
" / " +
|
|
||||||
bwstars.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ FKDR:** `" +
|
|
||||||
stats.data.stats.BedWars.final_k_d.toString() +
|
|
||||||
" / " +
|
|
||||||
bwfdkr.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ Wins:** `" +
|
|
||||||
stats.data.stats.BedWars.wins.toString() +
|
|
||||||
" / " +
|
|
||||||
bwwins.toString() +
|
|
||||||
"`"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: swtitle,
|
|
||||||
value:
|
|
||||||
"**➺ Stars:** `" +
|
|
||||||
stats.data.stats.SkyWars.level.toFixed(2).toString() +
|
|
||||||
" / " +
|
|
||||||
swstars.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ KDR:** `" +
|
|
||||||
stats.data.stats.SkyWars.kill_death_ratio.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ Wins:** `" +
|
|
||||||
stats.data.stats.SkyWars.wins.toString() +
|
|
||||||
"`"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: duelstitle,
|
|
||||||
value:
|
|
||||||
"**➺ Wins:** `" +
|
|
||||||
stats.data.stats.Duels.general.wins.toString() +
|
|
||||||
" / " +
|
|
||||||
duelswins.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ KDR:** `" +
|
|
||||||
stats.data.stats.Duels.general.kd_ratio.toFixed(2).toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ WLR:** `" +
|
|
||||||
stats.data.stats.Duels.general.win_loss_ratio
|
|
||||||
.toFixed(2)
|
|
||||||
.toString() +
|
|
||||||
"`"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
if (await getuuid(ign) === null) {
|
||||||
}
|
await interaction.editReply('That player doesn\'t exist. [Mojang]')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const userUUID = await getuuid(ign);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fetch(slothPixel + userUUID);
|
||||||
|
} catch (error) {
|
||||||
|
interaction.editReply('That player doesn\'t exist. [Hypixel]')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const stats = await fetch(slothPixel + userUUID);
|
||||||
|
const head = minotar + ign;
|
||||||
|
|
||||||
|
if (!stats.data.uuid) {
|
||||||
|
interaction.editReply('That player doesn\'t exist. [Hypixel]')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const rank_formatted = stats.data.rank_formatted
|
||||||
|
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "")
|
||||||
|
|
||||||
|
if (rank2 === "") {
|
||||||
|
var rank = ""
|
||||||
|
} else {
|
||||||
|
var rank = rank2 + " "
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const guildCheck = await fetch(guildAPI + userUUID);
|
||||||
|
var guildName = guildCheck.data.name
|
||||||
|
} catch (error) {
|
||||||
|
var guildName = "None"
|
||||||
|
}
|
||||||
|
|
||||||
|
const hsbwstars = stats.data.stats.BedWars.level
|
||||||
|
const hsbwfkdr = stats.data.stats.BedWars.final_k_d
|
||||||
|
const hsbwwins = stats.data.stats.BedWars.wins
|
||||||
|
const hsswstars = stats.data.stats.SkyWars.level
|
||||||
|
const hsduelswins = stats.data.stats.Duels.general.wins
|
||||||
|
|
||||||
|
if (hsbwstars < bwstars && hsbwfkdr < bwfdkr && 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) {
|
||||||
|
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."
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const guildCheck = await fetch(guildAPI + userUUID);
|
||||||
|
const tag_formatted = guildCheck.data.tag_formatted
|
||||||
|
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "")
|
||||||
|
var guildTag = " " + guildTag2
|
||||||
|
} catch (error) {
|
||||||
|
var guildTag = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
title: rank + stats.data.username + guildTag,
|
||||||
|
description: "**Network Level:** `" + stats.data.level.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:** `" + stats.data.stats.BedWars.level.toString() + " / " + bwstars.toString() + "`\n" +
|
||||||
|
"**➺ FKDR:** `" + stats.data.stats.BedWars.final_k_d.toString() + " / " + bwfdkr.toString() + "`\n" +
|
||||||
|
"**➺ Wins:** `" + stats.data.stats.BedWars.wins.toString() + " / " + bwwins.toString() + "`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: swtitle,
|
||||||
|
value: "**➺ Stars:** `" + stats.data.stats.SkyWars.level.toFixed(2).toString() + " / " + swstars.toString() + "`\n" +
|
||||||
|
"**➺ KDR:** `" + stats.data.stats.SkyWars.kill_death_ratio.toString() + "`\n" +
|
||||||
|
"**➺ Wins:** `" + stats.data.stats.SkyWars.wins.toString() + "`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: duelstitle,
|
||||||
|
value: "**➺ Wins:** `" + stats.data.stats.Duels.general.wins.toString() + " / " + duelswins.toString() + "`\n" +
|
||||||
|
"**➺ KDR:** `" + stats.data.stats.Duels.general.kd_ratio.toFixed(2).toString() + "`\n" +
|
||||||
|
"**➺ WLR:** `" + stats.data.stats.Duels.general.win_loss_ratio.toFixed(2).toString() + "`"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,145 +1,125 @@
|
|||||||
const {
|
const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder, WebhookClient } = require('discord.js');
|
||||||
SlashCommandBuilder,
|
const { title } = require('process');
|
||||||
PermissionFlagsBits,
|
const { color } = require('../config/options.json');
|
||||||
ButtonBuilder,
|
|
||||||
ActionRowBuilder,
|
|
||||||
ButtonStyle,
|
|
||||||
EmbedBuilder,
|
|
||||||
WebhookClient
|
|
||||||
} = require("discord.js");
|
|
||||||
const { title } = require("process");
|
|
||||||
const { color } = require("../config/options.json");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "config",
|
name: 'config',
|
||||||
description: "Configure the bot.",
|
description: 'Configure the bot.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("config")
|
.setName('config')
|
||||||
.setDescription("Configure the bot.")
|
.setDescription('Configure the bot.')
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand(subcommand =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("sendguildapplication")
|
.setName('sendguildapplication')
|
||||||
.setDescription("Send the application message to a channel.")
|
.setDescription('Send the application message to a channel.')
|
||||||
.addChannelOption((option) =>
|
.addChannelOption(option =>
|
||||||
option
|
option
|
||||||
.setName("channel")
|
.setName('channel')
|
||||||
.setDescription("The channel to send the application to.")
|
.setDescription('The channel to send the application to.')
|
||||||
.setRequired(true)
|
.setRequired(true)))
|
||||||
)
|
.addSubcommand(subcommand =>
|
||||||
)
|
subcommand
|
||||||
.addSubcommand((subcommand) =>
|
.setName('sendstaffapplication')
|
||||||
subcommand
|
.setDescription('Send the application message to a channel.')
|
||||||
.setName("sendstaffapplication")
|
.addChannelOption(option =>
|
||||||
.setDescription("Send the application message to a channel.")
|
option
|
||||||
.addChannelOption((option) =>
|
.setName('channel')
|
||||||
option
|
.setDescription('The channel to send the application to.')
|
||||||
.setName("channel")
|
.setRequired(true)))
|
||||||
.setDescription("The channel to send the application to.")
|
.addSubcommand(subcommand =>
|
||||||
.setRequired(true)
|
subcommand
|
||||||
)
|
.setName('sendguildinfo')
|
||||||
)
|
.setDescription('Send the guild info message to a channel.'))
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand(subcommand =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("sendguildinfo")
|
.setName('sendrequirements')
|
||||||
.setDescription("Send the guild info message to a channel.")
|
.setDescription('Send the guild requirements message to a channel.'))
|
||||||
)
|
.addSubcommand(subcommand =>
|
||||||
.addSubcommand((subcommand) =>
|
subcommand
|
||||||
subcommand
|
.setName('sendrules-info')
|
||||||
.setName("sendrequirements")
|
.setDescription('Send the rules and info message to a channel.'))
|
||||||
.setDescription("Send the guild requirements message to a channel.")
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
)
|
.setDMPermission(false),
|
||||||
.addSubcommand((subcommand) =>
|
|
||||||
subcommand
|
|
||||||
.setName("sendrules-info")
|
|
||||||
.setDescription("Send the rules and info message to a channel.")
|
|
||||||
)
|
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
|
||||||
.setDMPermission(false),
|
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const user = interaction.user;
|
|
||||||
const guild = interaction.guild;
|
|
||||||
const subcommand = interaction.options.getSubcommand();
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
if (subcommand === "reload") {
|
const user = interaction.user;
|
||||||
await interaction.reply({ content: "In development", ephemeral: true });
|
const guild = interaction.guild;
|
||||||
return;
|
const subcommand = interaction.options.getSubcommand();
|
||||||
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
|
if (subcommand === 'reload') {
|
||||||
|
|
||||||
|
await interaction.reply({ content: 'In development', ephemeral: true })
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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 === 'sendstaffapplication') {
|
||||||
|
|
||||||
|
const channel = interaction.options.getChannel('channel');
|
||||||
|
|
||||||
|
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: '✅' })
|
||||||
|
)
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
await interaction.reply({ content: 'Message sent', ephemeral: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subcommand !== "sendguildinfo" || "sendrequirements" || "sendrules-info") {
|
||||||
|
await interaction.reply({ content: 'In development.', ephemeral: true });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 === "sendstaffapplication") {
|
|
||||||
const channel = interaction.options.getChannel("channel");
|
|
||||||
|
|
||||||
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: "✅" })
|
|
||||||
)
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
await interaction.reply({ content: "Message sent", ephemeral: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
subcommand !== "sendguildinfo" ||
|
|
||||||
"sendrequirements" ||
|
|
||||||
"sendrules-info"
|
|
||||||
) {
|
|
||||||
await interaction.reply({ content: "In development.", ephemeral: true });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
@@ -1,104 +1,105 @@
|
|||||||
const {
|
const { SlashCommandBuilder, PermissionFlagsBits, userMention, EmbedBuilder } = require('discord.js');
|
||||||
SlashCommandBuilder,
|
const { hypixelGuildID, color } = require('../config/options.json');
|
||||||
PermissionFlagsBits,
|
const verify = require('../schemas/verifySchema.js');
|
||||||
userMention,
|
const env = require('dotenv').config();
|
||||||
EmbedBuilder
|
|
||||||
} = require("discord.js");
|
|
||||||
const { hypixelGuildID, color } = require("../config/options.json");
|
|
||||||
const verify = require("../schemas/verifySchema.js");
|
|
||||||
const env = require("dotenv").config();
|
|
||||||
const dev = process.env.DEV;
|
const dev = process.env.DEV;
|
||||||
const fetch = require("axios");
|
const fetch = require('axios');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "admin",
|
name: 'admin',
|
||||||
description: "Admin command.",
|
description: 'Admin command.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("devel")
|
.setName('devel')
|
||||||
.setDescription("Admin command.")
|
.setDescription('Admin command.')
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand(subcommand =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("dbclearnonguildmembers")
|
.setName('dbclearnonguildmembers')
|
||||||
.setDescription("Clears the database of non-guild members.")
|
.setDescription('Clears the database of non-guild members.'))
|
||||||
)
|
.addSubcommand(subcommand =>
|
||||||
.addSubcommand((subcommand) =>
|
subcommand
|
||||||
subcommand.setName("reload").setDescription("Reload the bot.")
|
.setName('reload')
|
||||||
)
|
.setDescription('Reload the bot.'))
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand(subcommand =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("listallverified")
|
.setName('listallverified')
|
||||||
.setDescription("List all verified users.")
|
.setDescription('List all verified users.'))
|
||||||
)
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
.setDMPermission(false),
|
||||||
.setDMPermission(false),
|
|
||||||
|
|
||||||
async execute(interaction) {
|
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 === "dbclearnonguildmembers") {
|
const subcommand = interaction.options.getSubcommand();
|
||||||
await interaction.deferReply({ ephemeral: true });
|
const user = interaction.user;
|
||||||
|
const userMentioned = userMention(user.id);
|
||||||
|
const guild = interaction.guild;
|
||||||
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
if (user.id !== dev) {
|
if (subcommand === 'dbclearnonguildmembers') {
|
||||||
interaction.editReply({
|
|
||||||
content:
|
|
||||||
"Due to you not screwing something up this command is restricted to only " +
|
|
||||||
userMentioned,
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const slothPixel = "https://api.slothpixel.me/api/guilds/";
|
await interaction.deferReply({ ephemeral: true })
|
||||||
const verifiedUsers = await verify.find();
|
|
||||||
|
|
||||||
verifiedUsers.forEach(async (user) => {
|
if (user.id !== dev) {
|
||||||
const userGuild = await fetch(slothPixel + user.uuid);
|
interaction.editReply({ content: 'Due to you not screwing something up this command is restricted to only ' + userMentioned, ephemeral: true })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const slothPixel = "https://api.slothpixel.me/api/guilds/"
|
||||||
|
const verifiedUsers = await verify.find()
|
||||||
|
|
||||||
|
verifiedUsers.forEach(async (user) => {
|
||||||
|
|
||||||
|
const userGuild = await fetch(slothPixel + user.uuid);
|
||||||
|
|
||||||
|
if (userGuild.data.id !== hypixelGuildID) {
|
||||||
|
await verify.deleteOne({ uuid: user.uuid })
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
interaction.editReply({ content: 'Done!', ephemeral: true })
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subcommand === 'reload') {
|
||||||
|
|
||||||
|
await interaction.reply({ content: 'In development', ephemeral: true })
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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')
|
||||||
|
|
||||||
|
for (let i = 0; i < verifiedUsers.length; i++) {
|
||||||
|
|
||||||
|
const user = verifiedUsers[i];
|
||||||
|
|
||||||
|
const userCheck = await fetch(mojang + user.uuid);
|
||||||
|
const ign = userCheck.data.name;
|
||||||
|
|
||||||
|
const mentionedUser = userMention(user.userID);
|
||||||
|
|
||||||
|
embed.addFields({
|
||||||
|
name: "**IGN:** " + ign,
|
||||||
|
value: "**Discord:** " + mentionedUser
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [embed]
|
||||||
|
})
|
||||||
|
|
||||||
if (userGuild.data.id !== hypixelGuildID) {
|
|
||||||
await verify.deleteOne({ uuid: user.uuid });
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
interaction.editReply({ content: "Done!", ephemeral: true });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subcommand === "reload") {
|
|
||||||
await interaction.reply({ content: "In development", ephemeral: true });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
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");
|
|
||||||
|
|
||||||
for (let i = 0; i < verifiedUsers.length; i++) {
|
|
||||||
const user = verifiedUsers[i];
|
|
||||||
|
|
||||||
const userCheck = await fetch(mojang + user.uuid);
|
|
||||||
const ign = userCheck.data.name;
|
|
||||||
|
|
||||||
const mentionedUser = userMention(user.userID);
|
|
||||||
|
|
||||||
embed.addFields({
|
|
||||||
name: "**IGN:** " + ign,
|
|
||||||
value: "**Discord:** " + mentionedUser
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
await interaction.reply({
|
|
||||||
embeds: [embed]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
@@ -1,323 +1,266 @@
|
|||||||
const {
|
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js');
|
||||||
SlashCommandBuilder,
|
const { hypixelGuildID, color } = require('../config/options.json');
|
||||||
PermissionFlagsBits,
|
const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json');
|
||||||
userMention
|
const verify = require('../schemas/verifySchema.js')
|
||||||
} = require("discord.js");
|
const fetch = require('axios');
|
||||||
const { hypixelGuildID, color } = require("../config/options.json");
|
const removeThese = [gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff]
|
||||||
const {
|
|
||||||
gm,
|
|
||||||
manager,
|
|
||||||
moderator,
|
|
||||||
beast,
|
|
||||||
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,
|
|
||||||
member,
|
|
||||||
trialmember,
|
|
||||||
guildRole,
|
|
||||||
guildStaff
|
|
||||||
];
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "forceupdate",
|
name: 'forceupdate',
|
||||||
description: "Force update the user",
|
description: 'Force update the user',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("forceupdate")
|
.setName('forceupdate')
|
||||||
.setDescription("Force update the user")
|
.setDescription('Force update the user')
|
||||||
.addUserOption((option) =>
|
.addUserOption(option =>
|
||||||
option
|
option
|
||||||
.setName("user")
|
.setName('user')
|
||||||
.setDescription("The user to force update")
|
.setDescription('The user to force update')
|
||||||
.setRequired(true)
|
.setRequired(true))
|
||||||
)
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
.setDMPermission(false),
|
||||||
.setDMPermission(false),
|
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply();
|
|
||||||
|
|
||||||
const user = interaction.options.getUser("user");
|
await interaction.deferReply();
|
||||||
const usermentioned = userMention(user.id);
|
|
||||||
const guild = interaction.guild;
|
|
||||||
const verifyData = await verify.findOne({ userID: user.id });
|
|
||||||
|
|
||||||
const user1 = guild.members.cache.get(user.id);
|
const user = interaction.options.getUser('user');
|
||||||
const roleManage = user1.roles;
|
const usermentioned = userMention(user.id);
|
||||||
|
const guild = interaction.guild;
|
||||||
|
const verifyData = await verify.findOne({ userID: user.id })
|
||||||
|
|
||||||
if (!verifyData) {
|
const user1 = guild.members.cache.get(user.id);
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
const roleManage = user1.roles;
|
||||||
await roleManage.remove(
|
|
||||||
removeThese[i],
|
|
||||||
"Auto role removal. (Force Update)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
await interaction.editReply({
|
if (!verifyData) {
|
||||||
embeds: [
|
|
||||||
{
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
description:
|
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
|
||||||
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, "User was force updated.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const slothPixel = "https://api.slothpixel.me/api/players/";
|
await interaction.editReply({
|
||||||
const guildAPI = "https://api.slothpixel.me/api/guilds/";
|
embeds: [{
|
||||||
const mojangAPI = "https://api.mojang.com/user/profile/";
|
description: usermentioned + " was given the the Default Member role.",
|
||||||
const minotar = "https://minotar.net/helm/";
|
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, "User was force updated.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const userCheck = await fetch(mojangAPI + verifyData.uuid);
|
const slothPixel = "https://api.slothpixel.me/api/players/";
|
||||||
const hypixelCheck = await fetch(slothPixel + verifyData.uuid);
|
const guildAPI = "https://api.slothpixel.me/api/guilds/"
|
||||||
const head = minotar + userCheck.data.name;
|
const mojangAPI = "https://api.mojang.com/user/profile/"
|
||||||
|
const minotar = "https://minotar.net/helm/";
|
||||||
|
|
||||||
try {
|
const userCheck = await fetch(mojangAPI + verifyData.uuid);
|
||||||
const guildCheck = await fetch(guildAPI + verifyData.uuid);
|
const hypixelCheck = await fetch(slothPixel + verifyData.uuid);
|
||||||
var responseGuildID = guildCheck.data.id;
|
const head = minotar + userCheck.data.name;
|
||||||
} catch (err) {
|
|
||||||
var responseGuildID = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (responseGuildID !== hypixelGuildID) {
|
try {
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
const guildCheck = await fetch(guildAPI + verifyData.uuid);
|
||||||
await roleManage.remove(
|
var responseGuildID = guildCheck.data.id;
|
||||||
removeThese[i],
|
} catch (err) {
|
||||||
"Auto role removal. (Force Update)"
|
var responseGuildID = null;
|
||||||
);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
await interaction.editReply({
|
if (responseGuildID !== hypixelGuildID) {
|
||||||
embeds: [
|
|
||||||
{
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
description:
|
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
const guildCheck = await fetch(guildAPI + verifyData.uuid);
|
await interaction.editReply({
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
embeds: [{
|
||||||
const GuildMembers = await guildCheck.data.members;
|
description: usermentioned + " was given the the Default Member role.",
|
||||||
const guildRank = GuildMembers.find(
|
color: embedColor,
|
||||||
(member) => member.uuid === verifyData.uuid
|
thumbnail: {
|
||||||
).rank;
|
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" && responseGuildID === hypixelGuildID) {
|
const guildCheck = await fetch(guildAPI + verifyData.uuid);
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
await roleManage.remove(
|
const GuildMembers = await guildCheck.data.members;
|
||||||
removeThese[i],
|
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank;
|
||||||
"Auto role removal. (Force Update)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
await roleManage.add(guildRole, "User was force updated.");
|
if (guildRank === 'Guild Master' && responseGuildID === hypixelGuildID) {
|
||||||
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({
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
embeds: [
|
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
|
||||||
{
|
|
||||||
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 === "Manager" && responseGuildID === hypixelGuildID) {
|
await roleManage.add(guildRole, "User was force updated.")
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
await roleManage.add(guildStaff, "User was force updated.")
|
||||||
await roleManage.remove(
|
await roleManage.add(gm, "User was force updated.")
|
||||||
removeThese[i],
|
await roleManage.add(defaultMember, "User was force updated.")
|
||||||
"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 interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: usermentioned + "'s rank has been updated to `Guild Master`",
|
||||||
description:
|
color: embedColor,
|
||||||
usermentioned + "'s rank has been updated to `Manager`",
|
thumbnail: {
|
||||||
color: embedColor,
|
url: head
|
||||||
thumbnail: {
|
},
|
||||||
url: head
|
footer: {
|
||||||
},
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
footer: {
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
}
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === 'Manager' && responseGuildID === hypixelGuildID) {
|
||||||
|
|
||||||
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
|
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Moderator" && responseGuildID === hypixelGuildID) {
|
await roleManage.add(guildRole, "User was force updated.")
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
await roleManage.add(guildStaff, "User was force updated.")
|
||||||
await roleManage.remove(
|
await roleManage.add(manager, "User was force updated.")
|
||||||
removeThese[i],
|
await roleManage.add(defaultMember, "User was force updated.")
|
||||||
"Auto role removal. (Force Update)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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.");
|
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: usermentioned + "'s rank has been updated to `Manager`",
|
||||||
description:
|
color: embedColor,
|
||||||
usermentioned + "'s rank has been updated to `Moderator`",
|
thumbnail: {
|
||||||
color: embedColor,
|
url: head
|
||||||
thumbnail: {
|
},
|
||||||
url: head
|
footer: {
|
||||||
},
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
footer: {
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
}
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === 'Moderator' && responseGuildID === hypixelGuildID) {
|
||||||
|
|
||||||
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
|
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Beast" && responseGuildID === hypixelGuildID) {
|
await roleManage.add(guildRole, "User was force updated.")
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
await roleManage.add(guildStaff, "User was force updated.")
|
||||||
await roleManage.remove(
|
await roleManage.add(moderator, "User was force updated.")
|
||||||
removeThese[i],
|
await roleManage.add(defaultMember, "User was force updated.")
|
||||||
"Auto role removal. (Force Update)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: usermentioned + "'s rank has been updated to `Moderator`",
|
||||||
description: usermentioned + "'s rank has been updated to `Beast`.",
|
color: embedColor,
|
||||||
color: embedColor,
|
thumbnail: {
|
||||||
thumbnail: {
|
url: head
|
||||||
url: head
|
},
|
||||||
},
|
footer: {
|
||||||
footer: {
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
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. (Force Update)")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Member" && responseGuildID === hypixelGuildID) {
|
await roleManage.add(guildRole, "User was force updated.")
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
await roleManage.add(beast, "User was force updated.")
|
||||||
await roleManage.remove(
|
await roleManage.add(defaultMember, "User was force updated.")
|
||||||
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({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: usermentioned + "'s rank has been updated to `Beast`.",
|
||||||
description:
|
color: embedColor,
|
||||||
usermentioned + "'s rank has been updated to `Member`.",
|
thumbnail: {
|
||||||
color: embedColor,
|
url: head
|
||||||
thumbnail: {
|
},
|
||||||
url: head
|
footer: {
|
||||||
},
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
footer: {
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
}
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === 'Member' && responseGuildID === hypixelGuildID) {
|
||||||
|
|
||||||
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
|
await roleManage.remove(removeThese[i], "Auto role removal. (Force Update)")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Trial Member" && responseGuildID === hypixelGuildID) {
|
await roleManage.add(guildRole, "User was force updated.")
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
await roleManage.add(member, "User was force updated.")
|
||||||
await roleManage.remove(
|
await roleManage.add(defaultMember, "User was force updated.")
|
||||||
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({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: usermentioned + "'s rank has been updated to `Member`.",
|
||||||
description:
|
color: embedColor,
|
||||||
usermentioned + "'s rank has been updated to `Trial Member`.",
|
thumbnail: {
|
||||||
color: embedColor,
|
url: head
|
||||||
thumbnail: {
|
},
|
||||||
url: head
|
footer: {
|
||||||
},
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
footer: {
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
}
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === 'Trial Member' && responseGuildID === hypixelGuildID) {
|
||||||
|
|
||||||
|
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.")
|
||||||
return;
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
@@ -1,195 +1,174 @@
|
|||||||
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
|
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
|
||||||
const env = require("dotenv").config();
|
const env = require('dotenv').config();
|
||||||
const hypixelApiKey = process.env.HYPIXELAPIKEY;
|
const hypixelApiKey = process.env.HYPIXELAPIKEY;
|
||||||
const fetch = require("axios");
|
const fetch = require('axios');
|
||||||
const { color, hypixelGuildID } = require("../config/options.json");
|
const { color, hypixelGuildID } = require('../config/options.json');
|
||||||
const verify = require("../schemas/verifySchema.js");
|
const verify = require('../schemas/verifySchema.js')
|
||||||
const { mongoose } = require("mongoose");
|
const {mongoose} = require('mongoose');
|
||||||
const {
|
const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json');
|
||||||
gm,
|
|
||||||
manager,
|
|
||||||
moderator,
|
|
||||||
beast,
|
|
||||||
member,
|
|
||||||
trialmember,
|
|
||||||
guildRole,
|
|
||||||
guildStaff,
|
|
||||||
defaultMember
|
|
||||||
} = require("../config/roles.json");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "forceverify",
|
name: 'forceverify',
|
||||||
description: "Force verify a user.",
|
description: 'Force verify a user.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("forceverify")
|
.setName('forceverify')
|
||||||
.setDescription("Force verify a user.")
|
.setDescription('Force verify a user.')
|
||||||
.addUserOption((option) =>
|
.addUserOption(option =>
|
||||||
option.setName("user").setDescription("The user to force verify.")
|
option
|
||||||
)
|
.setName('user')
|
||||||
.addStringOption((option) =>
|
.setDescription('The user to force verify.'))
|
||||||
option.setName("ign").setDescription("The user's in-game name.")
|
.addStringOption(option =>
|
||||||
)
|
option
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
.setName('ign')
|
||||||
.setDMPermission(false),
|
.setDescription('The user\'s in-game name.'))
|
||||||
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
|
.setDMPermission(false),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply();
|
|
||||||
|
|
||||||
const user1 = interaction.options.getUser("user");
|
await interaction.deferReply();
|
||||||
const user = interaction.guild.members.cache.get(user1.id);
|
|
||||||
const fullUsername = user1.username + "#" + user1.discriminator;
|
|
||||||
const ign = interaction.options.getString("ign");
|
|
||||||
const mod =
|
|
||||||
interaction.user.username + "#" + interaction.user.discriminator;
|
|
||||||
|
|
||||||
const mojang = "https://api.mojang.com/users/profiles/minecraft/";
|
const user1 = interaction.options.getUser('user');
|
||||||
const slothPixel = "https://api.slothpixel.me/api/players/";
|
const user = interaction.guild.members.cache.get(user1.id);
|
||||||
const guildAPI = "https://api.slothpixel.me/api/guilds/";
|
const fullUsername = user1.username + "#" + user1.discriminator
|
||||||
const minotar = "https://minotar.net/helm/";
|
const ign = interaction.options.getString('ign');
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
const mod = interaction.user.username + "#" + interaction.user.discriminator
|
||||||
|
|
||||||
if (!user) {
|
const mojang = "https://api.mojang.com/users/profiles/minecraft/"
|
||||||
interaction.editReply("Please provide a user to force verify.");
|
const slothPixel = "https://api.slothpixel.me/api/players/";
|
||||||
return;
|
const guildAPI = "https://api.slothpixel.me/api/guilds/"
|
||||||
}
|
const minotar = "https://minotar.net/helm/";
|
||||||
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
if (!ign) {
|
if (!user) {
|
||||||
interaction.editReply("Please provide a player's IGN.");
|
interaction.editReply('Please provide a user to force verify.')
|
||||||
return;
|
return
|
||||||
}
|
|
||||||
|
|
||||||
const verifyData = await verify.findOne({ userID: user.id });
|
|
||||||
|
|
||||||
if (verifyData) {
|
|
||||||
interaction.editReply("That user is already verified.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await fetch(mojang + ign);
|
|
||||||
} catch (err) {
|
|
||||||
interaction.editReply("That player doesn't exist. [Mojang]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await fetch(slothPixel + ign);
|
|
||||||
} catch (err) {
|
|
||||||
interaction.editReply("That player doesn't exist. [Hypixel]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const userCheck = await fetch(mojang + ign);
|
|
||||||
const userUUID = userCheck.data.id;
|
|
||||||
|
|
||||||
const hypixelCheck = await fetch(slothPixel + userUUID);
|
|
||||||
const head = minotar + ign;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const guildCheck = await fetch(guildAPI + userUUID);
|
|
||||||
var responseGuildID = guildCheck.data.id;
|
|
||||||
} catch (err) {
|
|
||||||
var responseGuildID = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (responseGuildID !== hypixelGuildID) {
|
|
||||||
await user.roles.add(defaultMember, "User was force verified by " + mod);
|
|
||||||
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: interaction.guild.name,
|
|
||||||
description:
|
|
||||||
"You have successfully force verified `" +
|
|
||||||
fullUsername +
|
|
||||||
"` with the account `" +
|
|
||||||
hypixelCheck.data.username +
|
|
||||||
"`.",
|
|
||||||
color: embedColor,
|
|
||||||
thumbnail: {
|
|
||||||
url: head
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
icon_url: interaction.guild.iconURL(),
|
|
||||||
text: interaction.guild.name + " | Developed by Taken#0002"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const guildCheck = await fetch(guildAPI + userUUID);
|
|
||||||
const GuildMembers = await guildCheck.data.members;
|
|
||||||
const guildRank = GuildMembers.find(
|
|
||||||
(member) => member.uuid === hypixelCheck.data.uuid
|
|
||||||
).rank;
|
|
||||||
|
|
||||||
if (guildRank === "Guild Master" && guildCheck.data.id === hypixelGuildID) {
|
|
||||||
await user.roles.add(gm, "User was force verified by " + mod);
|
|
||||||
await user.roles.add(guildRole, "User was force verified by " + mod);
|
|
||||||
await user.roles.add(guildStaff, "User was force verified by " + mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Manager" && guildCheck.data.id === hypixelGuildID) {
|
|
||||||
await user.roles.add(manager, "User was force verified by " + mod);
|
|
||||||
await user.roles.add(guildRole, "User was force verified by " + mod);
|
|
||||||
await user.roles.add(guildStaff, "User was force verified by " + mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Moderator" && guildCheck.data.id === hypixelGuildID) {
|
|
||||||
await user.roles.add(moderator, "User was force verified by " + mod);
|
|
||||||
await user.roles.add(guildRole, "User was force verified by " + mod);
|
|
||||||
await user.roles.add(guildStaff, "User was force verified by " + mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Beast" && guildCheck.data.id === hypixelGuildID) {
|
|
||||||
await user.roles.add(beast, "User was force verified by " + mod);
|
|
||||||
await user.roles.add(guildRole, "User was force verified by " + mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Member" && guildCheck.data.id === hypixelGuildID) {
|
|
||||||
await user.roles.add(member, "User was force verified by " + mod);
|
|
||||||
await user.roles.add(guildRole, "User was force verified by " + mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Trial Member" && guildCheck.data.id === hypixelGuildID) {
|
|
||||||
await user.roles.add(trialmember, "User was force verified by " + mod);
|
|
||||||
await user.roles.add(guildRole, "User was force verified by " + mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
await user.roles.add(defaultMember, "User was force verified by " + mod);
|
|
||||||
|
|
||||||
const newVerify = new verify({
|
|
||||||
_id: new mongoose.Types.ObjectId(),
|
|
||||||
userID: user.id,
|
|
||||||
uuid: userUUID
|
|
||||||
});
|
|
||||||
|
|
||||||
await newVerify.save();
|
|
||||||
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: interaction.guild.name,
|
|
||||||
description:
|
|
||||||
"You have successfully force verified `" +
|
|
||||||
fullUsername +
|
|
||||||
"` with the account `" +
|
|
||||||
hypixelCheck.data.username +
|
|
||||||
"`.",
|
|
||||||
color: embedColor,
|
|
||||||
thumbnail: {
|
|
||||||
url: head
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
icon_url: interaction.guild.iconURL(),
|
|
||||||
text: interaction.guild.name + " | Developed by Taken#0002"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
if (!ign) {
|
||||||
}
|
interaction.editReply('Please provide a player\'s IGN.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const verifyData = await verify.findOne({ userID: user.id })
|
||||||
|
|
||||||
|
if (verifyData) {
|
||||||
|
interaction.editReply('That user is already verified.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fetch(mojang + ign);
|
||||||
|
} catch (err) {
|
||||||
|
interaction.editReply('That player doesn\'t exist. [Mojang]')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fetch(slothPixel + ign);
|
||||||
|
} catch (err) {
|
||||||
|
interaction.editReply('That player doesn\'t exist. [Hypixel]')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const userCheck = await fetch(mojang + ign);
|
||||||
|
const userUUID = userCheck.data.id;
|
||||||
|
|
||||||
|
const hypixelCheck = await fetch(slothPixel + userUUID);
|
||||||
|
const head = minotar + ign;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const guildCheck = await fetch(guildAPI + userUUID);
|
||||||
|
var responseGuildID = guildCheck.data.id;
|
||||||
|
} catch (err) {
|
||||||
|
var responseGuildID = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseGuildID !== hypixelGuildID) {
|
||||||
|
|
||||||
|
await user.roles.add(defaultMember, "User was force verified by " + mod);
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
title: interaction.guild.name,
|
||||||
|
description: "You have successfully force verified `" + fullUsername + "` with the account `" + hypixelCheck.data.username + "`.",
|
||||||
|
color: embedColor,
|
||||||
|
thumbnail: {
|
||||||
|
url: head
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
icon_url: interaction.guild.iconURL(),
|
||||||
|
text: interaction.guild.name + " | Developed by Taken#0002"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const guildCheck = await fetch(guildAPI + userUUID);
|
||||||
|
const GuildMembers = await guildCheck.data.members;
|
||||||
|
const guildRank = GuildMembers.find(member => member.uuid === hypixelCheck.data.uuid).rank;
|
||||||
|
|
||||||
|
if (guildRank === "Guild Master" && guildCheck.data.id === hypixelGuildID) {
|
||||||
|
await user.roles.add(gm, "User was force verified by " + mod);
|
||||||
|
await user.roles.add(guildRole, "User was force verified by " + mod)
|
||||||
|
await user.roles.add(guildStaff, "User was force verified by " + mod)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === "Manager" && guildCheck.data.id === hypixelGuildID) {
|
||||||
|
await user.roles.add(manager, "User was force verified by " + mod);
|
||||||
|
await user.roles.add(guildRole, "User was force verified by " + mod)
|
||||||
|
await user.roles.add(guildStaff, "User was force verified by " + mod)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === "Moderator" && guildCheck.data.id === hypixelGuildID) {
|
||||||
|
await user.roles.add(moderator, "User was force verified by " + mod);
|
||||||
|
await user.roles.add(guildRole, "User was force verified by " + mod)
|
||||||
|
await user.roles.add(guildStaff, "User was force verified by " + mod)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === "Beast" && guildCheck.data.id === hypixelGuildID) {
|
||||||
|
await user.roles.add(beast, "User was force verified by " + mod);
|
||||||
|
await user.roles.add(guildRole, "User was force verified by " + mod)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === "Member" && guildCheck.data.id === hypixelGuildID) {
|
||||||
|
await user.roles.add(member, "User was force verified by " + mod);
|
||||||
|
await user.roles.add(guildRole, "User was force verified by " + mod)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === "Trial Member" && guildCheck.data.id === hypixelGuildID) {
|
||||||
|
await user.roles.add(trialmember, "User was force verified by " + mod);
|
||||||
|
await user.roles.add(guildRole, "User was force verified by " + mod)
|
||||||
|
}
|
||||||
|
|
||||||
|
await user.roles.add(defaultMember, "User was force verified by " + mod);
|
||||||
|
|
||||||
|
const newVerify = new verify({
|
||||||
|
_id: new mongoose.Types.ObjectId(),
|
||||||
|
userID: user.id,
|
||||||
|
uuid: userUUID
|
||||||
|
})
|
||||||
|
|
||||||
|
await newVerify.save();
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
title: interaction.guild.name,
|
||||||
|
description: "You have successfully force verified `" + fullUsername + "` with the account `" + hypixelCheck.data.username + "`.",
|
||||||
|
color: embedColor,
|
||||||
|
thumbnail: {
|
||||||
|
url: head
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
icon_url: interaction.guild.iconURL(),
|
||||||
|
text: interaction.guild.name + " | Developed by Taken#0002"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,54 +1,54 @@
|
|||||||
const { SlashCommandBuilder, ChannelType } = require("discord.js");
|
const { SlashCommandBuilder, ChannelType } = require('discord.js');
|
||||||
const { color } = require("../config/options.json");
|
const { color } = require('../config/options.json');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "help",
|
name: 'help',
|
||||||
description: "Help command",
|
description: 'Help command',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("help")
|
.setName('help')
|
||||||
.setDescription("Help command")
|
.setDescription('Help command')
|
||||||
.setDMPermission(true),
|
.setDMPermission(true),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
|
||||||
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
await interaction.editReply({
|
const embedColor = Number(color.replace('#', '0x'));
|
||||||
embeds: [
|
|
||||||
{
|
await interaction.editReply({
|
||||||
title: "Commands",
|
embeds: [{
|
||||||
description: "List of commands",
|
title: 'Commands',
|
||||||
fields: [
|
description: "List of commands",
|
||||||
{
|
fields: [
|
||||||
name: "/check",
|
{
|
||||||
value: "Check the stats of a player"
|
name: '/check',
|
||||||
},
|
value: 'Check the stats of a player'
|
||||||
{
|
},
|
||||||
name: "/reqs",
|
{
|
||||||
value: "Check the requirements of the guild"
|
name: '/reqs',
|
||||||
},
|
value: 'Check the requirements of the guild'
|
||||||
{
|
},
|
||||||
name: "/update",
|
{
|
||||||
value: "Update's your roles"
|
name: '/update',
|
||||||
},
|
value: 'Update\'s your roles'
|
||||||
{
|
},
|
||||||
name: "/help",
|
{
|
||||||
value: "Shows this message"
|
name: '/help',
|
||||||
}
|
value: 'Shows this message'
|
||||||
],
|
}
|
||||||
color: embedColor,
|
],
|
||||||
thumbnail: {
|
color: embedColor,
|
||||||
url: interaction.guild.iconURL({ dynamic: true })
|
thumbnail: {
|
||||||
},
|
url: interaction.guild.iconURL({ dynamic: true })
|
||||||
footer: {
|
},
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true }),
|
footer: {
|
||||||
text: interaction.guild.name + " | Developed by: @Taken#0001"
|
icon_url: interaction.guild.iconURL({ dynamic: true }),
|
||||||
}
|
text: interaction.guild.name + ' | Developed by: @Taken#0001'
|
||||||
}
|
}
|
||||||
]
|
}]
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
103
commands/reqs.js
103
commands/reqs.js
@@ -1,63 +1,50 @@
|
|||||||
const { SlashCommandBuilder } = require("discord.js");
|
const { SlashCommandBuilder } = require('discord.js');
|
||||||
const { color } = require("../config/options.json");
|
const { color } = require('../config/options.json');
|
||||||
const {
|
const { bwfdkr, bwstars, bwwins, duelswins, swstars } = require('../config/reqs.json');
|
||||||
bwfdkr,
|
|
||||||
bwstars,
|
|
||||||
bwwins,
|
|
||||||
duelswins,
|
|
||||||
swstars
|
|
||||||
} = require("../config/reqs.json");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "reqs",
|
name: 'reqs',
|
||||||
description: "Displays the requirements for the guild.",
|
description: 'Displays the requirements for the guild.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("reqs")
|
.setName('reqs')
|
||||||
.setDescription("Displays the requirements for the guild."),
|
.setDescription('Displays the requirements for the guild.'),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
|
||||||
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
await interaction.editReply({
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
embeds: [
|
|
||||||
{
|
await interaction.editReply({
|
||||||
title: "Requirements",
|
embeds: [{
|
||||||
description:
|
title: 'Requirements',
|
||||||
"**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**",
|
description: '**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**',
|
||||||
color: embedColor,
|
color: embedColor,
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url: interaction.guild.iconURL()
|
url: interaction.guild.iconURL()
|
||||||
},
|
},
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "**Bedwars**",
|
name: '**Bedwars**',
|
||||||
value:
|
value: '**Stars:** `' + bwstars.toString() +
|
||||||
"**Stars:** `" +
|
'`\n**Wins:** `' + bwwins.toString() +
|
||||||
bwstars.toString() +
|
'`\n**FKDR:** `' + bwfdkr.toString() + '`'
|
||||||
"`\n**Wins:** `" +
|
},
|
||||||
bwwins.toString() +
|
{
|
||||||
"`\n**FKDR:** `" +
|
name: '**Skywars**',
|
||||||
bwfdkr.toString() +
|
value: '**Stars:** `' + swstars.toString() + '`'
|
||||||
"`"
|
},
|
||||||
},
|
{
|
||||||
{
|
name: '**Duels**',
|
||||||
name: "**Skywars**",
|
value: '**Wins:** `' + duelswins.toString() + '`'
|
||||||
value: "**Stars:** `" + swstars.toString() + "`"
|
}
|
||||||
},
|
],
|
||||||
{
|
footer: {
|
||||||
name: "**Duels**",
|
text: interaction.guild.name + ' | Developed by: @Taken#0002',
|
||||||
value: "**Wins:** `" + duelswins.toString() + "`"
|
icon_url: interaction.guild.iconURL()
|
||||||
}
|
}
|
||||||
],
|
}]
|
||||||
footer: {
|
})
|
||||||
text: interaction.guild.name + " | Developed by: @Taken#0002",
|
}
|
||||||
icon_url: interaction.guild.iconURL()
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
101
commands/send.js
101
commands/send.js
@@ -1,62 +1,57 @@
|
|||||||
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
|
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
|
||||||
const { color } = require("../config/options.json");
|
const { color } = require('../config/options.json');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "send",
|
name: 'send',
|
||||||
description: "Send a message to a channel.",
|
description: 'Send a message to a channel.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("send")
|
.setName('send')
|
||||||
.setDescription("Send a message to a channel.")
|
.setDescription('Send a message to a channel.')
|
||||||
.addStringOption((option) =>
|
.addStringOption(option =>
|
||||||
option.setName("message").setDescription("The message to send.")
|
option
|
||||||
)
|
.setName('message')
|
||||||
.addChannelOption((option) =>
|
.setDescription('The message to send.'))
|
||||||
option
|
.addChannelOption(option =>
|
||||||
.setName("channel")
|
option
|
||||||
.setDescription("The channel to send the message to.")
|
.setName('channel')
|
||||||
)
|
.setDescription('The channel to send the message to.'))
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
.setDMPermission(false),
|
.setDMPermission(false),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
|
||||||
|
|
||||||
const message = interaction.options.getString("message");
|
await interaction.deferReply({ ephemeral: true });
|
||||||
const channel = interaction.options.getChannel("channel");
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
if (!message) {
|
const message = interaction.options.getString('message');
|
||||||
interaction.editReply({
|
const channel = interaction.options.getChannel('channel');
|
||||||
content: "Please provide a message to send.",
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!channel) {
|
if (!message) {
|
||||||
interaction.editReply({
|
interaction.editReply({ content: 'Please provide a message to send.', ephemeral: true })
|
||||||
content: "Please provide a channel to send the message to.",
|
return
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
channel.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: interaction.guild.name,
|
|
||||||
description: message,
|
|
||||||
color: embedColor,
|
|
||||||
thumbnail: {
|
|
||||||
url: interaction.guild.iconURL({ dynamic: true })
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
text: "Developed by @Taken#0002"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
if (!channel) {
|
||||||
}
|
interaction.editReply({ content: 'Please provide a channel to send the message to.', ephemeral: true })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
channel.send({
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
title: interaction.guild.name,
|
||||||
|
description: message,
|
||||||
|
color: embedColor,
|
||||||
|
thumbnail: {
|
||||||
|
url: interaction.guild.iconURL({ dynamic: true })
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
text: "Developed by @Taken#0002"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,50 +1,39 @@
|
|||||||
const {
|
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js')
|
||||||
SlashCommandBuilder,
|
|
||||||
PermissionFlagsBits,
|
|
||||||
userMention
|
|
||||||
} = require("discord.js");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "setnick",
|
name: 'setnick',
|
||||||
description: "Set your nickname",
|
description: 'Set your nickname',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("setnick")
|
.setName('setnick')
|
||||||
.setDescription("Set your nickname")
|
.setDescription('Set your nickname')
|
||||||
.addUserOption((option) =>
|
.addUserOption(option =>
|
||||||
option
|
option
|
||||||
.setName("user")
|
.setName('user')
|
||||||
.setDescription("The user to set the nickname for")
|
.setDescription('The user to set the nickname for')
|
||||||
.setRequired(true)
|
.setRequired(true))
|
||||||
)
|
.addStringOption(option =>
|
||||||
.addStringOption((option) =>
|
option
|
||||||
option
|
.setName('nickname')
|
||||||
.setName("nickname")
|
.setDescription('The nickname to set')
|
||||||
.setDescription("The nickname to set")
|
.setRequired(true))
|
||||||
.setRequired(true)
|
.setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames)
|
||||||
)
|
.setDMPermission(false),
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames)
|
|
||||||
.setDMPermission(false),
|
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const user = interaction.options.getUser("user");
|
|
||||||
const nickname = interaction.options.getString("nickname");
|
const user = interaction.options.getUser('user');
|
||||||
const member = await interaction.guild.members.fetch(user.id);
|
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 });
|
||||||
|
}
|
||||||
|
|
||||||
|
await member.setNickname(nickname, `Set by ${interaction.user.tag}`);
|
||||||
|
|
||||||
|
await interaction.reply({ content: "Set the nickname of " + userMention(member.id) + " to " + nickname, ephemeral: true });
|
||||||
|
|
||||||
if (!member.manageable) {
|
|
||||||
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
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,64 +1,59 @@
|
|||||||
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
|
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
|
||||||
const { color } = require("../config/options.json");
|
const { color } = require('../config/options.json');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "slowmode",
|
name: 'slowmode',
|
||||||
description: "Set the slowmode of a channel.",
|
description: 'Set the slowmode of a channel.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("slowmode")
|
.setName('slowmode')
|
||||||
.setDescription("Set the slowmode of a channel.")
|
.setDescription('Set the slowmode of a channel.')
|
||||||
.addIntegerOption((option) =>
|
.addIntegerOption(option =>
|
||||||
option
|
option
|
||||||
.setName("seconds")
|
.setName('seconds')
|
||||||
.setDescription("The amount of seconds to set the slowmode to.")
|
.setDescription('The amount of seconds to set the slowmode to.'))
|
||||||
)
|
.addChannelOption(option =>
|
||||||
.addChannelOption((option) =>
|
option
|
||||||
option
|
.setName('channel')
|
||||||
.setName("channel")
|
.setDescription('The channel to set the slowmode of.'))
|
||||||
.setDescription("The channel to set the slowmode of.")
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
)
|
.setDMPermission(false),
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
|
||||||
.setDMPermission(false),
|
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply({ ephermeral: true });
|
|
||||||
|
|
||||||
const seconds = interaction.options.getInteger("seconds") ?? 5;
|
await interaction.deferReply({ ephermeral: true });
|
||||||
const channel =
|
|
||||||
interaction.options.getChannel("channel") ?? interaction.channel;
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
if (seconds > 21600) {
|
const seconds = interaction.options.getInteger('seconds') ?? 5
|
||||||
await channel.setRateLimitPerUser(21600);
|
const channel = interaction.options.getChannel('channel') ?? interaction.channel
|
||||||
await interaction.editReply({
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
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({
|
if (seconds > 21600) {
|
||||||
embeds: [
|
await channel.setRateLimitPerUser(21600)
|
||||||
{
|
await interaction.editReply({
|
||||||
description: `Set the slowmode of ${channel} to ${seconds} seconds.`,
|
embeds: [{
|
||||||
color: embedColor,
|
description: `Set the slowmode of ${channel} to 21600 seconds.`,
|
||||||
footer: {
|
color: embedColor,
|
||||||
text: interaction.guild.name + " | Developed by: @Taken#0001",
|
footer: {
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
text: interaction.guild.name + " | Developed by: @Taken#0001",
|
||||||
}
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
await interaction.editReply({
|
||||||
await channel.setRateLimitPerUser(seconds);
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,282 +1,262 @@
|
|||||||
const { SlashCommandBuilder } = require("discord.js");
|
const { SlashCommandBuilder } = require('discord.js');
|
||||||
const env = require("dotenv").config();
|
const env = require('dotenv').config();
|
||||||
const hypixelApiKey = process.env.HYPIXELAPIKEY;
|
const hypixelApiKey = process.env.HYPIXELAPIKEY;
|
||||||
const fetch = require("axios");
|
const fetch = require('axios');
|
||||||
const verify = require("../schemas/verifySchema.js");
|
const verify = require('../schemas/verifySchema.js')
|
||||||
const { color, hypixelGuildID } = require("../config/options.json");
|
const { color, hypixelGuildID } = require('../config/options.json');
|
||||||
const {
|
const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json');
|
||||||
gm,
|
|
||||||
manager,
|
|
||||||
moderator,
|
|
||||||
beast,
|
|
||||||
member,
|
|
||||||
trialmember,
|
|
||||||
guildRole,
|
|
||||||
guildStaff,
|
|
||||||
defaultMember
|
|
||||||
} = require("../config/roles.json");
|
|
||||||
|
|
||||||
const removeThese = [
|
const removeThese = [gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff];
|
||||||
gm,
|
|
||||||
manager,
|
|
||||||
moderator,
|
|
||||||
beast,
|
|
||||||
member,
|
|
||||||
trialmember,
|
|
||||||
guildRole,
|
|
||||||
guildStaff
|
|
||||||
];
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "update",
|
name: 'update',
|
||||||
description: "Update your guild rank.",
|
description: 'Update your guild rank.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("update")
|
.setName('update')
|
||||||
.setDescription("Update your guild rank.")
|
.setDescription('Update your guild rank.')
|
||||||
.setDMPermission(false),
|
.setDMPermission(false),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply();
|
|
||||||
|
|
||||||
const user1 = interaction.user;
|
await interaction.deferReply();
|
||||||
const user = interaction.guild.members.cache.get(user1.id);
|
|
||||||
const verifyData = await verify.findOne({ userID: user.id });
|
|
||||||
const roleManage = user.roles;
|
|
||||||
|
|
||||||
if (!verifyData) {
|
const user1 = interaction.user;
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
const user = interaction.guild.members.cache.get(user1.id);
|
||||||
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
|
const verifyData = await verify.findOne({ userID: user.id })
|
||||||
}
|
const roleManage = user.roles;
|
||||||
|
|
||||||
await interaction.editReply({
|
if (!verifyData) {
|
||||||
embeds: [
|
|
||||||
{
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
description: "Updated your roles to `Default Member`",
|
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
|
||||||
color: embedColor,
|
|
||||||
thumbnail: {
|
|
||||||
url: head
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const slothPixel = "https://api.slothpixel.me/api/players/";
|
await interaction.editReply({
|
||||||
const guildAPI = "https://api.slothpixel.me/api/guilds/";
|
embeds: [{
|
||||||
const mojangAPI = "https://api.mojang.com/user/profile/";
|
description: "Updated your roles to `Default Member`",
|
||||||
const minotar = "https://minotar.net/helm/";
|
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 slothPixel = "https://api.slothpixel.me/api/players/";
|
||||||
const hypixelCheck = await fetch(slothPixel + verifyData.uuid);
|
const guildAPI = "https://api.slothpixel.me/api/guilds/"
|
||||||
|
const mojangAPI = "https://api.mojang.com/user/profile/"
|
||||||
|
const minotar = "https://minotar.net/helm/";
|
||||||
|
|
||||||
try {
|
const userCheck = await fetch(mojangAPI + verifyData.uuid);
|
||||||
const guildCheck = await fetch(guildAPI + verifyData.uuid);
|
const hypixelCheck = await fetch(slothPixel + verifyData.uuid);
|
||||||
var responseGuildID = guildCheck.data.id;
|
|
||||||
} catch (err) {
|
|
||||||
var responseGuildID = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (responseGuildID !== hypixelGuildID) {
|
try {
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
const guildCheck = await fetch(guildAPI + verifyData.uuid);
|
||||||
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
|
var responseGuildID = guildCheck.data.id;
|
||||||
}
|
} catch (err) {
|
||||||
|
var responseGuildID = null;
|
||||||
|
}
|
||||||
|
|
||||||
await roleManage.add(defaultMember, "User used the update command");
|
if (responseGuildID !== hypixelGuildID) {
|
||||||
|
|
||||||
await interaction.editReply({
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
embeds: [
|
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
|
||||||
{
|
|
||||||
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);
|
await roleManage.add(defaultMember, "User used the update command")
|
||||||
const head = minotar + userCheck.data.name;
|
|
||||||
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
await interaction.editReply({
|
||||||
const GuildMembers = guildCheck.data.members;
|
embeds: [{
|
||||||
const guildRank = GuildMembers.find(
|
description: "Updated your roles to `Default Member`",
|
||||||
(member) => member.uuid === verifyData.uuid
|
color: embedColor,
|
||||||
).rank;
|
thumbnail: {
|
||||||
|
url: head
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (guildRank === "Guild Master" && responseGuildID === hypixelGuildID) {
|
const guildCheck = await fetch(guildAPI + verifyData.uuid);
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
const head = minotar + userCheck.data.name;
|
||||||
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
|
|
||||||
}
|
|
||||||
|
|
||||||
await roleManage.add(guildRole, "User used the update command");
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
await roleManage.add(guildStaff, "User used the update command");
|
const GuildMembers = guildCheck.data.members;
|
||||||
await roleManage.add(gm, "User used the update command");
|
const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid).rank;
|
||||||
await roleManage.add(defaultMember, "User used the update command");
|
|
||||||
|
|
||||||
await interaction.editReply({
|
if (guildRank === 'Guild Master' && responseGuildID === hypixelGuildID) {
|
||||||
embeds: [
|
|
||||||
{
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
description: "Your rank has been updated to `Guild Master`",
|
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
|
||||||
color: embedColor,
|
|
||||||
thumbnail: {
|
|
||||||
url: head
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Manager" && responseGuildID === hypixelGuildID) {
|
await roleManage.add(guildRole, "User used the update command")
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
await roleManage.add(guildStaff, "User used the update command")
|
||||||
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
|
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({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: "Your rank has been updated to `Guild Master`",
|
||||||
description: "Your rank has been updated to `Manager`",
|
color: embedColor,
|
||||||
color: embedColor,
|
thumbnail: {
|
||||||
thumbnail: {
|
url: head
|
||||||
url: head
|
},
|
||||||
},
|
footer: {
|
||||||
footer: {
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === 'Manager' && responseGuildID === hypixelGuildID) {
|
||||||
|
|
||||||
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
|
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Moderator" && responseGuildID === hypixelGuildID) {
|
await roleManage.add(guildRole, "User used the update command")
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
await roleManage.add(guildStaff, "User used the update command")
|
||||||
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
|
await roleManage.add(manager, "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({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: "Your rank has been updated to `Manager`",
|
||||||
description: "Your rank has been updated to `Moderator`",
|
color: embedColor,
|
||||||
color: embedColor,
|
thumbnail: {
|
||||||
thumbnail: {
|
url: head
|
||||||
url: head
|
},
|
||||||
},
|
footer: {
|
||||||
footer: {
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === 'Moderator' && responseGuildID === hypixelGuildID) {
|
||||||
|
|
||||||
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
|
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Beast" && responseGuildID === hypixelGuildID) {
|
await roleManage.add(guildRole, "User used the update command")
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
await roleManage.add(guildStaff, "User used the update command")
|
||||||
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
|
await roleManage.add(moderator, "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({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: "Your rank has been updated to `Moderator`",
|
||||||
description: "Your rank has been updated to `Beast`.",
|
color: embedColor,
|
||||||
color: embedColor,
|
thumbnail: {
|
||||||
thumbnail: {
|
url: head
|
||||||
url: head
|
},
|
||||||
},
|
footer: {
|
||||||
footer: {
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Member" && responseGuildID === hypixelGuildID) {
|
await roleManage.add(guildRole, "User used the update command")
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
await roleManage.add(beast, "User used the update command")
|
||||||
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
|
await roleManage.add(defaultMember, "User used the update command")
|
||||||
}
|
|
||||||
|
|
||||||
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({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: "Your rank has been updated to `Beast`.",
|
||||||
description: "Your rank has been updated to `Member`.",
|
color: embedColor,
|
||||||
color: embedColor,
|
thumbnail: {
|
||||||
thumbnail: {
|
url: head
|
||||||
url: head
|
},
|
||||||
},
|
footer: {
|
||||||
footer: {
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === 'Member' && responseGuildID === hypixelGuildID) {
|
||||||
|
|
||||||
|
for (let i = 0; i < removeThese.length; i++) {
|
||||||
|
await roleManage.remove(removeThese[i], "Auto role removal. (Update)")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Trial Member" && responseGuildID === hypixelGuildID) {
|
await roleManage.add(guildRole, "User used the update command")
|
||||||
for (let i = 0; i < removeThese.length; i++) {
|
await roleManage.add(member, "User used the update command")
|
||||||
await roleManage.remove(removeThese[i], "Auto role removal. (Update)");
|
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({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
description: "Your rank has been updated to `Member`.",
|
||||||
description: "Your rank has been updated to `Trial Member`.",
|
color: embedColor,
|
||||||
color: embedColor,
|
thumbnail: {
|
||||||
thumbnail: {
|
url: head
|
||||||
url: head
|
},
|
||||||
},
|
footer: {
|
||||||
footer: {
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
text: interaction.guild.name + " | Developed by @Taken#0002",
|
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
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(trialmember, "User used the update command")
|
||||||
return;
|
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
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
@@ -1,191 +1,168 @@
|
|||||||
const { SlashCommandBuilder } = require("discord.js");
|
const { SlashCommandBuilder } = require('discord.js');
|
||||||
const env = require("dotenv").config();
|
const env = require('dotenv').config();
|
||||||
const hypixelApiKey = process.env.HYPIXELAPIKEY;
|
const hypixelApiKey = process.env.HYPIXELAPIKEY;
|
||||||
const fetch = require("axios");
|
const fetch = require('axios');
|
||||||
const { color, hypixelGuildID } = require("../config/options.json");
|
const { color, hypixelGuildID } = require('../config/options.json');
|
||||||
const verify = require("../schemas/verifySchema.js");
|
const verify = require('../schemas/verifySchema.js')
|
||||||
const mongoose = require("mongoose");
|
const mongoose = require('mongoose');
|
||||||
const {
|
const { gm, manager, moderator, beast, member, trialmember, guildRole, guildStaff, defaultMember } = require('../config/roles.json');
|
||||||
gm,
|
|
||||||
manager,
|
|
||||||
moderator,
|
|
||||||
beast,
|
|
||||||
member,
|
|
||||||
trialmember,
|
|
||||||
guildRole,
|
|
||||||
guildStaff,
|
|
||||||
defaultMember
|
|
||||||
} = require("../config/roles.json");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "verify",
|
name: 'verify',
|
||||||
description: "Verify yourself as a member of the server.",
|
description: 'Verify yourself as a member of the server.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("verify")
|
.setName('verify')
|
||||||
.setDescription("Verify yourself as a member of the server.")
|
.setDescription('Verify yourself as a member of the server.')
|
||||||
.addStringOption((option) =>
|
.addStringOption(option =>
|
||||||
option.setName("ign").setDescription("Your in-game name.")
|
option
|
||||||
)
|
.setName('ign')
|
||||||
.setDMPermission(false),
|
.setDescription('Your in-game name.'))
|
||||||
|
.setDMPermission(false),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply();
|
|
||||||
|
|
||||||
const user1 = interaction.user;
|
await interaction.deferReply();
|
||||||
const user = await interaction.guild.members.fetch(user1.id);
|
|
||||||
|
|
||||||
const fullUsername = user.user.username + "#" + user.user.discriminator;
|
const user1 = interaction.user;
|
||||||
const ign = interaction.options.getString("ign");
|
const user = await interaction.guild.members.fetch(user1.id);
|
||||||
const mojang = "https://api.mojang.com/users/profiles/minecraft/";
|
|
||||||
const slothPixel = "https://api.slothpixel.me/api/players/";
|
|
||||||
const guildAPI = "https://api.slothpixel.me/api/guilds/";
|
|
||||||
const minotar = "https://minotar.net/helm/";
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
const verifyData = await verify.findOne({ userID: user.id });
|
const fullUsername = user.user.username + "#" + user.user.discriminator
|
||||||
|
const ign = interaction.options.getString('ign');
|
||||||
|
const mojang = "https://api.mojang.com/users/profiles/minecraft/"
|
||||||
|
const slothPixel = "https://api.slothpixel.me/api/players/";
|
||||||
|
const guildAPI = "https://api.slothpixel.me/api/guilds/"
|
||||||
|
const minotar = "https://minotar.net/helm/";
|
||||||
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
if (verifyData) {
|
const verifyData = await verify.findOne({ userID: user.id })
|
||||||
interaction.editReply("You are already verified.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ign) {
|
if (verifyData) {
|
||||||
interaction.editReply("Please provide a player's IGN.");
|
interaction.editReply('You are already verified.')
|
||||||
return;
|
return
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await fetch(mojang + ign);
|
|
||||||
} catch (err) {
|
|
||||||
interaction.editReply("That player doesn't exist. [Mojang]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await fetch(slothPixel + ign);
|
|
||||||
} catch (err) {
|
|
||||||
interaction.editReply("That player doesn't exist. [Hypixel]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const userCheck = await fetch(mojang + ign);
|
|
||||||
const userUUID = userCheck.data.id;
|
|
||||||
|
|
||||||
const hypixelCheck = await fetch(slothPixel + userUUID);
|
|
||||||
const head = minotar + ign;
|
|
||||||
|
|
||||||
if (hypixelCheck.data.links.DISCORD !== fullUsername) {
|
|
||||||
interaction.editReply(
|
|
||||||
"Your Discord tag does not match your in-game tag."
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const guildCheck = await fetch(guildAPI + userUUID);
|
|
||||||
var responseGuildID = guildCheck.data.id;
|
|
||||||
} catch (err) {
|
|
||||||
var responseGuildID = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (responseGuildID !== hypixelGuildID) {
|
|
||||||
await user.roles.add(defaultMember, "Verification");
|
|
||||||
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: interaction.guild.name,
|
|
||||||
description:
|
|
||||||
"You have successfully verified `" +
|
|
||||||
fullUsername +
|
|
||||||
"` with the account `" +
|
|
||||||
hypixelCheck.data.username +
|
|
||||||
"`.",
|
|
||||||
color: embedColor,
|
|
||||||
thumbnail: {
|
|
||||||
url: head
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
icon_url: interaction.guild.iconURL(),
|
|
||||||
text: interaction.guild.name + " | Developed by Taken#0002"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const guildCheck = await fetch(guildAPI + userUUID);
|
|
||||||
const GuildMembers = await guildCheck.data.members;
|
|
||||||
const guildRank = GuildMembers.find(
|
|
||||||
(member) => member.uuid === hypixelCheck.data.uuid
|
|
||||||
).rank;
|
|
||||||
|
|
||||||
if (guildRank === "Guild Master" && responseGuildID === hypixelGuildID) {
|
|
||||||
await user.roles.add(gm, "Verification");
|
|
||||||
await user.roles.add(guildRole, "Verification");
|
|
||||||
await user.roles.add(guildStaff, "Verification");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Manager" && responseGuildID === hypixelGuildID) {
|
|
||||||
await user.roles.add(manager, "Verification");
|
|
||||||
await user.roles.add(guildRole, "Verification");
|
|
||||||
await user.roles.add(guildStaff, "Verification");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Moderator" && responseGuildID === hypixelGuildID) {
|
|
||||||
await user.roles.add(moderator, "Verification");
|
|
||||||
await user.roles.add(guildRole, "Verification");
|
|
||||||
await user.roles.add(guildStaff, "Verification");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Beast" && responseGuildID === hypixelGuildID) {
|
|
||||||
await user.roles.add(beast, "Verification");
|
|
||||||
await user.roles.add(guildRole, "Verification");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Member" && responseGuildID === hypixelGuildID) {
|
|
||||||
await user.roles.add(member, "Verification");
|
|
||||||
await user.roles.add(guildRole, "Verification");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guildRank === "Trial Member" && responseGuildID === 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
|
|
||||||
});
|
|
||||||
|
|
||||||
await newVerify.save();
|
|
||||||
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: interaction.guild.name,
|
|
||||||
description:
|
|
||||||
"You have successfully verified `" +
|
|
||||||
fullUsername +
|
|
||||||
"` with the account `" +
|
|
||||||
hypixelCheck.data.username +
|
|
||||||
"`.",
|
|
||||||
color: embedColor,
|
|
||||||
thumbnail: {
|
|
||||||
url: head
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
icon_url: interaction.guild.iconURL(),
|
|
||||||
text: interaction.guild.name + " | Developed by Taken#0002"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
if (!ign) {
|
||||||
}
|
interaction.editReply('Please provide a player\'s IGN.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fetch(mojang + ign);
|
||||||
|
} catch (err) {
|
||||||
|
interaction.editReply('That player doesn\'t exist. [Mojang]')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fetch(slothPixel + ign);
|
||||||
|
} catch (err) {
|
||||||
|
interaction.editReply('That player doesn\'t exist. [Hypixel]')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const userCheck = await fetch(mojang + ign);
|
||||||
|
const userUUID = userCheck.data.id;
|
||||||
|
|
||||||
|
const hypixelCheck = await fetch(slothPixel + userUUID);
|
||||||
|
const head = minotar + ign;
|
||||||
|
|
||||||
|
if (hypixelCheck.data.links.DISCORD !== fullUsername) {
|
||||||
|
interaction.editReply('Your Discord tag does not match your in-game tag.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const guildCheck = await fetch(guildAPI + userUUID);
|
||||||
|
var responseGuildID = guildCheck.data.id;
|
||||||
|
} catch (err) {
|
||||||
|
var responseGuildID = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseGuildID !== hypixelGuildID) {
|
||||||
|
|
||||||
|
await user.roles.add(defaultMember, "Verification")
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
title: interaction.guild.name,
|
||||||
|
description: "You have successfully verified `" + fullUsername + "` with the account `" + hypixelCheck.data.username + "`.",
|
||||||
|
color: embedColor,
|
||||||
|
thumbnail: {
|
||||||
|
url: head
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
icon_url: interaction.guild.iconURL(),
|
||||||
|
text: interaction.guild.name + " | Developed by Taken#0002"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const guildCheck = await fetch(guildAPI + userUUID);
|
||||||
|
const GuildMembers = await guildCheck.data.members;
|
||||||
|
const guildRank = GuildMembers.find(member => member.uuid === hypixelCheck.data.uuid).rank;
|
||||||
|
|
||||||
|
if (guildRank === "Guild Master" && responseGuildID === hypixelGuildID) {
|
||||||
|
await user.roles.add(gm, "Verification");
|
||||||
|
await user.roles.add(guildRole, "Verification")
|
||||||
|
await user.roles.add(guildStaff, "Verification")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === "Manager" && responseGuildID === hypixelGuildID) {
|
||||||
|
await user.roles.add(manager, "Verification");
|
||||||
|
await user.roles.add(guildRole, "Verification")
|
||||||
|
await user.roles.add(guildStaff, "Verification")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === "Moderator" && responseGuildID === hypixelGuildID) {
|
||||||
|
await user.roles.add(moderator, "Verification");
|
||||||
|
await user.roles.add(guildRole, "Verification")
|
||||||
|
await user.roles.add(guildStaff, "Verification")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === "Beast" && responseGuildID === hypixelGuildID) {
|
||||||
|
await user.roles.add(beast, "Verification");
|
||||||
|
await user.roles.add(guildRole, "Verification")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === "Member" && responseGuildID === hypixelGuildID) {
|
||||||
|
await user.roles.add(member, "Verification");
|
||||||
|
await user.roles.add(guildRole, "Verification")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guildRank === "Trial Member" && responseGuildID === 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
|
||||||
|
})
|
||||||
|
|
||||||
|
await newVerify.save()
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
title: interaction.guild.name,
|
||||||
|
description: "You have successfully verified `" + fullUsername + "` with the account `" + hypixelCheck.data.username + "`.",
|
||||||
|
color: embedColor,
|
||||||
|
thumbnail: {
|
||||||
|
url: head
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
icon_url: interaction.guild.iconURL(),
|
||||||
|
text: interaction.guild.name + " | Developed by Taken#0002"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,66 +1,58 @@
|
|||||||
const {
|
const { SlashCommandBuilder, PermissionFlagsBits, userMention } = require('discord.js');
|
||||||
SlashCommandBuilder,
|
const { color } = require('../config/options.json');
|
||||||
PermissionFlagsBits,
|
const verify = require('../schemas/verifySchema.js');
|
||||||
userMention
|
const fetch = require('axios');
|
||||||
} = require("discord.js");
|
|
||||||
const { color } = require("../config/options.json");
|
|
||||||
const verify = require("../schemas/verifySchema.js");
|
|
||||||
const fetch = require("axios");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "whois",
|
name: 'whois',
|
||||||
description: "Get's the ign of a user.",
|
description: 'Get\'s the ign of a user.',
|
||||||
type: "slash",
|
type: 'slash',
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("whois")
|
.setName('whois')
|
||||||
.setDescription("Get's the ign of a user.")
|
.setDescription('Get\'s the ign of a user.')
|
||||||
.addUserOption((option) =>
|
.addUserOption(option =>
|
||||||
option
|
option
|
||||||
.setName("user")
|
.setName('user')
|
||||||
.setDescription("The user to get the ign of.")
|
.setDescription('The user to get the ign of.')
|
||||||
.setRequired(true)
|
.setRequired(true))
|
||||||
)
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
.setDMPermission(false),
|
||||||
.setDMPermission(false),
|
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply();
|
|
||||||
|
|
||||||
const user = interaction.options.getUser("user");
|
await interaction.deferReply();
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
const mojang = "https://api.mojang.com/user/profile/";
|
|
||||||
const minotar = "https://minotar.net/helm/";
|
|
||||||
|
|
||||||
const verifiedUser = await verify.findOne({ userID: user.id });
|
const user = interaction.options.getUser('user');
|
||||||
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
const mojang = "https://api.mojang.com/user/profile/"
|
||||||
|
const minotar = "https://minotar.net/helm/";
|
||||||
|
|
||||||
if (!verifiedUser) {
|
const verifiedUser = await verify.findOne({ userID: user.id });
|
||||||
interaction.editReply({
|
|
||||||
content: "This user has not verified their account."
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const userCheck = await fetch(mojang + verifiedUser.uuid);
|
if (!verifiedUser) {
|
||||||
const ign = userCheck.data.name;
|
interaction.editReply({ content: 'This user has not verified their account.' });
|
||||||
const head = minotar + ign;
|
return
|
||||||
|
|
||||||
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 })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
const userCheck = await fetch(mojang + verifiedUser.uuid);
|
||||||
}
|
const ign = userCheck.data.name;
|
||||||
|
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 })
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"largeM": "(256 characters max)",
|
"largeM": "(256 characters max)",
|
||||||
"smallM": "(128 characters max)",
|
"smallM": "(128 characters max)",
|
||||||
"ignM": "(16 characters max)"
|
"ignM": "(16 characters max)"
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"color": "#eeaadb",
|
"color": "#eeaadb",
|
||||||
"applicationsChannel": "776705352456470550",
|
"applicationsChannel": "776705352456470550",
|
||||||
"staffApplicationsChannel": "1039258641393520700",
|
"staffApplicationsChannel": "1039258641393520700",
|
||||||
"staffOtherChannel": "1082036748558803104",
|
"staffOtherChannel": "1082036748558803104",
|
||||||
"hypixelGuildID": "5a353a170cf2e529044f2935"
|
"hypixelGuildID": "5a353a170cf2e529044f2935"
|
||||||
}
|
}
|
||||||
@@ -1,30 +1,30 @@
|
|||||||
{
|
{
|
||||||
"qu1": "What is your IGN?",
|
"qu1": "What is your IGN?",
|
||||||
"qu2": "What is your hypixel Network Level?",
|
"qu2": "What is your hypixel Network Level?",
|
||||||
"qu3": "What stats are you submitting? (ex. BW lv 135 or SW lv 12 etc..)? Please provide us your best stats of the gamemode you main the most.",
|
"qu3": "What stats are you submitting? (ex. BW lv 135 or SW lv 12 etc..)? Please provide us your best stats of the gamemode you main the most.",
|
||||||
"qu4": "Which talents make you a good member for Illegitimate? Tell us about your accomplishments, hobbies and ambitions both on Hypixel and in real life.",
|
"qu4": "Which talents make you a good member for Illegitimate? Tell us about your accomplishments, hobbies and ambitions both on Hypixel and in real life.",
|
||||||
"qu5": "Will you be able to make from 100k to 150k gexp x week?",
|
"qu5": "Will you be able to make from 100k to 150k gexp x week?",
|
||||||
"qu6": "Tell us about: your age, what you expect to gain from Illegitimate, whether you play on other accounts; if you often will be inactive; your punishment history; etc… This section is all yours and we expect a longer answer.",
|
"qu6": "Tell us about: your age, what you expect to gain from Illegitimate, whether you play on other accounts; if you often will be inactive; your punishment history; etc… This section is all yours and we expect a longer answer.",
|
||||||
"qu7": "How did you find about us? (Yt, advertisement in lobbies, friend..)",
|
"qu7": "How did you find about us? (Yt, advertisement in lobbies, friend..)",
|
||||||
"qu8": "What is your time zone? (Example: GMT+1)",
|
"qu8": "What is your time zone? (Example: GMT+1)",
|
||||||
"rq1": "What is your IGN?",
|
"rq1": "What is your IGN?",
|
||||||
"rq2": "What is your hypixel Network Level?",
|
"rq2": "What is your hypixel Network Level?",
|
||||||
"rq3": "What stats are you submitting?",
|
"rq3": "What stats are you submitting?",
|
||||||
"rq4": "Which talents make you a good member for Illegitimate?",
|
"rq4": "Which talents make you a good member for Illegitimate?",
|
||||||
"rq5": "Will you be able to make from 100k to 150k gexp x week?",
|
"rq5": "Will you be able to make from 100k to 150k gexp x week?",
|
||||||
"rq6": "Tell us about yourself.",
|
"rq6": "Tell us about yourself.",
|
||||||
"rq7": "How did you find about us?",
|
"rq7": "How did you find about us?",
|
||||||
"rq8": "What is your time zone?",
|
"rq8": "What is your time zone?",
|
||||||
"sq1": "What is your IGN?",
|
"sq1": "What is your IGN?",
|
||||||
"sq2": "How long have you been in the guild for?",
|
"sq2": "How long have you been in the guild for?",
|
||||||
"sq3": "Have you been guild muted for any reason? (This includes mutes for staff disrespect, arguing with guild members, toxicity...)",
|
"sq3": "Have you been guild muted for any reason? (This includes mutes for staff disrespect, arguing with guild members, toxicity...)",
|
||||||
"sq4": "Are you an active guild member? (Keep in mind we will surely check your GEXP)",
|
"sq4": "Are you an active guild member? (Keep in mind we will surely check your GEXP)",
|
||||||
"sq5": "Do you have any experience as a staff member (guild moderator) at all?",
|
"sq5": "Do you have any experience as a staff member (guild moderator) at all?",
|
||||||
"sq6": "Why should we choose you as a Guild Moderator? (Tell us what would you do for the guild, how are you gonna help us grow the community, how many hours per day are you willing to spend doing the stuff as moderator for the guild etc..",
|
"sq6": "Why should we choose you as a Guild Moderator? (Tell us what would you do for the guild, how are you gonna help us grow the community, how many hours per day are you willing to spend doing the stuff as moderator for the guild etc..",
|
||||||
"rsq1": "What is your IGN?",
|
"rsq1": "What is your IGN?",
|
||||||
"rsq2": "How long have you been in the guild for?",
|
"rsq2": "How long have you been in the guild for?",
|
||||||
"rsq3": "Have you been guild muted for any reason?",
|
"rsq3": "Have you been guild muted for any reason?",
|
||||||
"rsq4": "Are you an active guild member?",
|
"rsq4": "Are you an active guild member?",
|
||||||
"rsq5": "Do you have any experience as a staff member (guild moderator) at all?",
|
"rsq5": "Do you have any experience as a staff member (guild moderator) at all?",
|
||||||
"rsq6": "Why should we choose you as a Guild Moderator?"
|
"rsq6": "Why should we choose you as a Guild Moderator?"
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"bwstars": 120,
|
"bwstars": 120,
|
||||||
"bwfdkr": 2,
|
"bwfdkr": 2,
|
||||||
"bwwins": 1200,
|
"bwwins": 1200,
|
||||||
"swstars": 15,
|
"swstars": 15,
|
||||||
"duelswins": 5000
|
"duelswins": 5000
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"gm": "815893218246787080",
|
"gm": "815893218246787080",
|
||||||
"manager": "815880752683679824",
|
"manager": "815880752683679824",
|
||||||
"moderator": "815880910019887134",
|
"moderator": "815880910019887134",
|
||||||
"beast": "815880942345519104",
|
"beast": "815880942345519104",
|
||||||
"member": "815880984301404190",
|
"member": "815880984301404190",
|
||||||
"trialmember": "815877333532540938",
|
"trialmember": "815877333532540938",
|
||||||
"guildStaff": "984584711227703336",
|
"guildStaff": "984584711227703336",
|
||||||
"guildRole": "1043224015722000514",
|
"guildRole": "1043224015722000514",
|
||||||
"waitingList": "1092543315053908120",
|
"waitingList": "1092543315053908120",
|
||||||
"defaultMember": "722386801930797056",
|
"defaultMember": "722386801930797056",
|
||||||
"admin": "528549814846095360",
|
"admin": "528549814846095360",
|
||||||
"helper": "592371991294771226",
|
"helper": "592371991294771226",
|
||||||
"muted": "594355088932339732"
|
"muted": "594355088932339732"
|
||||||
}
|
}
|
||||||
@@ -1,93 +1,86 @@
|
|||||||
const { REST, Routes } = require("discord.js");
|
const { REST, Routes } = require('discord.js');
|
||||||
const env = require("dotenv").config();
|
const env = require('dotenv').config();
|
||||||
const token = process.env.TOKEN;
|
const token = process.env.TOKEN;
|
||||||
const clientId = process.env.CLIENTID;
|
const clientId = process.env.CLIENTID;
|
||||||
const fs = require("node:fs");
|
const fs = require('node:fs');
|
||||||
const args = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
const arg = args[0];
|
const arg = args[0];
|
||||||
|
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
console.log("Please specify a command to run!");
|
console.log('Please specify a command to run!');
|
||||||
} else if (arg === "--prod") {
|
}
|
||||||
const commands = [];
|
else if (arg === '--prod') {
|
||||||
// Grab all the command files from the commands directory you created earlier
|
const commands = [];
|
||||||
const commandFiles = fs
|
// Grab all the command files from the commands directory you created earlier
|
||||||
.readdirSync("./commands")
|
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
|
||||||
.filter((file) => file.endsWith(".js"));
|
const contentMenuCommands = fs.readdirSync('./commands-contextmenu').filter(file => file.endsWith('.js'));
|
||||||
const contentMenuCommands = fs
|
|
||||||
.readdirSync("./commands-contextmenu")
|
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
||||||
.filter((file) => file.endsWith(".js"));
|
for (const file of commandFiles) {
|
||||||
|
const command = require(`./commands/${file}`);
|
||||||
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
commands.push(command.data.toJSON());
|
||||||
for (const file of commandFiles) {
|
}
|
||||||
const command = require(`./commands/${file}`);
|
|
||||||
commands.push(command.data.toJSON());
|
for (const file of contentMenuCommands) {
|
||||||
}
|
const command = require(`./commands-contextmenu/${file}`);
|
||||||
|
commands.push(command.data.toJSON());
|
||||||
for (const file of contentMenuCommands) {
|
}
|
||||||
const command = require(`./commands-contextmenu/${file}`);
|
|
||||||
commands.push(command.data.toJSON());
|
// Construct and prepare an instance of the REST module
|
||||||
}
|
const rest = new REST({ version: '10' }).setToken(token);
|
||||||
|
|
||||||
// Construct and prepare an instance of the REST module
|
|
||||||
const rest = new REST({ version: "10" }).setToken(token);
|
// and deploy your commands!
|
||||||
|
(async () => {
|
||||||
// and deploy your commands!
|
try {
|
||||||
(async () => {
|
console.log(`Started refreshing ${commands.length} application (/) commands.`);
|
||||||
try {
|
|
||||||
console.log(
|
// The put method is used to fully refresh all commands in the guild with the current set
|
||||||
`Started refreshing ${commands.length} application (/) commands.`
|
const data = await rest.put(
|
||||||
);
|
Routes.applicationCommands(clientId),
|
||||||
|
{ body: commands },
|
||||||
// The put method is used to fully refresh all commands in the guild with the current set
|
);
|
||||||
const data = await rest.put(Routes.applicationCommands(clientId), {
|
|
||||||
body: commands
|
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
|
||||||
});
|
} catch (error) {
|
||||||
|
// And of course, make sure you catch and log any errors!
|
||||||
console.log(
|
console.error(error);
|
||||||
`Successfully reloaded ${data.length} application (/) commands.`
|
}
|
||||||
);
|
})();
|
||||||
} catch (error) {
|
}
|
||||||
// And of course, make sure you catch and log any errors!
|
else if (arg === '--dev') {
|
||||||
console.error(error);
|
const commands = [];
|
||||||
}
|
// Grab all the command files from the commands directory you created earlier
|
||||||
})();
|
const commandFiles = fs.readdirSync('./commands-contextmenu').filter(file => file.endsWith('.js'));
|
||||||
} else if (arg === "--dev") {
|
|
||||||
const commands = [];
|
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
||||||
// Grab all the command files from the commands directory you created earlier
|
for (const file of commandFiles) {
|
||||||
const commandFiles = fs
|
const command = require(`./commands-contextmenu/${file}`);
|
||||||
.readdirSync("./commands-contextmenu")
|
commands.push(command.data.toJSON());
|
||||||
.filter((file) => file.endsWith(".js"));
|
}
|
||||||
|
|
||||||
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
// Construct and prepare an instance of the REST module
|
||||||
for (const file of commandFiles) {
|
const rest = new REST({ version: '10' }).setToken(token);
|
||||||
const command = require(`./commands-contextmenu/${file}`);
|
|
||||||
commands.push(command.data.toJSON());
|
|
||||||
}
|
// and deploy your commands!
|
||||||
|
(async () => {
|
||||||
// Construct and prepare an instance of the REST module
|
try {
|
||||||
const rest = new REST({ version: "10" }).setToken(token);
|
console.log(`Started refreshing ${commands.length} application (/) commands.`);
|
||||||
|
|
||||||
// and deploy your commands!
|
// The put method is used to fully refresh all commands in the guild with the current set
|
||||||
(async () => {
|
const data = await rest.put(
|
||||||
try {
|
Routes.applicationCommands(clientId),
|
||||||
console.log(
|
{ body: commands },
|
||||||
`Started refreshing ${commands.length} application (/) commands.`
|
);
|
||||||
);
|
|
||||||
|
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
|
||||||
// The put method is used to fully refresh all commands in the guild with the current set
|
} catch (error) {
|
||||||
const data = await rest.put(Routes.applicationCommands(clientId), {
|
// And of course, make sure you catch and log any errors!
|
||||||
body: commands
|
console.error(error);
|
||||||
});
|
}
|
||||||
|
})();
|
||||||
console.log(
|
}
|
||||||
`Successfully reloaded ${data.length} application (/) commands.`
|
else if (arg && arg !== '--prod' && arg !== '--dev') {
|
||||||
);
|
console.log('Invalid argument!');
|
||||||
} catch (error) {
|
|
||||||
// And of course, make sure you catch and log any errors!
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
} else if (arg && arg !== "--prod" && arg !== "--dev") {
|
|
||||||
console.log("Invalid argument!");
|
|
||||||
}
|
}
|
||||||
@@ -1,167 +1,127 @@
|
|||||||
const { color } = require("../../config/options.json");
|
const { color } = require('../../config/options.json');
|
||||||
const fetch = require("axios");
|
const fetch = require('axios');
|
||||||
const guildapp = require("../../schemas/guildAppSchema.js");
|
const guildapp = require('../../schemas/guildAppSchema.js');
|
||||||
const {
|
const { bwfdkr, bwstars, bwwins, duelswins, swstars } = require('../../config/reqs.json');
|
||||||
bwfdkr,
|
|
||||||
bwstars,
|
|
||||||
bwwins,
|
|
||||||
duelswins,
|
|
||||||
swstars
|
|
||||||
} = require("../../config/reqs.json");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "checkstats",
|
name: 'checkstats',
|
||||||
description: "Check your stats.",
|
description: 'Check your stats.',
|
||||||
type: "button",
|
type: 'button',
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply();
|
|
||||||
|
|
||||||
const message = interaction.message;
|
await interaction.deferReply();
|
||||||
const embed = message.embeds[0];
|
|
||||||
const applicantId = embed.footer.text.split(" ")[1];
|
|
||||||
|
|
||||||
const guildappdata = await guildapp.findOne({ userID: applicantId });
|
const message = interaction.message;
|
||||||
const uuid = guildappdata.uuid;
|
const embed = message.embeds[0];
|
||||||
|
const applicantId = embed.footer.text.split(" ")[1]
|
||||||
|
|
||||||
const mojang = "https://api.mojang.com/user/profile/";
|
const guildappdata = await guildapp.findOne({ userID: applicantId })
|
||||||
const slothPixel = "https://api.slothpixel.me/api/players/";
|
const uuid = guildappdata.uuid;
|
||||||
const guildAPI = "https://api.slothpixel.me/api/guilds/";
|
|
||||||
const minotar = "https://minotar.net/helm/";
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
const userCheck = await fetch(mojang + uuid);
|
const mojang = "https://api.mojang.com/user/profile/"
|
||||||
const ign = userCheck.data.name;
|
const slothPixel = "https://api.slothpixel.me/api/players/";
|
||||||
|
const guildAPI = "https://api.slothpixel.me/api/guilds/"
|
||||||
|
const minotar = "https://minotar.net/helm/";
|
||||||
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
try {
|
const userCheck = await fetch(mojang + uuid);
|
||||||
await fetch(slothPixel + uuid);
|
const ign = userCheck.data.name;
|
||||||
} catch (error) {
|
|
||||||
interaction.editReply("That player doesn't exist. [Hypixel]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const stats = await fetch(slothPixel + uuid);
|
try {
|
||||||
const head = minotar + ign;
|
await fetch(slothPixel + uuid);
|
||||||
|
} catch (error) {
|
||||||
const rank_formatted = stats.data.rank_formatted;
|
interaction.editReply('That player doesn\'t exist. [Hypixel]')
|
||||||
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "");
|
return
|
||||||
|
|
||||||
if (rank2 === "") {
|
|
||||||
var rank = "";
|
|
||||||
} else {
|
|
||||||
var rank = rank2 + " ";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const guildCheck = await fetch(guildAPI + uuid);
|
|
||||||
var guildName = guildCheck.data.name;
|
|
||||||
} catch (error) {
|
|
||||||
var guildName = "None";
|
|
||||||
}
|
|
||||||
|
|
||||||
const hsbwstars = stats.data.stats.BedWars.level;
|
|
||||||
const hsbwfkdr = stats.data.stats.BedWars.final_k_d;
|
|
||||||
const hsbwwins = stats.data.stats.BedWars.wins;
|
|
||||||
const hsswstars = stats.data.stats.SkyWars.level;
|
|
||||||
const hsduelswins = stats.data.stats.Duels.general.wins;
|
|
||||||
|
|
||||||
if (hsbwstars < bwstars && hsbwfkdr < bwfdkr && 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) {
|
|
||||||
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.";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const guildCheck = await fetch(guildAPI + userUUID);
|
|
||||||
const tag_formatted = guildCheck.data.tag_formatted;
|
|
||||||
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "");
|
|
||||||
var guildTag = " " + guildTag2;
|
|
||||||
} catch (error) {
|
|
||||||
var guildTag = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
await interaction.editReply({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: rank + stats.data.username + guildTag,
|
|
||||||
description:
|
|
||||||
"**Network Level:** `" +
|
|
||||||
stats.data.level.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:** `" +
|
|
||||||
stats.data.stats.BedWars.level.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ FKDR:** `" +
|
|
||||||
stats.data.stats.BedWars.final_k_d.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ Wins:** `" +
|
|
||||||
stats.data.stats.BedWars.wins.toString() +
|
|
||||||
"`"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: swtitle,
|
|
||||||
value:
|
|
||||||
"**➺ Stars:** `" +
|
|
||||||
stats.data.stats.SkyWars.level.toFixed(2).toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ KDR:** `" +
|
|
||||||
stats.data.stats.SkyWars.kill_death_ratio.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ Wins:** `" +
|
|
||||||
stats.data.stats.SkyWars.wins.toString() +
|
|
||||||
"`"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: duelstitle,
|
|
||||||
value:
|
|
||||||
"**➺ Wins:** `" +
|
|
||||||
stats.data.stats.Duels.general.wins.toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ KDR:** `" +
|
|
||||||
stats.data.stats.Duels.general.kd_ratio.toFixed(2).toString() +
|
|
||||||
"`\n" +
|
|
||||||
"**➺ WLR:** `" +
|
|
||||||
stats.data.stats.Duels.general.win_loss_ratio
|
|
||||||
.toFixed(2)
|
|
||||||
.toString() +
|
|
||||||
"`"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
const stats = await fetch(slothPixel + uuid);
|
||||||
}
|
const head = minotar + ign;
|
||||||
|
|
||||||
|
const rank_formatted = stats.data.rank_formatted
|
||||||
|
const rank2 = rank_formatted.replace(/&[0-9a-fk-or]/g, "")
|
||||||
|
|
||||||
|
if (rank2 === "") {
|
||||||
|
var rank = ""
|
||||||
|
} else {
|
||||||
|
var rank = rank2 + " "
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const guildCheck = await fetch(guildAPI + uuid);
|
||||||
|
var guildName = guildCheck.data.name
|
||||||
|
} catch (error) {
|
||||||
|
var guildName = "None"
|
||||||
|
}
|
||||||
|
|
||||||
|
const hsbwstars = stats.data.stats.BedWars.level
|
||||||
|
const hsbwfkdr = stats.data.stats.BedWars.final_k_d
|
||||||
|
const hsbwwins = stats.data.stats.BedWars.wins
|
||||||
|
const hsswstars = stats.data.stats.SkyWars.level
|
||||||
|
const hsduelswins = stats.data.stats.Duels.general.wins
|
||||||
|
|
||||||
|
if (hsbwstars < bwstars && hsbwfkdr < bwfdkr && 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) {
|
||||||
|
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."
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const guildCheck = await fetch(guildAPI + userUUID);
|
||||||
|
const tag_formatted = guildCheck.data.tag_formatted
|
||||||
|
const guildTag2 = tag_formatted.replace(/&[0-9a-fk-or]/g, "")
|
||||||
|
var guildTag = " " + guildTag2
|
||||||
|
} catch (error) {
|
||||||
|
var guildTag = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
title: rank + stats.data.username + guildTag,
|
||||||
|
description: "**Network Level:** `" + stats.data.level.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:** `" + stats.data.stats.BedWars.level.toString() + "`\n" +
|
||||||
|
"**➺ FKDR:** `" + stats.data.stats.BedWars.final_k_d.toString() + "`\n" +
|
||||||
|
"**➺ Wins:** `" + stats.data.stats.BedWars.wins.toString() + "`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: swtitle,
|
||||||
|
value: "**➺ Stars:** `" + stats.data.stats.SkyWars.level.toFixed(2).toString() + "`\n" +
|
||||||
|
"**➺ KDR:** `" + stats.data.stats.SkyWars.kill_death_ratio.toString() + "`\n" +
|
||||||
|
"**➺ Wins:** `" + stats.data.stats.SkyWars.wins.toString() + "`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: duelstitle,
|
||||||
|
value: "**➺ Wins:** `" + stats.data.stats.Duels.general.wins.toString() + "`\n" +
|
||||||
|
"**➺ KDR:** `" + stats.data.stats.Duels.general.kd_ratio.toFixed(2).toString() + "`\n" +
|
||||||
|
"**➺ WLR:** `" + stats.data.stats.Duels.general.win_loss_ratio.toFixed(2).toString() + "`"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
};
|
};
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,77 +1,73 @@
|
|||||||
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require("discord.js");
|
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require('discord.js');
|
||||||
const { color } = require("../../config/options.json");
|
const { color } = require('../../config/options.json');
|
||||||
const guildapp = require("../../schemas/guildAppSchema.js");
|
const guildapp = require('../../schemas/guildAppSchema.js');
|
||||||
const { waitingList } = require("../../config/roles.json");
|
const { waitingList } = require('../../config/roles.json');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "guildapplicationaccept",
|
name: 'guildapplicationaccept',
|
||||||
description: "Accept a guild application.",
|
description: 'Accept a guild application.',
|
||||||
type: "button",
|
type: 'button',
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply();
|
|
||||||
|
|
||||||
const user = interaction.user;
|
await interaction.deferReply();
|
||||||
const guild = interaction.guild;
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
const message = interaction.message;
|
const user = interaction.user;
|
||||||
const embed = message.embeds[0];
|
const guild = interaction.guild;
|
||||||
const applicantId = embed.footer.text.split(" ")[1];
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
const applicant = await guild.members.fetch(applicantId);
|
const message = interaction.message;
|
||||||
const applicantUsername =
|
const embed = message.embeds[0];
|
||||||
applicant.user.username + "#" + applicant.user.discriminator;
|
const applicantId = embed.footer.text.split(" ")[1]
|
||||||
|
|
||||||
await message.edit({
|
const applicant = await guild.members.fetch(applicantId)
|
||||||
components: [
|
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator;
|
||||||
new ActionRowBuilder().addComponents(
|
|
||||||
new ButtonBuilder()
|
|
||||||
.setCustomId("guildapplicationaccept")
|
|
||||||
.setLabel("Accept")
|
|
||||||
.setStyle(ButtonStyle.Primary)
|
|
||||||
.setDisabled(true),
|
|
||||||
new ButtonBuilder()
|
|
||||||
.setCustomId("guildapplicationdeny")
|
|
||||||
.setLabel("Deny")
|
|
||||||
.setStyle(ButtonStyle.Danger)
|
|
||||||
.setDisabled(true),
|
|
||||||
new ButtonBuilder()
|
|
||||||
.setCustomId("checkstats")
|
|
||||||
.setLabel("Check Stats")
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
|
||||||
.setDisabled(true)
|
|
||||||
)
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
await applicant.send({
|
await message.edit({
|
||||||
embeds: [
|
components: [
|
||||||
{
|
new ActionRowBuilder().addComponents(
|
||||||
description: `Your application for the Illegitimate guild has been accepted.`,
|
new ButtonBuilder()
|
||||||
color: embedColor
|
.setCustomId("guildapplicationaccept")
|
||||||
}
|
.setLabel("Accept")
|
||||||
]
|
.setStyle(ButtonStyle.Primary)
|
||||||
});
|
.setDisabled(true),
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("guildapplicationdeny")
|
||||||
|
.setLabel("Deny")
|
||||||
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
.setDisabled(true),
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("checkstats")
|
||||||
|
.setLabel("Check Stats")
|
||||||
|
.setStyle(ButtonStyle.Secondary)
|
||||||
|
.setDisabled(true)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
await applicant.roles.add(waitingList);
|
await applicant.send({
|
||||||
await guildapp.findOneAndDelete({ userID: applicantId });
|
embeds: [{
|
||||||
|
description: `Your application for the Illegitimate guild has been accepted.`,
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
await interaction.editReply({
|
await applicant.roles.add(waitingList);
|
||||||
embeds: [
|
await guildapp.findOneAndDelete({ userID: applicantId });
|
||||||
{
|
|
||||||
title: applicantUsername + " - Guild Application",
|
await interaction.editReply({
|
||||||
description: "Application has been accepted by <@" + user.id + ">.",
|
embeds: [{
|
||||||
color: embedColor,
|
title: applicantUsername + " - Guild Application",
|
||||||
thumbnail: {
|
description: "Application has been accepted by <@" + user.id + ">.",
|
||||||
url: applicant.avatarURL()
|
color: embedColor,
|
||||||
},
|
thumbnail: {
|
||||||
footer: {
|
url: applicant.avatarURL()
|
||||||
iconURL: guild.iconURL(),
|
},
|
||||||
text: "ID: " + applicant.id
|
footer: {
|
||||||
}
|
iconURL: guild.iconURL(),
|
||||||
}
|
text: "ID: " + applicant.id
|
||||||
]
|
}
|
||||||
});
|
}]
|
||||||
}
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,36 +1,32 @@
|
|||||||
const {
|
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
|
||||||
ModalBuilder,
|
const { color } = require('../../config/options.json');
|
||||||
ActionRowBuilder,
|
|
||||||
TextInputBuilder,
|
|
||||||
TextInputStyle
|
|
||||||
} = require("discord.js");
|
|
||||||
const { color } = require("../../config/options.json");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "guildapplicationdeny",
|
name: 'guildapplicationdeny',
|
||||||
description: "Deny a guild application.",
|
description: 'Deny a guild application.',
|
||||||
type: "button",
|
type: 'button',
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const channel = interaction.channel;
|
|
||||||
const guild = interaction.guild;
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
const message = interaction.message;
|
const channel = interaction.channel;
|
||||||
|
const guild = interaction.guild;
|
||||||
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
const modal = new ModalBuilder()
|
const message = interaction.message;
|
||||||
.setTitle("Deny Reason")
|
|
||||||
.setCustomId("denyreasonbox")
|
const modal = new ModalBuilder()
|
||||||
.setComponents(
|
.setTitle('Deny Reason')
|
||||||
new ActionRowBuilder().setComponents(
|
.setCustomId('denyreasonbox')
|
||||||
new TextInputBuilder()
|
.setComponents(
|
||||||
.setLabel("Deny Reason")
|
new ActionRowBuilder().setComponents(
|
||||||
.setCustomId("denyreason")
|
new TextInputBuilder()
|
||||||
.setStyle(TextInputStyle.Paragraph)
|
.setLabel('Deny Reason')
|
||||||
.setPlaceholder("Enter a reason for denying the application")
|
.setCustomId('denyreason')
|
||||||
.setRequired(false)
|
.setStyle(TextInputStyle.Paragraph)
|
||||||
)
|
.setPlaceholder('Enter a reason for denying the application')
|
||||||
);
|
.setRequired(false)
|
||||||
await interaction.showModal(modal);
|
)
|
||||||
}
|
)
|
||||||
|
await interaction.showModal(modal);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,69 +1,66 @@
|
|||||||
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
|
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
|
||||||
const { color } = require("../../config/options.json");
|
const { color } = require('../../config/options.json');
|
||||||
const staffapp = require("../../schemas/staffAppSchema.js");
|
const staffapp = require('../../schemas/staffAppSchema.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "staffapplicationaccept",
|
name: 'staffapplicationaccept',
|
||||||
description: "Accept a staff application.",
|
description: 'Accept a staff application.',
|
||||||
type: "button",
|
type: 'button',
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const user = interaction.user;
|
|
||||||
const channel = interaction.channel;
|
|
||||||
const guild = interaction.guild;
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
const message = interaction.message;
|
const user = interaction.user;
|
||||||
const embed = message.embeds[0];
|
const channel = interaction.channel;
|
||||||
const applicantId = embed.footer.text.split(" ")[1];
|
const guild = interaction.guild;
|
||||||
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
const applicant = await guild.members.fetch(applicantId);
|
const message = interaction.message;
|
||||||
const applicantUsername =
|
const embed = message.embeds[0];
|
||||||
applicant.user.username + "#" + applicant.user.discriminator;
|
const applicantId = embed.footer.text.split(" ")[1]
|
||||||
|
|
||||||
await applicant.send({
|
const applicant = await guild.members.fetch(applicantId)
|
||||||
embeds: [
|
const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator;
|
||||||
{
|
|
||||||
description: `Your application for the Illegitimate staff team has been accepted.`,
|
|
||||||
color: embedColor
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
await message.edit({
|
await applicant.send({
|
||||||
components: [
|
embeds: [{
|
||||||
new ActionRowBuilder().addComponents(
|
description: `Your application for the Illegitimate staff team has been accepted.`,
|
||||||
new ButtonBuilder()
|
color: embedColor
|
||||||
.setCustomId("staffapplicationaccept")
|
}]
|
||||||
.setLabel("Accept")
|
});
|
||||||
.setStyle(ButtonStyle.Primary)
|
|
||||||
.setDisabled(true),
|
|
||||||
new ButtonBuilder()
|
|
||||||
.setCustomId("staffapplicationdeny")
|
|
||||||
.setLabel("Deny")
|
|
||||||
.setStyle(ButtonStyle.Danger)
|
|
||||||
.setDisabled(true)
|
|
||||||
)
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
await staffapp.findOneAndDelete({ userId: applicantId });
|
await message.edit({
|
||||||
|
components: [
|
||||||
|
new ActionRowBuilder().addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("staffapplicationaccept")
|
||||||
|
.setLabel("Accept")
|
||||||
|
.setStyle(ButtonStyle.Primary)
|
||||||
|
.setDisabled(true),
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("staffapplicationdeny")
|
||||||
|
.setLabel("Deny")
|
||||||
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
.setDisabled(true)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
await interaction.reply({
|
await staffapp.findOneAndDelete({ userId: applicantId });
|
||||||
embeds: [
|
|
||||||
{
|
await interaction.reply({
|
||||||
title: applicantUsername + " - Staff Application.",
|
embeds: [{
|
||||||
description: "Application accepted by <@" + user.id + ">.",
|
title: applicantUsername + " - Staff Application.",
|
||||||
color: embedColor,
|
description: "Application accepted by <@" + user.id + ">.",
|
||||||
thumbnail: {
|
color: embedColor,
|
||||||
url: applicant.avatarURL()
|
thumbnail: {
|
||||||
},
|
url: applicant.avatarURL()
|
||||||
footer: {
|
},
|
||||||
iconurl: guild.iconURL(),
|
footer: {
|
||||||
text: "ID: " + applicantId
|
iconurl: guild.iconURL(),
|
||||||
}
|
text: "ID: " + applicantId
|
||||||
}
|
}
|
||||||
]
|
}]
|
||||||
});
|
});
|
||||||
}
|
|
||||||
};
|
}
|
||||||
|
}
|
||||||
@@ -1,29 +1,25 @@
|
|||||||
const {
|
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
|
||||||
ModalBuilder,
|
|
||||||
ActionRowBuilder,
|
|
||||||
TextInputBuilder,
|
|
||||||
TextInputStyle
|
|
||||||
} = require("discord.js");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "staffapplicationdeny",
|
name: 'staffapplicationdeny',
|
||||||
description: "Deny a guild application.",
|
description: 'Deny a guild application.',
|
||||||
type: "button",
|
type: 'button',
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const modal = new ModalBuilder()
|
|
||||||
.setTitle("Deny Reason")
|
const modal = new ModalBuilder()
|
||||||
.setCustomId("staffdenyreasonbox")
|
.setTitle('Deny Reason')
|
||||||
.setComponents(
|
.setCustomId('staffdenyreasonbox')
|
||||||
new ActionRowBuilder().setComponents(
|
.setComponents(
|
||||||
new TextInputBuilder()
|
new ActionRowBuilder().setComponents(
|
||||||
.setLabel("Deny Reason")
|
new TextInputBuilder()
|
||||||
.setCustomId("staffdenyreason")
|
.setLabel('Deny Reason')
|
||||||
.setStyle(TextInputStyle.Paragraph)
|
.setCustomId('staffdenyreason')
|
||||||
.setPlaceholder("Enter a reason for denying the application")
|
.setStyle(TextInputStyle.Paragraph)
|
||||||
.setRequired(false)
|
.setPlaceholder('Enter a reason for denying the application')
|
||||||
)
|
.setRequired(false)
|
||||||
);
|
)
|
||||||
await interaction.showModal(modal);
|
)
|
||||||
}
|
await interaction.showModal(modal);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,523 +1,437 @@
|
|||||||
const {
|
const { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js');
|
||||||
ButtonBuilder,
|
const { color } = require('../../config/options.json');
|
||||||
ButtonStyle,
|
const { largeM, smallM, ignM } = require('../../config/limitmessages.json')
|
||||||
ActionRowBuilder,
|
const { staffApplicationsChannel } = require('../../config/options.json');
|
||||||
EmbedBuilder
|
const { sq1, sq2, sq3, sq4, sq5, sq6 } = require('../../config/questions.json');
|
||||||
} = require("discord.js");
|
const { rsq1, rsq2, rsq3, rsq4, rsq5, rsq6 } = require('../../config/questions.json');
|
||||||
const { color } = require("../../config/options.json");
|
const { guildRole, guildStaff } = require('../../config/roles.json')
|
||||||
const { largeM, smallM, ignM } = require("../../config/limitmessages.json");
|
const mongoose = require('mongoose');
|
||||||
const { staffApplicationsChannel } = require("../../config/options.json");
|
const staffapp = require('../../schemas/staffAppSchema.js');
|
||||||
const { sq1, sq2, sq3, sq4, sq5, sq6 } = require("../../config/questions.json");
|
const fetch = require('axios');
|
||||||
const {
|
|
||||||
rsq1,
|
|
||||||
rsq2,
|
|
||||||
rsq3,
|
|
||||||
rsq4,
|
|
||||||
rsq5,
|
|
||||||
rsq6
|
|
||||||
} = require("../../config/questions.json");
|
|
||||||
const { guildRole, guildStaff } = require("../../config/roles.json");
|
|
||||||
const mongoose = require("mongoose");
|
|
||||||
const staffapp = require("../../schemas/staffAppSchema.js");
|
|
||||||
const fetch = require("axios");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "staffapply",
|
name: 'staffapply',
|
||||||
description: "Apply for the staff team.",
|
description: 'Apply for the staff team.',
|
||||||
type: "button",
|
type: 'button',
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const user = interaction.user;
|
|
||||||
const guild = interaction.guild;
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
const userRoles = interaction.member.roles.cache;
|
|
||||||
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/";
|
|
||||||
|
|
||||||
if (interaction.customId === "staffapply") {
|
const user = interaction.user;
|
||||||
await interaction.deferReply({ ephemeral: true });
|
const guild = interaction.guild;
|
||||||
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
const userRoles = interaction.member.roles.cache;
|
||||||
|
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"
|
||||||
|
|
||||||
if (!userRoles.has(guildRole)) {
|
if (interaction.customId === "staffapply") {
|
||||||
await interaction.editReply({
|
|
||||||
content: "You must be a member of the guild to apply for staff.",
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (userRoles.has(guildStaff)) {
|
await interaction.deferReply({ ephemeral: true });
|
||||||
await interaction.editReply({
|
|
||||||
content: "You are already a staff member.",
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const application = await staffapp.findOne({ userID: user.id });
|
if (!userRoles.has(guildRole)) {
|
||||||
|
await interaction.editReply({content: "You must be a member of the guild to apply for staff.", ephemeral: true});
|
||||||
if (application) {
|
return
|
||||||
await interaction.editReply({
|
|
||||||
content: "You already have an application in progress.",
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const tooLong = new EmbedBuilder()
|
|
||||||
.setDescription("You took too long to respond.")
|
|
||||||
.setColor(embedColor);
|
|
||||||
const cancelled = new EmbedBuilder()
|
|
||||||
.setDescription("You have cancelled your application.")
|
|
||||||
.setColor(embedColor);
|
|
||||||
const attachments = new EmbedBuilder()
|
|
||||||
.setDescription(
|
|
||||||
"You have uploaded an attachment. Please do not upload images, videos, or GIFS."
|
|
||||||
)
|
|
||||||
.setColor(embedColor);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await user.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: "Staff Application",
|
|
||||||
description:
|
|
||||||
"Please answer the following questions to apply for staff.\n" +
|
|
||||||
"If you wish to cancel your application, please press type `cancel` at any time.\n" +
|
|
||||||
"If you wish to proceed with your application, please type `yes`.\n\n" +
|
|
||||||
"**Do not upload images, videos, or GIFS.**\n" +
|
|
||||||
"You have a minute to respond to this message.",
|
|
||||||
color: embedColor
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
await interaction.editReply({
|
|
||||||
content: "Please enable your DMs.",
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await interaction.editReply({
|
if (userRoles.has(guildStaff)) {
|
||||||
content: "Please check your DMs.",
|
await interaction.editReply({content: "You are already a staff member.", ephemeral: true});
|
||||||
ephemeral: true
|
return
|
||||||
});
|
|
||||||
|
|
||||||
const input = await user.dmChannel.awaitMessages({
|
|
||||||
filter: (m) => m.author.id === user.id,
|
|
||||||
max: 1,
|
|
||||||
time: 1000 * 60
|
|
||||||
});
|
|
||||||
if (input.first().attachments.size > 0) {
|
|
||||||
await user.send({ embeds: [attachments] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (input.size === 0) {
|
|
||||||
await user.send({ embeds: [tooLong] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (input.first().content.toLowerCase() !== "yes") {
|
|
||||||
await user.send({ embeds: [cancelled] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// first question
|
|
||||||
const question1 = await user.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: "**Question 1**",
|
|
||||||
description:
|
|
||||||
sq1 +
|
|
||||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
|
||||||
ignM +
|
|
||||||
"`",
|
|
||||||
color: embedColor,
|
|
||||||
footer: {
|
|
||||||
text: "You have 5 minutes to respond to this message."
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
const answer1 = await user.dmChannel.awaitMessages({
|
|
||||||
filter: (m) => m.author.id === user.id,
|
|
||||||
max: 1,
|
|
||||||
time: 1000 * 60 * 5
|
|
||||||
});
|
|
||||||
if (answer1.first().attachments.size > 0) {
|
|
||||||
await user.send({ embeds: [attachments] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer1.first().content > 16) {
|
|
||||||
await user.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description: "Max character limit is 16.",
|
|
||||||
color: embedColor
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
await fetch(mojangAPI + answer1.first().content);
|
|
||||||
} catch (error) {
|
|
||||||
await user.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description:
|
|
||||||
"That is not a valid Minecraft username.\n" +
|
|
||||||
"Application cancelled.",
|
|
||||||
color: embedColor
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer1.size === 0) {
|
|
||||||
await user.send({ embeds: [tooLong] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer1.first().content.toLowerCase() === "cancel") {
|
|
||||||
await user.send({ embeds: [cancelled] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const answer1_1 = answer1.first().content;
|
|
||||||
|
|
||||||
// second question
|
const application = await staffapp.findOne({ userID: user.id });
|
||||||
const question2 = await user.send({
|
|
||||||
embeds: [
|
if (application) {
|
||||||
{
|
await interaction.editReply({ content: "You already have an application in progress.", ephemeral: true });
|
||||||
title: "**Question 2**",
|
return
|
||||||
description:
|
|
||||||
sq2 +
|
|
||||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n" +
|
|
||||||
"`(64 characters max)`",
|
|
||||||
color: embedColor,
|
|
||||||
footer: {
|
|
||||||
text: "You have 15 minutes to respond to this message."
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
const answer2 = await user.dmChannel.awaitMessages({
|
|
||||||
filter: (m) => m.author.id === user.id,
|
|
||||||
max: 1,
|
|
||||||
time: 1000 * 60 * 15
|
|
||||||
});
|
|
||||||
if (answer2.first().attachments.size > 0) {
|
|
||||||
await user.send({ embeds: [attachments] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer2.first().content > 64) {
|
|
||||||
await user.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description: "Max character limit is 64.",
|
|
||||||
color: embedColor
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer2.size === 0) {
|
|
||||||
await user.send({ embeds: [tooLong] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer2.first().content.toLowerCase() === "cancel") {
|
|
||||||
await user.send({ embeds: [cancelled] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const answer2_1 = answer2.first().content;
|
|
||||||
|
|
||||||
// third question
|
const tooLong = new EmbedBuilder()
|
||||||
const question3 = await user.send({
|
.setDescription("You took too long to respond.")
|
||||||
embeds: [
|
.setColor(embedColor)
|
||||||
{
|
const cancelled = new EmbedBuilder()
|
||||||
title: "**Question 3**",
|
.setDescription("You have cancelled your application.")
|
||||||
description:
|
.setColor(embedColor)
|
||||||
sq3 +
|
const attachments = new EmbedBuilder()
|
||||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
.setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.")
|
||||||
largeM +
|
.setColor(embedColor)
|
||||||
"`",
|
|
||||||
color: embedColor,
|
|
||||||
footer: {
|
|
||||||
text: "You have 15 minutes to respond to this message."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
const answer3 = await user.dmChannel.awaitMessages({
|
|
||||||
filter: (m) => m.author.id === user.id,
|
|
||||||
max: 1,
|
|
||||||
time: 1000 * 60 * 15
|
|
||||||
});
|
|
||||||
if (answer3.first().attachments.size > 0) {
|
|
||||||
await user.send({ embeds: [attachments] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer3.first().content > 256) {
|
|
||||||
await user.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description: "Max character limit is 256.",
|
|
||||||
color: embedColor
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (answer3.size === 0) {
|
|
||||||
await user.send({ embeds: [tooLong] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer3.first().content.toLowerCase() === "cancel") {
|
|
||||||
await user.send({ embeds: [cancelled] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const answer3_1 = answer3.first().content;
|
|
||||||
|
|
||||||
// fourth question
|
try {
|
||||||
const question4 = await user.send({
|
await user.send({
|
||||||
embeds: [
|
embeds: [{
|
||||||
{
|
title: 'Staff Application',
|
||||||
title: "**Question 4**",
|
description: "Please answer the following questions to apply for staff.\n" +
|
||||||
description:
|
"If you wish to cancel your application, please press type `cancel` at any time.\n" +
|
||||||
sq4 +
|
"If you wish to proceed with your application, please type `yes`.\n\n" +
|
||||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
"**Do not upload images, videos, or GIFS.**\n" +
|
||||||
largeM +
|
"You have a minute to respond to this message.",
|
||||||
"`",
|
color: embedColor,
|
||||||
color: embedColor,
|
}]
|
||||||
footer: {
|
})
|
||||||
text: "You have 15 minutes to respond to this message."
|
} catch (error) {
|
||||||
}
|
await interaction.editReply({ content: "Please enable your DMs.", ephemeral: true });
|
||||||
}
|
return
|
||||||
]
|
}
|
||||||
});
|
|
||||||
const answer4 = await user.dmChannel.awaitMessages({
|
|
||||||
filter: (m) => m.author.id === user.id,
|
|
||||||
max: 1,
|
|
||||||
time: 1000 * 60 * 15
|
|
||||||
});
|
|
||||||
if (answer4.first().attachments.size > 0) {
|
|
||||||
await user.send({ embeds: [attachments] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer4.first().content > 256) {
|
|
||||||
await user.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description: "Max character limit is 256.",
|
|
||||||
color: embedColor
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (answer4.size === 0) {
|
|
||||||
await user.send({ embeds: [tooLong] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer4.first().content.toLowerCase() === "cancel") {
|
|
||||||
await user.send({ embeds: [cancelled] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const answer4_1 = answer4.first().content;
|
|
||||||
|
|
||||||
// fifth question
|
await interaction.editReply({ content: "Please check your DMs.", ephemeral: true})
|
||||||
const question5 = await user.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
title: "**Question 5**",
|
|
||||||
description:
|
|
||||||
sq5 +
|
|
||||||
"\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" +
|
|
||||||
largeM +
|
|
||||||
"`",
|
|
||||||
color: embedColor,
|
|
||||||
footer: {
|
|
||||||
text: "You have 15 minutes to respond to this message."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
const answer5 = await user.dmChannel.awaitMessages({
|
|
||||||
filter: (m) => m.author.id === user.id,
|
|
||||||
max: 1,
|
|
||||||
time: 1000 * 60 * 15
|
|
||||||
});
|
|
||||||
if (answer5.first().attachments.size > 0) {
|
|
||||||
await user.send({ embeds: [attachments] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer5.first().content > 256) {
|
|
||||||
await user.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description: "Max character limit is 256.",
|
|
||||||
color: embedColor
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (answer5.size === 0) {
|
|
||||||
await user.send({ embeds: [tooLong] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer5.first().content.toLowerCase() === "cancel") {
|
|
||||||
await user.send({ embeds: [cancelled] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const answer5_1 = answer5.first().content;
|
|
||||||
|
|
||||||
// sixth question
|
const input = await user.dmChannel.awaitMessages({
|
||||||
const question6 = await user.send({
|
filter: m => m.author.id === user.id,
|
||||||
embeds: [
|
max: 1,
|
||||||
{
|
time: 1000 * 60
|
||||||
title: "**Question 6**",
|
});
|
||||||
description:
|
if (input.first().attachments.size > 0) {
|
||||||
sq6 +
|
await user.send({ embeds: [attachments] });
|
||||||
"\n\nPlease type your answer below or type `cancel` to cancel your application." +
|
return
|
||||||
"`(We expect a longer answer here)`\n`" +
|
}
|
||||||
largeM +
|
if (input.size === 0) {
|
||||||
"`",
|
await user.send({ embeds: [tooLong] });
|
||||||
color: embedColor,
|
return
|
||||||
footer: {
|
}
|
||||||
text: "You have 15 minutes to respond to this message."
|
if (input.first().content.toLowerCase() !== 'yes') {
|
||||||
}
|
await user.send({ embeds: [cancelled]} );
|
||||||
}
|
return
|
||||||
]
|
}
|
||||||
});
|
|
||||||
const answer6 = await user.dmChannel.awaitMessages({
|
|
||||||
filter: (m) => m.author.id === user.id,
|
|
||||||
max: 1,
|
|
||||||
time: 1000 * 60 * 15
|
|
||||||
});
|
|
||||||
if (answer6.first().attachments.size > 0) {
|
|
||||||
await user.send({ embeds: [attachments] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer6.first().content > 256) {
|
|
||||||
await user.send({
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
description: "Max character limit is 256.",
|
|
||||||
color: embedColor
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (answer6.size === 0) {
|
|
||||||
await user.send({ embeds: [tooLong] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (answer6.first().content.toLowerCase() === "cancel") {
|
|
||||||
await user.send({ embeds: [cancelled] });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const answer6_1 = answer6.first().content;
|
|
||||||
|
|
||||||
await user.send({
|
// first question
|
||||||
embeds: [
|
const question1 = await user.send({
|
||||||
{
|
embeds: [{
|
||||||
description:
|
title : "**Question 1**",
|
||||||
"If you want to submit your application, type `yes` if not, type `no`",
|
description: sq1 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`",
|
||||||
color: embedColor
|
color: embedColor,
|
||||||
}
|
footer:{
|
||||||
]
|
text: "You have 5 minutes to respond to this message."
|
||||||
});
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
const answer1 = await user.dmChannel.awaitMessages({
|
||||||
|
filter: m => m.author.id === user.id,
|
||||||
|
max: 1,
|
||||||
|
time: 1000 * 60 * 5,
|
||||||
|
});
|
||||||
|
if (answer1.first().attachments.size > 0) {
|
||||||
|
await user.send({ embeds: [attachments] });
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer1.first().content > 16) {
|
||||||
|
await user.send({
|
||||||
|
embeds: [{
|
||||||
|
description: "Max character limit is 16.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await fetch(mojangAPI + answer1.first().content)
|
||||||
|
} catch (error) {
|
||||||
|
await user.send({
|
||||||
|
embeds: [{
|
||||||
|
description: "That is not a valid Minecraft username.\n" +
|
||||||
|
"Application cancelled.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer1.size === 0) {
|
||||||
|
await user.send({ embeds: [tooLong] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer1.first().content.toLowerCase() === 'cancel') {
|
||||||
|
await user.send({ embeds: [cancelled] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const answer1_1 = answer1.first().content
|
||||||
|
|
||||||
const final = await user.dmChannel.awaitMessages({
|
// second question
|
||||||
filter: (m) => m.author.id === user.id,
|
const question2 = await user.send({
|
||||||
max: 1,
|
embeds: [{
|
||||||
time: 1000 * 60 * 5
|
title : "**Question 2**",
|
||||||
});
|
description: sq2 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`",
|
||||||
if (final.first().attachments.size > 0) {
|
color: embedColor,
|
||||||
await user.send({ embeds: [attachments] });
|
footer:{
|
||||||
return;
|
text: "You have 15 minutes to respond to this message."
|
||||||
}
|
}
|
||||||
if (final.size === 0) {
|
}]
|
||||||
await user.send({ embeds: [tooLong] });
|
})
|
||||||
return;
|
const answer2 = await user.dmChannel.awaitMessages({
|
||||||
}
|
filter: m => m.author.id === user.id,
|
||||||
if (final.first().content.toLowerCase() !== "yes") {
|
max: 1,
|
||||||
await user.send({ embeds: [cancelled] });
|
time: 1000 * 60 * 15
|
||||||
return;
|
});
|
||||||
}
|
if (answer2.first().attachments.size > 0) {
|
||||||
|
await user.send({ embeds: [attachments] });
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer2.first().content > 64) {
|
||||||
|
await user.send({
|
||||||
|
embeds: [{
|
||||||
|
description: "Max character limit is 64.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer2.size === 0) {
|
||||||
|
await user.send({ embeds: [tooLong] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer2.first().content.toLowerCase() === 'cancel') {
|
||||||
|
await user.send({ embeds: [cancelled] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const answer2_1 = answer2.first().content
|
||||||
|
|
||||||
await user.send({
|
// third question
|
||||||
embeds: [
|
const question3 = await user.send({
|
||||||
{
|
embeds: [{
|
||||||
description: "Your application has been submitted!",
|
title : "**Question 3**",
|
||||||
color: embedColor
|
description: sq3 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
|
||||||
}
|
color: embedColor,
|
||||||
]
|
footer:{
|
||||||
});
|
text: "You have 15 minutes to respond to this message."
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
const answer3 = await user.dmChannel.awaitMessages({
|
||||||
|
filter: m => m.author.id === user.id,
|
||||||
|
max: 1,
|
||||||
|
time: 1000 * 60 * 15
|
||||||
|
});
|
||||||
|
if (answer3.first().attachments.size > 0) {
|
||||||
|
await user.send({ embeds: [attachments] });
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer3.first().content > 256) {
|
||||||
|
await user.send({
|
||||||
|
embeds: [{
|
||||||
|
description: "Max character limit is 256.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (answer3.size === 0) {
|
||||||
|
await user.send({ embeds: [tooLong] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer3.first().content.toLowerCase() === 'cancel') {
|
||||||
|
await user.send({ embeds: [cancelled] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const answer3_1 = answer3.first().content
|
||||||
|
|
||||||
const userCheck = await fetch(mojangAPI + answer1_1);
|
// fourth question
|
||||||
const uuid = userCheck.data.id;
|
const question4 = await user.send({
|
||||||
|
embeds: [{
|
||||||
|
title : "**Question 4**",
|
||||||
|
description: sq4 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
|
||||||
|
color: embedColor,
|
||||||
|
footer:{
|
||||||
|
text: "You have 15 minutes to respond to this message."
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
const answer4 = await user.dmChannel.awaitMessages({
|
||||||
|
filter: m => m.author.id === user.id,
|
||||||
|
max: 1,
|
||||||
|
time: 1000 * 60 * 15
|
||||||
|
});
|
||||||
|
if (answer4.first().attachments.size > 0) {
|
||||||
|
await user.send({ embeds: [attachments] });
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer4.first().content > 256) {
|
||||||
|
await user.send({
|
||||||
|
embeds: [{
|
||||||
|
description: "Max character limit is 256.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (answer4.size === 0) {
|
||||||
|
await user.send({ embeds: [tooLong] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer4.first().content.toLowerCase() === 'cancel') {
|
||||||
|
await user.send({ embeds: [cancelled] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const answer4_1 = answer4.first().content
|
||||||
|
|
||||||
const newStaffApp = new staffapp({
|
// fifth question
|
||||||
_id: new mongoose.Types.ObjectId(),
|
const question5 = await user.send({
|
||||||
userID: user.id,
|
embeds: [{
|
||||||
uuid: uuid
|
title : "**Question 5**",
|
||||||
});
|
description: sq5 + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`",
|
||||||
|
color: embedColor,
|
||||||
|
footer:{
|
||||||
|
text: "You have 15 minutes to respond to this message."
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
const answer5 = await user.dmChannel.awaitMessages({
|
||||||
|
filter: m => m.author.id === user.id,
|
||||||
|
max: 1,
|
||||||
|
time: 1000 * 60 * 15
|
||||||
|
});
|
||||||
|
if (answer5.first().attachments.size > 0) {
|
||||||
|
await user.send({ embeds: [attachments] });
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer5.first().content > 256) {
|
||||||
|
await user.send({
|
||||||
|
embeds: [{
|
||||||
|
description: "Max character limit is 256.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (answer5.size === 0) {
|
||||||
|
await user.send({ embeds: [tooLong] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer5.first().content.toLowerCase() === 'cancel') {
|
||||||
|
await user.send({ embeds: [cancelled] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const answer5_1 = answer5.first().content
|
||||||
|
|
||||||
await newStaffApp.save();
|
// sixth question
|
||||||
await user.deleteDM();
|
const question6 = await user.send({
|
||||||
|
embeds: [{
|
||||||
|
title : "**Question 6**",
|
||||||
|
description: sq6 + "\n\nPlease type your answer below or type `cancel` to cancel your application." +
|
||||||
|
"`(We expect a longer answer here)`\n`" + largeM + "`",
|
||||||
|
color: embedColor,
|
||||||
|
footer:{
|
||||||
|
text: "You have 15 minutes to respond to this message."
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
const answer6 = await user.dmChannel.awaitMessages({
|
||||||
|
filter: m => m.author.id === user.id,
|
||||||
|
max: 1,
|
||||||
|
time: 1000 * 60 * 15
|
||||||
|
});
|
||||||
|
if (answer6.first().attachments.size > 0) {
|
||||||
|
await user.send({ embeds: [attachments] });
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer6.first().content > 256) {
|
||||||
|
await user.send({
|
||||||
|
embeds: [{
|
||||||
|
description: "Max character limit is 256.",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (answer6.size === 0) {
|
||||||
|
await user.send({ embeds: [tooLong] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (answer6.first().content.toLowerCase() === 'cancel') {
|
||||||
|
await user.send({ embeds: [cancelled] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const answer6_1 = answer6.first().content
|
||||||
|
|
||||||
const channel = guild.channels.cache.get(staffApplicationsChannel);
|
await user.send({
|
||||||
|
embeds: [{
|
||||||
|
description: "If you want to submit your application, type `yes` if not, type `no`",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
await channel.send({
|
const final = await user.dmChannel.awaitMessages({
|
||||||
embeds: [
|
filter: m => m.author.id === user.id,
|
||||||
{
|
max: 1,
|
||||||
title:
|
time: 1000 * 60 * 5
|
||||||
user.username + "#" + user.discriminator + " - Staff Application",
|
});
|
||||||
color: embedColor,
|
if (final.first().attachments.size > 0) {
|
||||||
thumbnail: {
|
await user.send({ embeds: [attachments] });
|
||||||
url: user.avatarURL()
|
return
|
||||||
},
|
}
|
||||||
fields: [
|
if (final.size === 0) {
|
||||||
{
|
await user.send({ embeds: [tooLong] });
|
||||||
name: rsq1,
|
return
|
||||||
value: "```" + answer1_1 + "```"
|
}
|
||||||
},
|
if (final.first().content.toLowerCase() !== 'yes') {
|
||||||
{
|
await user.send({ embeds: [cancelled]} );
|
||||||
name: rsq2,
|
return
|
||||||
value: "```" + answer2_1 + "```"
|
}
|
||||||
},
|
|
||||||
{
|
await user.send({
|
||||||
name: rsq3,
|
embeds: [{
|
||||||
value: "```" + answer3_1 + "```"
|
description: "Your application has been submitted!",
|
||||||
},
|
color: embedColor
|
||||||
{
|
}]
|
||||||
name: rsq4,
|
})
|
||||||
value: "```" + answer4_1 + "```"
|
|
||||||
},
|
const userCheck = await fetch(mojangAPI + answer1_1)
|
||||||
{
|
const uuid = userCheck.data.id
|
||||||
name: rsq5,
|
|
||||||
value: "```" + answer5_1 + "```"
|
const newStaffApp = new staffapp({
|
||||||
},
|
_id: new mongoose.Types.ObjectId(),
|
||||||
{
|
userID: user.id,
|
||||||
name: rsq6,
|
uuid: uuid,
|
||||||
value: "```" + answer6_1 + "```"
|
})
|
||||||
}
|
|
||||||
],
|
await newStaffApp.save()
|
||||||
footer: {
|
await user.deleteDM();
|
||||||
iconURL: guild.iconURL(),
|
|
||||||
text: "ID: " + user.id
|
const channel = guild.channels.cache.get(staffApplicationsChannel);
|
||||||
}
|
|
||||||
}
|
await channel.send({
|
||||||
],
|
embeds: [{
|
||||||
components: [
|
title: user.username + "#" + user.discriminator + " - Staff Application",
|
||||||
new ActionRowBuilder().addComponents(
|
color: embedColor,
|
||||||
new ButtonBuilder()
|
thumbnail: {
|
||||||
.setCustomId("staffapplicationaccept")
|
url: user.avatarURL()
|
||||||
.setLabel("Accept")
|
},
|
||||||
.setStyle(ButtonStyle.Primary),
|
fields: [
|
||||||
new ButtonBuilder()
|
{
|
||||||
.setCustomId("staffapplicationdeny")
|
name: rsq1,
|
||||||
.setLabel("Deny")
|
value: "```" + answer1_1 + "```"
|
||||||
.setStyle(ButtonStyle.Danger)
|
},
|
||||||
)
|
{
|
||||||
]
|
name: rsq2,
|
||||||
});
|
value: "```" + answer2_1 + "```"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: rsq3,
|
||||||
|
value: "```" + answer3_1 + "```"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: rsq4,
|
||||||
|
value: "```" + answer4_1 + "```"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: rsq5,
|
||||||
|
value: "```" + answer5_1 + "```"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: rsq6,
|
||||||
|
value: "```" + answer6_1 + "```"
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
footer: {
|
||||||
|
iconURL: guild.iconURL(),
|
||||||
|
text: "ID: " + user.id
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
components: [
|
||||||
|
new ActionRowBuilder().addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("staffapplicationaccept")
|
||||||
|
.setLabel("Accept")
|
||||||
|
.setStyle(ButtonStyle.Primary),
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("staffapplicationdeny")
|
||||||
|
.setLabel("Deny")
|
||||||
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
@@ -1,95 +1,78 @@
|
|||||||
const {
|
const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
|
||||||
InteractionType,
|
const { color } = require('../../config/options.json');
|
||||||
EmbedBuilder,
|
const mongoose = require('mongoose');
|
||||||
ActionRowBuilder,
|
const guildapp = require('../../schemas/guildAppSchema.js');
|
||||||
ButtonBuilder,
|
const fs = require('fs');
|
||||||
ButtonStyle
|
const path = require('path');
|
||||||
} = require("discord.js");
|
|
||||||
const { color } = require("../../config/options.json");
|
|
||||||
const mongoose = require("mongoose");
|
|
||||||
const guildapp = require("../../schemas/guildAppSchema.js");
|
|
||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "denyreasonbox",
|
name: 'denyreasonbox',
|
||||||
description: "Deny reason box.",
|
description: 'Deny reason box.',
|
||||||
type: "modal",
|
type: 'modal',
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
if (interaction.type !== InteractionType.ModalSubmit) return;
|
|
||||||
if (interaction.customId !== "denyreasonbox") return;
|
|
||||||
|
|
||||||
interaction.deferReply();
|
if (interaction.type !== InteractionType.ModalSubmit) return;
|
||||||
|
if (interaction.customId !== "denyreasonbox") return;
|
||||||
|
|
||||||
const guild = interaction.guild;
|
interaction.deferReply();
|
||||||
|
|
||||||
const message = interaction.message;
|
const guild = interaction.guild;
|
||||||
const embed = message.embeds[0];
|
|
||||||
const applicantId = embed.footer.text.split(" ")[1];
|
|
||||||
|
|
||||||
const applicant = await guild.members.fetch(applicantId);
|
const message = interaction.message;
|
||||||
const reason =
|
const embed = message.embeds[0];
|
||||||
interaction.fields.fields.get("denyreason").value || "No reason provided";
|
const applicantId = embed.footer.text.split(" ")[1];
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
const filePath = path.join(__dirname, `../../apps/guild/${applicantId}`);
|
|
||||||
|
|
||||||
await message.edit({
|
const applicant = await guild.members.fetch(applicantId);
|
||||||
components: [
|
const reason = interaction.fields.fields.get('denyreason').value || "No reason provided";
|
||||||
new ActionRowBuilder().addComponents(
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
new ButtonBuilder()
|
const filePath = path.join(__dirname, `../../apps/guild/${applicantId}`);
|
||||||
.setCustomId("guildapplicationaccept")
|
|
||||||
.setLabel("Accept")
|
|
||||||
.setStyle(ButtonStyle.Primary)
|
|
||||||
.setDisabled(true),
|
|
||||||
new ButtonBuilder()
|
|
||||||
.setCustomId("guildapplicationdeny")
|
|
||||||
.setLabel("Deny")
|
|
||||||
.setStyle(ButtonStyle.Danger)
|
|
||||||
.setDisabled(true),
|
|
||||||
new ButtonBuilder()
|
|
||||||
.setCustomId("checkstats")
|
|
||||||
.setLabel("Check Stats")
|
|
||||||
.setStyle(ButtonStyle.Secondary)
|
|
||||||
.setDisabled(true)
|
|
||||||
)
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const dmMessage = new EmbedBuilder()
|
await message.edit({
|
||||||
.setDescription(
|
components: [
|
||||||
"Your application for the Illegitimate guild has been denied\n" +
|
new ActionRowBuilder().addComponents(
|
||||||
"**Reason:** `" +
|
new ButtonBuilder()
|
||||||
reason +
|
.setCustomId("guildapplicationaccept")
|
||||||
"`"
|
.setLabel("Accept")
|
||||||
)
|
.setStyle(ButtonStyle.Primary)
|
||||||
.setColor(embedColor);
|
.setDisabled(true),
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("guildapplicationdeny")
|
||||||
|
.setLabel("Deny")
|
||||||
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
.setDisabled(true),
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("checkstats")
|
||||||
|
.setLabel("Check Stats")
|
||||||
|
.setStyle(ButtonStyle.Secondary)
|
||||||
|
.setDisabled(true)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
await applicant.send({ embeds: [dmMessage] });
|
const dmMessage = new EmbedBuilder()
|
||||||
|
.setDescription("Your application for the Illegitimate guild has been denied\n" +
|
||||||
|
"**Reason:** `" + reason + "`")
|
||||||
|
.setColor(embedColor);
|
||||||
|
|
||||||
await guildapp.findOneAndDelete({ userID: applicantId });
|
await applicant.send({ embeds: [dmMessage] });
|
||||||
|
|
||||||
await interaction.editReply({
|
await guildapp.findOneAndDelete({ userID: applicantId });
|
||||||
embeds: [
|
|
||||||
{
|
await interaction.editReply({
|
||||||
title: "Application Denied",
|
embeds: [{
|
||||||
description:
|
title: "Application Denied",
|
||||||
"The application has been denied by <@" +
|
description: "The application has been denied by <@" + interaction.user.id + ">.\n" +
|
||||||
interaction.user.id +
|
"**Reason:** `" + reason + "`",
|
||||||
">.\n" +
|
color: embedColor,
|
||||||
"**Reason:** `" +
|
thumbnail: {
|
||||||
reason +
|
url: applicant.avatarURL()
|
||||||
"`",
|
},
|
||||||
color: embedColor,
|
footer: {
|
||||||
thumbnail: {
|
iconURL: guild.iconURL(),
|
||||||
url: applicant.avatarURL()
|
text: "ID: " + applicant.id
|
||||||
},
|
}
|
||||||
footer: {
|
}],
|
||||||
iconURL: guild.iconURL(),
|
});
|
||||||
text: "ID: " + applicant.id
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,90 +1,72 @@
|
|||||||
const {
|
const { InteractionType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
|
||||||
InteractionType,
|
const { color } = require('../../config/options.json');
|
||||||
EmbedBuilder,
|
const mongoose = require('mongoose');
|
||||||
ActionRowBuilder,
|
const staffapp = require('../../schemas/staffAppSchema.js');
|
||||||
ButtonBuilder,
|
const fs = require('fs');
|
||||||
ButtonStyle
|
const path = require('path');
|
||||||
} = require("discord.js");
|
|
||||||
const { color } = require("../../config/options.json");
|
|
||||||
const mongoose = require("mongoose");
|
|
||||||
const staffapp = require("../../schemas/staffAppSchema.js");
|
|
||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "staffdenyreasonbox",
|
name: 'staffdenyreasonbox',
|
||||||
description: "Deny reason box.",
|
description: 'Deny reason box.',
|
||||||
type: "modal",
|
type: 'modal',
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
if (interaction.type !== InteractionType.ModalSubmit) return;
|
|
||||||
if (interaction.customId !== "staffdenyreasonbox") return;
|
|
||||||
|
|
||||||
interaction.deferReply();
|
if (interaction.type !== InteractionType.ModalSubmit) return;
|
||||||
|
if (interaction.customId !== "staffdenyreasonbox") return;
|
||||||
|
|
||||||
const channel = interaction.channel;
|
interaction.deferReply();
|
||||||
const guild = interaction.guild;
|
|
||||||
const reason =
|
|
||||||
interaction.fields.fields.get("staffdenyreason").value ||
|
|
||||||
"No reason provided";
|
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
|
||||||
|
|
||||||
const message = interaction.message;
|
const channel = interaction.channel;
|
||||||
const embed = message.embeds[0];
|
const guild = interaction.guild;
|
||||||
const applicantId = embed.footer.text.split(" ")[1];
|
const reason = interaction.fields.fields.get('staffdenyreason').value || "No reason provided";
|
||||||
const applicant = await guild.members.fetch(applicantId);
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
await message.edit({
|
const message = interaction.message;
|
||||||
components: [
|
const embed = message.embeds[0];
|
||||||
new ActionRowBuilder().addComponents(
|
const applicantId = embed.footer.text.split(" ")[1]
|
||||||
new ButtonBuilder()
|
const applicant = await guild.members.fetch(applicantId)
|
||||||
.setCustomId("staffapplicationaccept")
|
|
||||||
.setLabel("Accept")
|
|
||||||
.setStyle(ButtonStyle.Primary)
|
|
||||||
.setDisabled(true),
|
|
||||||
new ButtonBuilder()
|
|
||||||
.setCustomId("staffapplicationdeny")
|
|
||||||
.setLabel("Deny")
|
|
||||||
.setStyle(ButtonStyle.Danger)
|
|
||||||
.setDisabled(true)
|
|
||||||
)
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const dmMessage = new EmbedBuilder()
|
await message.edit({
|
||||||
.setDescription(
|
components: [
|
||||||
"Your application for the Illegitimate guild staff has been denied\n" +
|
new ActionRowBuilder().addComponents(
|
||||||
"**Reason:** `" +
|
new ButtonBuilder()
|
||||||
reason +
|
.setCustomId("staffapplicationaccept")
|
||||||
"`"
|
.setLabel("Accept")
|
||||||
)
|
.setStyle(ButtonStyle.Primary)
|
||||||
.setColor(embedColor);
|
.setDisabled(true),
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("staffapplicationdeny")
|
||||||
|
.setLabel("Deny")
|
||||||
|
.setStyle(ButtonStyle.Danger)
|
||||||
|
.setDisabled(true),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
await applicant.send({ embeds: [dmMessage] });
|
const dmMessage = new EmbedBuilder()
|
||||||
|
.setDescription("Your application for the Illegitimate guild staff has been denied\n" +
|
||||||
|
"**Reason:** `" + reason + "`")
|
||||||
|
.setColor(embedColor);
|
||||||
|
|
||||||
await staffapp.findOneAndDelete({ userID: applicantId });
|
await applicant.send({ embeds: [dmMessage] });
|
||||||
|
|
||||||
await interaction.editReply({
|
await staffapp.findOneAndDelete({ userID: applicantId });
|
||||||
embeds: [
|
|
||||||
{
|
await interaction.editReply({
|
||||||
title: "Application Denied",
|
embeds: [{
|
||||||
description:
|
title: "Application Denied",
|
||||||
"The application has been denied by <@" +
|
description: "The application has been denied by <@" + interaction.user.id + ">.\n" +
|
||||||
interaction.user.id +
|
"**Reason:** `" + reason + "`",
|
||||||
">.\n" +
|
color: embedColor,
|
||||||
"**Reason:** `" +
|
thumbnail: {
|
||||||
reason +
|
url: applicant.avatarURL()
|
||||||
"`",
|
},
|
||||||
color: embedColor,
|
footer: {
|
||||||
thumbnail: {
|
iconURL: guild.iconURL(),
|
||||||
url: applicant.avatarURL()
|
text: "ID: " + applicant.id
|
||||||
},
|
}
|
||||||
footer: {
|
}],
|
||||||
iconURL: guild.iconURL(),
|
});;
|
||||||
text: "ID: " + applicant.id
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
348
index.js
348
index.js
@@ -1,32 +1,25 @@
|
|||||||
const {
|
const { Client, GatewayIntentBits, Partials, ActivityType, Events, Collection } = require('discord.js');
|
||||||
Client,
|
const env = require('dotenv').config();
|
||||||
GatewayIntentBits,
|
|
||||||
Partials,
|
|
||||||
ActivityType,
|
|
||||||
Events,
|
|
||||||
Collection
|
|
||||||
} = require("discord.js");
|
|
||||||
const env = require("dotenv").config();
|
|
||||||
const token = process.env.TOKEN;
|
const token = process.env.TOKEN;
|
||||||
const mongoURI = process.env.MONGOURI;
|
const mongoURI = process.env.MONGOURI;
|
||||||
const { connect } = require("mongoose");
|
const { connect } = require('mongoose');
|
||||||
const path = require("path");
|
const path = require('path');
|
||||||
const fs = require("fs");
|
const fs = require('fs');
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: [
|
intents: [
|
||||||
GatewayIntentBits.Guilds,
|
GatewayIntentBits.Guilds,
|
||||||
GatewayIntentBits.GuildMessages,
|
GatewayIntentBits.GuildMessages,
|
||||||
GatewayIntentBits.GuildMembers,
|
GatewayIntentBits.GuildMembers,
|
||||||
GatewayIntentBits.MessageContent,
|
GatewayIntentBits.MessageContent,
|
||||||
GatewayIntentBits.DirectMessages
|
GatewayIntentBits.DirectMessages
|
||||||
],
|
],
|
||||||
partials: [
|
partials: [
|
||||||
Partials.GuildMember,
|
Partials.GuildMember,
|
||||||
Partials.User,
|
Partials.User,
|
||||||
Partials.Message,
|
Partials.Message,
|
||||||
Partials.Channel
|
Partials.Channel
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
client.commands = new Collection();
|
client.commands = new Collection();
|
||||||
@@ -34,230 +27,207 @@ client.events = new Collection();
|
|||||||
client.modals = new Collection();
|
client.modals = new Collection();
|
||||||
|
|
||||||
//! commands
|
//! commands
|
||||||
const cmdPath = path.join(__dirname, "commands");
|
const cmdPath = path.join(__dirname, 'commands');
|
||||||
const cmdFiles = fs.readdirSync(cmdPath).filter((file) => file.endsWith(".js"));
|
const cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith('.js'));
|
||||||
|
|
||||||
for (const file of cmdFiles) {
|
for (const file of cmdFiles) {
|
||||||
const filePath = path.join(cmdPath, file);
|
|
||||||
const cmd = require(filePath);
|
|
||||||
|
|
||||||
if ("data" in cmd && "execute" in cmd && cmd.type === "slash") {
|
const filePath = path.join(cmdPath, file);
|
||||||
client.commands.set(cmd.data.name, cmd);
|
const cmd = require(filePath);
|
||||||
} else {
|
|
||||||
console.log(
|
if ('data' in cmd && 'execute' in cmd && cmd.type === 'slash') {
|
||||||
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`
|
client.commands.set(cmd.data.name, cmd);
|
||||||
);
|
} else {
|
||||||
}
|
console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! commands testing
|
//! commands testing
|
||||||
const cmdTestPath = path.join(__dirname, "commands-testing");
|
const cmdTestPath = path.join(__dirname, 'commands-testing');
|
||||||
const cmdTestFiles = fs
|
const cmdTestFiles = fs.readdirSync(cmdTestPath).filter(file => file.endsWith('.js'));
|
||||||
.readdirSync(cmdTestPath)
|
|
||||||
.filter((file) => file.endsWith(".js"));
|
|
||||||
|
|
||||||
for (const file of cmdTestFiles) {
|
for (const file of cmdTestFiles) {
|
||||||
const filePath = path.join(cmdTestPath, file);
|
|
||||||
const cmd = require(filePath);
|
|
||||||
|
|
||||||
if ("data" in cmd && "execute" in cmd && cmd.type === "slash") {
|
const filePath = path.join(cmdTestPath, file);
|
||||||
client.commands.set(cmd.data.name, cmd);
|
const cmd = require(filePath);
|
||||||
} else {
|
|
||||||
console.log(
|
if ('data' in cmd && 'execute' in cmd && cmd.type === 'slash') {
|
||||||
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`
|
client.commands.set(cmd.data.name, cmd);
|
||||||
);
|
} else {
|
||||||
}
|
console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! command handler
|
//! command handler
|
||||||
client.on(Events.InteractionCreate, async (interaction) => {
|
client.on(Events.InteractionCreate, async interaction => {
|
||||||
if (!interaction.isChatInputCommand()) return;
|
if(!interaction.isChatInputCommand()) return;
|
||||||
|
|
||||||
const command = interaction.client.commands.get(interaction.commandName);
|
const command = interaction.client.commands.get(interaction.commandName);
|
||||||
|
|
||||||
if (!command) {
|
if (!command) {
|
||||||
console.error(`No command matching ${interaction.commandName} was found.`);
|
console.error(`No command matching ${interaction.commandName} was found.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await command.execute(interaction);
|
await command.execute(interaction);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
await interaction.reply({
|
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true })
|
||||||
content: "There was an error while executing this command!",
|
}
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//! commands
|
//! commands
|
||||||
const contextMenuPath = path.join(__dirname, "commands-contextmenu");
|
const contextMenuPath = path.join(__dirname, 'commands-contextmenu');
|
||||||
const contextMenuFiles = fs
|
const contextMenuFiles = fs.readdirSync(contextMenuPath).filter(file => file.endsWith('.js'));
|
||||||
.readdirSync(contextMenuPath)
|
|
||||||
.filter((file) => file.endsWith(".js"));
|
|
||||||
|
|
||||||
for (const file of contextMenuFiles) {
|
for (const file of contextMenuFiles) {
|
||||||
const filePath = path.join(contextMenuPath, file);
|
|
||||||
const cmd = require(filePath);
|
|
||||||
|
|
||||||
if ("data" in cmd && "execute" in cmd && cmd.type === "contextmenu") {
|
const filePath = path.join(contextMenuPath, file);
|
||||||
client.commands.set(cmd.data.name, cmd);
|
const cmd = require(filePath);
|
||||||
} else {
|
|
||||||
console.log(
|
if ('data' in cmd && 'execute' in cmd && cmd.type === 'contextmenu') {
|
||||||
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`
|
client.commands.set(cmd.data.name, cmd);
|
||||||
);
|
} else {
|
||||||
}
|
console.log(`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! context menu command handler
|
//! context menu command handler
|
||||||
client.on(Events.InteractionCreate, async (interaction) => {
|
client.on(Events.InteractionCreate, async interaction => {
|
||||||
if (!interaction.isContextMenuCommand()) return;
|
if(!interaction.isContextMenuCommand()) return;
|
||||||
|
|
||||||
const command = interaction.client.commands.get(interaction.commandName);
|
const command = interaction.client.commands.get(interaction.commandName);
|
||||||
|
|
||||||
if (!command) {
|
if (!command) {
|
||||||
console.error(`No command matching ${interaction.commandName} was found.`);
|
console.error(`No command matching ${interaction.commandName} was found.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await command.execute(interaction);
|
await command.execute(interaction);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
await interaction.reply({
|
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true })
|
||||||
content: "There was an error while executing this command!",
|
}
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//! button events
|
//! button events
|
||||||
const btnPath = path.join(__dirname, "events", "buttons");
|
const btnPath = path.join(__dirname, 'events', 'buttons');
|
||||||
const btnFiles = fs.readdirSync(btnPath).filter((file) => file.endsWith(".js"));
|
const btnFiles = fs.readdirSync(btnPath).filter(file => file.endsWith('.js'));
|
||||||
|
|
||||||
for (const file of btnFiles) {
|
for (const file of btnFiles) {
|
||||||
const filePath = path.join(btnPath, file);
|
|
||||||
const btn = require(filePath);
|
|
||||||
|
|
||||||
if ("name" in btn && "execute" in btn && btn.type === "button") {
|
const filePath = path.join(btnPath, file);
|
||||||
client.events.set(btn.name, btn);
|
const btn = require(filePath);
|
||||||
} else {
|
|
||||||
console.log(
|
if ('name' in btn && 'execute' in btn && btn.type === 'button') {
|
||||||
`[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`
|
client.events.set(btn.name, btn);
|
||||||
);
|
} else {
|
||||||
}
|
console.log(`[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! button event handler
|
//! button event handler
|
||||||
client.on(Events.InteractionCreate, async (event) => {
|
client.on(Events.InteractionCreate, async event => {
|
||||||
if (!event.isButton()) return;
|
if(!event.isButton()) return;
|
||||||
|
|
||||||
const event2 = event.client.events.get(event.customId);
|
const event2 = event.client.events.get(event.customId);
|
||||||
|
|
||||||
if (!event2) {
|
if (!event2) {
|
||||||
console.error(`No event matching ${event.customId} was found.`);
|
console.error(`No event matching ${event.customId} was found.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await event2.execute(event);
|
await event2.execute(event);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
await event.reply({
|
await event.reply({ content: 'There was an error while executing this event!', ephemeral: true })
|
||||||
content: "There was an error while executing this event!",
|
}
|
||||||
ephemeral: true
|
})
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//! modals
|
//! modals
|
||||||
const modalPath = path.join(__dirname, "events", "modals");
|
const modalPath = path.join(__dirname, 'events', 'modals');
|
||||||
const modalFiles = fs
|
const modalFiles = fs.readdirSync(modalPath).filter(file => file.endsWith('.js'));
|
||||||
.readdirSync(modalPath)
|
|
||||||
.filter((file) => file.endsWith(".js"));
|
|
||||||
|
|
||||||
for (const file of modalFiles) {
|
for (const file of modalFiles) {
|
||||||
const filePath = path.join(modalPath, file);
|
|
||||||
const modal = require(filePath);
|
|
||||||
|
|
||||||
if ("name" in modal && "execute" in modal && modal.type === "modal") {
|
const filePath = path.join(modalPath, file);
|
||||||
client.on(Events.InteractionCreate, modal.execute);
|
const modal = require (filePath);
|
||||||
} else {
|
|
||||||
console.log(
|
if ('name' in modal && 'execute' in modal && modal.type === 'modal') {
|
||||||
`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`
|
client.on(Events.InteractionCreate, modal.execute);
|
||||||
);
|
} else {
|
||||||
}
|
console.log(`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
client.on(Events.ClientReady, () => {
|
client.on(Events.ClientReady, () => {
|
||||||
console.log("Logged in as " + client.user.tag + "!");
|
console.log("Logged in as " + client.user.tag + "!");
|
||||||
});
|
});
|
||||||
|
|
||||||
// message events
|
// message events
|
||||||
const msgPath = path.join(__dirname, "events", "messages");
|
const msgPath = path.join(__dirname, 'events', 'messages');
|
||||||
const msgFiles = fs.readdirSync(msgPath).filter((file) => file.endsWith(".js"));
|
const msgFiles = fs.readdirSync(msgPath).filter(file => file.endsWith('.js'));
|
||||||
|
|
||||||
for (const file of msgFiles) {
|
for (const file of msgFiles) {
|
||||||
const filePath = path.join(msgPath, file);
|
|
||||||
const msg = require(filePath);
|
|
||||||
|
|
||||||
if ("name" in msg && "execute" in msg && msg.type === "message") {
|
const filePath = path.join(msgPath, file);
|
||||||
client.on(Events.MessageCreate, msg.execute);
|
const msg = require(filePath);
|
||||||
} else {
|
|
||||||
console.log(
|
if ('name' in msg && 'execute' in msg && msg.type === 'message') {
|
||||||
`[WARNING] The message at ${filePath} is missing a required "name", "execute" or "type" property.`
|
client.on(Events.MessageCreate, msg.execute);
|
||||||
);
|
} else {
|
||||||
}
|
console.log(`[WARNING] The message at ${filePath} is missing a required "name", "execute" or "type" property.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client.on(Events.ClientReady, () => {
|
client.on(Events.ClientReady, () => {
|
||||||
client.user.setActivity({
|
|
||||||
name: "over the Illegitimate Server",
|
|
||||||
type: ActivityType.Watching
|
|
||||||
});
|
|
||||||
|
|
||||||
const activities = [
|
client.user.setActivity({ name: "over the Illegitimate Server", type: ActivityType.Watching });
|
||||||
{
|
|
||||||
name: "with Jone the idiot",
|
const activities = [
|
||||||
type: ActivityType.Playing
|
{
|
||||||
},
|
name: "with Jone the idiot",
|
||||||
{
|
type: ActivityType.Playing
|
||||||
name: "with Martina the bot",
|
},
|
||||||
type: ActivityType.Playing
|
{
|
||||||
},
|
name: "with Martina the bot",
|
||||||
{
|
type: ActivityType.Playing
|
||||||
name: "urCryhard steal finals again",
|
},
|
||||||
type: ActivityType.Watching
|
{
|
||||||
},
|
name: "urCryhard steal finals again",
|
||||||
{
|
type: ActivityType.Watching
|
||||||
name: "with Perlcence the AI",
|
},
|
||||||
type: ActivityType.Playing
|
{
|
||||||
},
|
name: "with Perlcence the AI",
|
||||||
{
|
type: ActivityType.Playing
|
||||||
name: "my creator Taken",
|
},
|
||||||
type: ActivityType.Watching
|
{
|
||||||
},
|
name: "my creator Taken",
|
||||||
{
|
type: ActivityType.Watching
|
||||||
name: "with ur mom in my bed",
|
},
|
||||||
type: ActivityType.Playing
|
{
|
||||||
},
|
name: "with ur mom in my bed",
|
||||||
{
|
type: ActivityType.Playing
|
||||||
name: "over the Illegitimate Server",
|
},
|
||||||
type: ActivityType.Watching
|
{
|
||||||
}
|
name: "over the Illegitimate Server",
|
||||||
];
|
type: ActivityType.Watching
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
setInterval(() =>
|
||||||
|
client.user.setActivity(activities[i++ % activities.length]), 1000 * 60 * 30
|
||||||
|
)
|
||||||
|
|
||||||
let i = 0;
|
|
||||||
setInterval(
|
|
||||||
() => client.user.setActivity(activities[i++ % activities.length]),
|
|
||||||
1000 * 60 * 30
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
client.on(Events.ClientReady, () => {
|
client.on(Events.ClientReady, () => {
|
||||||
client.user.setStatus("dnd");
|
client.user.setStatus('dnd');
|
||||||
});
|
});
|
||||||
client.login(token);
|
client.login(token);
|
||||||
|
|
||||||
connect(mongoURI, {}).then(() => {
|
connect(mongoURI, {}).then(() => {
|
||||||
console.log("Connected to MongoDB");
|
console.log('Connected to MongoDB');
|
||||||
});
|
})
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
const { Schema, model } = require("mongoose");
|
const { Schema, model } = require('mongoose');
|
||||||
|
|
||||||
const guildAppSchema = new Schema({
|
const guildAppSchema = new Schema({
|
||||||
_id: Schema.Types.ObjectId,
|
_id: Schema.Types.ObjectId,
|
||||||
userID: { type: String, required: true },
|
userID: { type: String, required: true },
|
||||||
uuid: { type: String, required: true }
|
uuid: { type: String, required: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = model("guildapp", guildAppSchema, "guildapp");
|
module.exports = model('guildapp', guildAppSchema, 'guildapp');
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
const { Schema, model } = require("mongoose");
|
const { Schema, model } = require('mongoose');
|
||||||
|
|
||||||
const staffAppSchema = new Schema({
|
const staffAppSchema = new Schema({
|
||||||
_id: Schema.Types.ObjectId,
|
_id: Schema.Types.ObjectId,
|
||||||
userID: { type: String, required: true },
|
userID: { type: String, required: true },
|
||||||
uuid: { type: String, required: true }
|
uuid: { type: String, required: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = model("staffapp", staffAppSchema, "staffapp");
|
module.exports = model('staffapp', staffAppSchema, 'staffapp');
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
const { Schema, model } = require("mongoose");
|
const { Schema, model } = require('mongoose');
|
||||||
|
|
||||||
const verifySchema = new Schema({
|
const verifySchema = new Schema({
|
||||||
_id: Schema.Types.ObjectId,
|
_id: Schema.Types.ObjectId,
|
||||||
userID: { type: String, required: true },
|
userID: { type: String, required: true },
|
||||||
uuid: { type: String, required: true }
|
uuid: { type: String, required: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = model("verify", verifySchema, "verify");
|
module.exports = model('verify', verifySchema, 'verify');
|
||||||
@@ -1,26 +1,26 @@
|
|||||||
const fetch = require("axios");
|
const fetch = require("axios");
|
||||||
|
|
||||||
async function getuuid(ign) {
|
async function getuuid(ign) {
|
||||||
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/";
|
const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const user = await fetch(mojangAPI + ign);
|
const user = await fetch(mojangAPI + ign)
|
||||||
return user.data.id;
|
return user.data.id;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getplayer(uuid) {
|
async function getplayer(uuid) {
|
||||||
const slothPixel = "https://api.slothpixel.me/api/players/";
|
const slothPixel = "https://api.slothpixel.me/api/players/";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const player = await fetch(slothPixel + uuid);
|
const player = await fetch(slothPixel + uuid)
|
||||||
return player;
|
return player
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = getuuid;
|
module.exports = getuuid
|
||||||
module.exports = getplayer;
|
module.exports = getplayer
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
name: "limbo",
|
name: 'limbo',
|
||||||
description: "Sends bot to limbo.",
|
description: 'Sends bot to limbo.',
|
||||||
type: "spawn",
|
type: 'spawn',
|
||||||
|
|
||||||
async execute() {
|
async execute() {
|
||||||
const bot = require("../../index.js");
|
const bot = require ('../../index.js');
|
||||||
|
|
||||||
bot.chat("\u00a7");
|
bot.chat("\u00a7")
|
||||||
}
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,27 +1,29 @@
|
|||||||
const client = require("../../index.js");
|
const client = require('../../index.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "Guild chat relay",
|
name: 'Guild chat relay',
|
||||||
description: "Sends a message to the chat.",
|
description: 'Sends a message to the chat.',
|
||||||
type: "message",
|
type: 'message',
|
||||||
|
|
||||||
async execute(jsonMsg) {
|
async execute(jsonMsg) {
|
||||||
const gcchannel = "1092569207918575687";
|
|
||||||
|
|
||||||
const msg = jsonMsg.getText();
|
const gcchannel = "1092569207918575687"
|
||||||
const annoyingMessages = [
|
|
||||||
"You are currently APPEARING OFFLINE",
|
|
||||||
"REMINDER: Your Online Status is currently set to Appear Offline",
|
|
||||||
"You have 1 unclaimed achievement reward!",
|
|
||||||
"Click here to view it!"
|
|
||||||
];
|
|
||||||
|
|
||||||
if (annoyingMessages.includes(msg)) return;
|
const msg = jsonMsg.getText();
|
||||||
|
const annoyingMessages = [
|
||||||
|
"You are currently APPEARING OFFLINE",
|
||||||
|
"REMINDER: Your Online Status is currently set to Appear Offline",
|
||||||
|
"You have 1 unclaimed achievement reward!",
|
||||||
|
"Click here to view it!"
|
||||||
|
]
|
||||||
|
|
||||||
console.log("[Chat message] " + msg);
|
if (annoyingMessages.includes(msg)) return;
|
||||||
|
|
||||||
const channel = client.guild.channels.cache.get(gcchannel);
|
console.log("[Chat message] " + msg);
|
||||||
|
|
||||||
channel.send(msg);
|
const channel = client.guild.channels.cache.get(gcchannel);
|
||||||
}
|
|
||||||
|
channel.send(msg);
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
name: "login",
|
name: 'login',
|
||||||
description: "Logs the bot in.",
|
description: 'Logs the bot in.',
|
||||||
type: "login",
|
type: 'login',
|
||||||
|
|
||||||
async execute() {
|
async execute() {
|
||||||
const bot = require("../../index.js");
|
const bot = require ('../../index.js');
|
||||||
console.log("Logged in as " + bot.username + "!");
|
console.log('Logged in as ' + bot.username + '!')
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
Reference in New Issue
Block a user