From 8749c1b6e3f050d812d1099ced73f44b15f56a09 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 8 Nov 2025 10:43:01 +0000 Subject: [PATCH] Create /profile command to show AeThex profile cgen-c9735d7865ce47c487f90ef29ea6f010 --- discord-bot/commands/profile.js | 76 +++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 discord-bot/commands/profile.js diff --git a/discord-bot/commands/profile.js b/discord-bot/commands/profile.js new file mode 100644 index 00000000..314d96c9 --- /dev/null +++ b/discord-bot/commands/profile.js @@ -0,0 +1,76 @@ +const { SlashCommandBuilder, EmbedBuilder } = require('discord.js'); + +module.exports = { + data: new SlashCommandBuilder() + .setName('profile') + .setDescription('View your AeThex profile in Discord'), + + async execute(interaction, supabase) { + await interaction.deferReply({ ephemeral: true }); + + try { + const { data: link } = await supabase + .from('discord_links') + .select('user_id, primary_arm') + .eq('discord_id', interaction.user.id) + .single(); + + if (!link) { + const embed = new EmbedBuilder() + .setColor(0xFF6B6B) + .setTitle('โŒ Not Linked') + .setDescription('You must link your Discord account to AeThex first.\nUse `/verify` to get started.'); + + return await interaction.editReply({ embeds: [embed] }); + } + + const { data: profile } = await supabase + .from('user_profiles') + .select('*') + .eq('id', link.user_id) + .single(); + + if (!profile) { + const embed = new EmbedBuilder() + .setColor(0xFF6B6B) + .setTitle('โŒ Profile Not Found') + .setDescription('Your AeThex profile could not be found.'); + + return await interaction.editReply({ embeds: [embed] }); + } + + const armEmojis = { + labs: '๐Ÿงช', + gameforge: '๐ŸŽฎ', + corp: '๐Ÿ’ผ', + foundation: '๐Ÿค', + devlink: '๐Ÿ’ป', + }; + + const embed = new EmbedBuilder() + .setColor(0x7289DA) + .setTitle(`${profile.full_name || 'AeThex User'}'s Profile`) + .setThumbnail(profile.avatar_url || 'https://aethex.dev/placeholder.svg') + .addFields( + { name: '๐Ÿ‘ค Username', value: profile.username || 'N/A', inline: true }, + { name: `${armEmojis[link.primary_arm] || 'โš”๏ธ'} Primary Realm`, value: link.primary_arm || 'Not set', inline: true }, + { name: '๐Ÿ“Š Role', value: profile.user_type || 'community_member', inline: true }, + { name: '๐Ÿ“ Bio', value: profile.bio || 'No bio set', inline: false }, + ) + .addFields( + { name: '๐Ÿ”— Links', value: `[Visit Full Profile](https://aethex.dev/creators/${profile.username})` }, + ) + .setFooter({ text: 'AeThex | Your Web3 Creator Hub' }); + + await interaction.editReply({ embeds: [embed] }); + } catch (error) { + console.error('Profile command error:', error); + const embed = new EmbedBuilder() + .setColor(0xFF0000) + .setTitle('โŒ Error') + .setDescription('Failed to fetch profile. Please try again.'); + + await interaction.editReply({ embeds: [embed] }); + } + }, +};