bot update

This commit is contained in:
VinceC
2024-09-17 15:07:46 -05:00
parent 20f63f3ab0
commit d762b0bc5c
5 changed files with 216 additions and 3 deletions

View File

@@ -61,7 +61,19 @@ client.on('interactionCreate', async interaction => {
const userData = await findUserByUsername(username);
if (userData && userData.success) {
const playerData = JSON.parse(userData.player_data);
let playerData;
try {
playerData = JSON.parse(userData.player_data);
} catch (error) {
await interaction.editReply('Error parsing player data.');
return;
}
if (!playerData || !playerData.profile) {
await interaction.editReply('User found but profile data is null. They need to log in to VRBattles to update their profile.');
return;
}
const user = playerData.profile;
const embed = new EmbedBuilder()
.setTitle(`User: ${playerData.username}`)
@@ -77,7 +89,7 @@ client.on('interactionCreate', async interaction => {
.setColor('#0099ff');
if (user.avatar) {
embed.setThumbnail(`https://www.vrbattles.gg/avatars/${user.avatar}`);
embed.setThumbnail(`https://www.vrbattles.gg/assets/uploads/profile/${user.avatar}`);
}
const row = new ActionRowBuilder()