Beautified check and config

This commit is contained in:
2023-04-25 17:43:37 +02:00
parent f13cc0d3fb
commit 9c14a448f8
2 changed files with 127 additions and 119 deletions

View File

@@ -14,7 +14,11 @@ module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName("check") .setName("check")
.setDescription("Check a player's stats.") .setDescription("Check a player's stats.")
.addStringOption((option) => option.setName("ign").setDescription("The player's IGN.").setRequired(true)) .addStringOption((option) =>
option
.setName("ign")
.setDescription("The player's IGN.")
.setRequired(true))
.setDMPermission(false), .setDMPermission(false),
async execute(interaction) { async execute(interaction) {
@@ -109,7 +113,8 @@ module.exports = {
embeds: [ embeds: [
{ {
title: rank + stats.data.username + guildTag, title: rank + stats.data.username + guildTag,
description: "**Network Level:** `" + stats.data.level.toString() + "`\n" + "**Current Guild:** `" + guildName + "`", description: "**Network Level:** `" + stats.data.level.toString() + "`\n" +
"**Current Guild:** `" + guildName + "`",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: head url: head
@@ -121,15 +126,21 @@ module.exports = {
fields: [ fields: [
{ {
name: bwtitle, 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() + "`" 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, 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() + "`" 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, 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() + "`" 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() + "`"
} }
] ]
} }

View File

@@ -1,125 +1,122 @@
const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder, WebhookClient } = require('discord.js'); const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder, WebhookClient } = require("discord.js");
const { title } = require('process'); const { color } = require("../config/options.json");
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 .addSubcommand((subcommand) =>
.setName('sendguildinfo') subcommand
.setDescription('Send the guild info message to a channel.')) .setName("sendguildinfo")
.addSubcommand(subcommand => .setDescription("Send the guild info message to a channel."))
subcommand .addSubcommand((subcommand) =>
.setName('sendrequirements') subcommand
.setDescription('Send the guild requirements message to a channel.')) .setName("sendrequirements")
.addSubcommand(subcommand => .setDescription("Send the guild requirements message to a channel."))
subcommand .addSubcommand((subcommand) =>
.setName('sendrules-info') subcommand
.setDescription('Send the rules and info message to a channel.')) .setName("sendrules-info")
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDescription("Send the rules and info message to a channel."))
.setDMPermission(false), .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"));
const user = interaction.user; if (subcommand === "reload") {
const guild = interaction.guild; await interaction.reply({ content: "In development", ephemeral: true });
const subcommand = interaction.options.getSubcommand(); return;
const embedColor = Number(color.replace("#", "0x")); }
if (subcommand === 'reload') { if (subcommand === "sendguildapplication") {
const channel = interaction.options.getChannel("channel");
await interaction.reply({ content: 'In development', ephemeral: true }) await channel.send({
return 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");
if (subcommand === 'sendguildapplication') {
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 channel.send({ await interaction.reply({ content: "Message sent", ephemeral: true });
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') { if (subcommand !== "sendguildinfo" || "sendrequirements" || "sendrules-info") {
await interaction.reply({ content: "In development.", ephemeral: true });
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 });
}
}
};