Files
config
database
src
tests
.gitignore
docker-compose.yml
Dockerfile
package.json
README.md
tsconfig.json
Code
33 1,818
src/commands/public.ts
import {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
EmbedBuilder,
PermissionFlagsBits,
SlashCommandBuilder
} from 'discord.js';
import { premiumEmbed } from '../embeds/embeds.js';
import type { BotCommand, CommandContext } from '../types.js';
import { verifyButtonRow } from '../buttons/verificationButtons.js';
export function publicCommands(): BotCommand[] {
return [
{
data: new SlashCommandBuilder().setName('info').setDescription('Display information about UW Verify'),
async execute(interaction, context) {
const embed = premiumEmbed(context.config, 'UW Verify', 'Premium Discord Verification & Minecraft Whitelist Bot')
.addFields(
{ name: 'Version', value: '1.0.0', inline: true },
{ name: 'Developer', value: 'ItzMeTechu', inline: true },
{ name: 'Built With', value: 'Node.js 22\nTypeScript\ndiscord.js v14', inline: true },
{ name: 'Minecraft Support', value: 'Paper\nPurpur\nSpigot\nVelocity', inline: true },
{ name: 'License', value: 'Private', inline: true },
{ name: 'Status', value: 'Production Ready', inline: true }
)
.setFooter({ text: 'Developed by ItzMeTechu' });
await interaction.reply({ embeds: [embed] });
}
},
{
data: new SlashCommandBuilder().setName('verify').setDescription('Start Discord and Minecraft verification'),
async execute(interaction, context) {
await interaction.reply({
embeds: [premiumEmbed(context.config, '✅ Begin Verification', 'Click the button below to link your Minecraft Java account.')],
components: [verifyButtonRow()],
ephemeral: true
});
}
},
{
data: new SlashCommandBuilder().setName('link').setDescription('Open the Minecraft account linking flow'),
async execute(interaction, context) {
await interaction.reply({
embeds: [premiumEmbed(context.config, '🔗 Link Minecraft Account', 'Use the button below to securely link your account.')],
components: [verifyButtonRow()],
ephemeral: true
});
}
},
{
data: new SlashCommandBuilder().setName('profile').setDescription('View your linked Minecraft profile'),
async execute(interaction, context) {
const profile = await context.database.findByDiscordId(interaction.user.id);
if (!profile) {
await interaction.reply({ embeds: [premiumEmbed(context.config, '👤 Profile', 'No Minecraft account is linked to your Discord account.')], ephemeral: true });
return;
}
await interaction.reply({
embeds: [
premiumEmbed(context.config, '👤 Your Profile')
.addFields(
{ name: 'Minecraft Username', value: profile.minecraftUsername, inline: true },
{ name: 'Verification Status', value: profile.verificationStatus, inline: true },
{ name: 'Whitelist Status', value: profile.whitelistStatus, inline: true },
{ name: 'Verification ID', value: profile.verificationId, inline: false }
)
],
ephemeral: true
});
}
},
{
data: new SlashCommandBuilder().setName('status').setDescription('Check your verification status'),
async execute(interaction, context) {
const profile = await context.database.findByDiscordId(interaction.user.id);
await interaction.reply({
embeds: [
premiumEmbed(
context.config,
'📊 Verification Status',
profile
? `✅ Linked to **${profile.minecraftUsername}**\nWhitelist: **${profile.whitelistStatus}**`
: '❌ Your Discord account is not verified.'
)
],
ephemeral: true
});
}
},
{
data: new SlashCommandBuilder()
.setName('unlink')
.setDescription('Unlink your Minecraft account')
.setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild),
async execute(interaction, context) {
const profile = await context.database.findByDiscordId(interaction.user.id);
if (!profile) {
await interaction.reply({ embeds: [premiumEmbed(context.config, '🔗 Unlink Account', 'No linked account was found.')], ephemeral: true });
return;
}
await context.whitelist.remove(profile.minecraftUsername);
await context.database.unlink(interaction.user.id);
await context.logger.log('Username Changed', 'A Minecraft account was unlinked.', {
Minecraft: profile.minecraftUsername
}, interaction.user.id, interaction.user.id);
await interaction.reply({ embeds: [premiumEmbed(context.config, '✅ Account Unlinked', 'Your Minecraft account has been unlinked.')], ephemeral: true });
}
},
{
data: new SlashCommandBuilder().setName('rules').setDescription('Display the Underworld SMP rules'),
async execute(interaction, context) {
await interaction.reply({ embeds: [premiumEmbed(context.config, '📖 Underworld SMP Rules', context.config.messages.rulesText)] });
}
},
{
data: new SlashCommandBuilder().setName('help').setDescription('Display available commands'),
async execute(interaction, context) {
await interaction.reply({
embeds: [
premiumEmbed(context.config, '❓ UW Verify Help')
.setDescription('Use the following commands to manage your verification.')
.addFields(
{ name: 'Verification', value: '`/verify` · `/link` · `/profile` · `/status`', inline: false },
{ name: 'Information', value: '`/info` · `/rules` · `/help`', inline: false },
{ name: 'Staff', value: '`/whitelist` · `/reload` · `/resetuser` · `/unverify`', inline: false }
)
]
});
}
},
{
data: new SlashCommandBuilder()
.setName('whitelist')
.setDescription('Manage a Minecraft whitelist entry')
.addStringOption((option) => option.setName('username').setDescription('Minecraft username').setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild),
async execute(interaction, context) {
const username = interaction.options.getString('username', true);
const result = await context.whitelist.add(username);
await context.logger.log('Whitelist Added', result.details, {
Minecraft: username,
Status: result.status
}, interaction.user.id, interaction.user.id);
await interaction.reply({
embeds: [premiumEmbed(context.config, result.status === 'added' ? '✅ Whitelist Added' : '❌ Whitelist Failed', result.details)],
ephemeral: true
});
}
},
{
data: new SlashCommandBuilder()
.setName('reload')
.setDescription('Reload operational configuration')
.setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild),
async execute(interaction, context) {
await context.logger.log('Staff Action', 'Configuration reload requested.', {}, interaction.user.id, null);
await interaction.reply({ embeds: [premiumEmbed(context.config, '🔄 Reload Requested', 'Restart the bot after editing configuration files to apply all settings.')], ephemeral: true });
}
}
];
}