having a few issues with this command?

const { bold, SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const dayjs = require('dayjs');
const advancedFormat = require('dayjs/plugin/advancedFormat');
dayjs.extend(advancedFormat);

module.exports = {
    data: new SlashCommandBuilder()
        .setName('info')
        .setDescription('Provides information about the user provided')
        .addUserOption((option) =>
            option
                .setName('user')
                .setDescription('The user to get information about')
                .setRequired(true),
        ),
    category: 'utility',
    async execute(interaction) {
        const isUser = interaction.options.getUser('user');
        const fetchedUser = await isUser.fetch({ force: true });
        const isMember = interaction.options.getMember('user');

        const memberStatus = isMember?.presence?.status;
        const statuses = {
            online: 'https://cdn3.emoji.gg/emojis/5251-online-status.png',
            idle: 'https://cdn3.emoji.gg/emojis/5505-idle-status.png',
            dnd: 'https://cdn3.emoji.gg/emojis/5163-dnd-status.png',
            offline: 'https://cdn3.emoji.gg/emojis/2179-offline-status.png',
        };
        const activities = {
            1: 'Playing ',
            2: 'Listening to ',
            3: 'Watching ',
        };
        const activityName = isMember?.presence?.activities.find(activity => activity.type !== 4);

        const memberInfo = new EmbedBuilder()
            .setAuthor({ name: `${isUser.username} is ${memberStatus}!`, iconURL: statuses[memberStatus] })
            .setTitle(bold((activities[activityName?.type] || 'Playing ') + (activityName?.name || 'nothing')))
            .setColor(0x2d251f)
            .setThumbnail(`${isUser.displayAvatarURL()}`)
            .setDescription((isMember?.presence.activities.find(activity => activity.type === 4)?.state || 'Set a custom status!') + '\n')
            .addFields(
                {
                    name: bold('Information'), value: '> ' + bold('Name: ') + (isMember?.displayName || 'N/A') + '\n> ' + bold('Joined: ') + dayjs(`${isMember?.joinedAt}`).format('M/D/YYYY') + '\n> ' + bold('Created: ') + dayjs(`${isUser?.createdAt}`).format('M/D/YYYY') + '\n',
                },
            )
            .setImage(`${fetchedUser?.bannerURL({ size: 1024 })}` ?? null)
            .setFooter({ text: `Requested by ${isUser.username}`, iconURL: `${isUser.displayAvatarURL()}` });
        if (isUser.bot) {
            await interaction.reply({ content: 'That\'s a bot, moo!', ephemeral: true });
        }
        else if (memberStatus === 'dnd') {
            memberInfo.setAuthor({ name: `${isUser.username} is on ` + (memberStatus.toUpperCase()) + '!', iconURL: statuses[memberStatus] });
            await interaction.reply({ embeds: [memberInfo] });
        }
        else if (memberStatus) {
            await interaction.reply({ embeds: [memberInfo] });
        }
        else {
            await interaction.reply({ content: 'That user is not in this guild!', ephemeral: true });
        }
    },
};

i'm having a few issues with this command
  1. i am unable to get the
    else
    statement when a user is not in the guild to work (i've tried different things)
  2. i'm unable to change the size of the
    bannerURL
    now or change anything to do with the banner part or else the bot does not respond
  3. no matter what i do i cannot
    if
    out the banner if a user does not have one
i think the
if
s are all over the place, but this was somehow the only way it would (mostly) function, mainly starting with my want to change the wording on the dnd prompt because for some reason it is really important to the order. i also tried my best not to make it a huge code so it is readable (for me) i'm not perfect at djs yet, so sorry šŸ‘
also sorry if any of this is basic javascript, i'm autistic and have slower moments because of it
Was this page helpful?