bot update
This commit is contained in:
16
index.js
16
index.js
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user