marcopixel / r6operators

r6operators is a collection of high-quality vectorized Rainbow Six: Siege Operator icons & metadata for Node.js
https://r6operators.marcopixel.eu
MIT License
100 stars 10 forks source link

isnt really an issue but iam using this for my discored bot and i can retrieve all the stats etc but i cant seem to display the logo in the setThumbnail function ill show my code below #54

Closed zeddify closed 3 months ago

zeddify commented 4 months ago
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const r6operators = require('r6operators');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('operator')
        .setDescription('Get information about a Rainbow Six Siege operator.')
        .addStringOption(option =>
            option.setName('operator_name')
                .setDescription('Name of the operator')
                .setRequired(true)),
    async execute(interaction) {
        const operatorName = interaction.options.getString('operator_name').toLowerCase();

        // Check if the requested operator exists in the r6operators module
        if (!r6operators[operatorName]) {
            await interaction.reply({ content: ':x: Operator not found.', ephemeral: true });
            return;
        }

        const operator = r6operators[operatorName];
        const im = r6operators.operatorName.toSVG 

        // Create a message embed with operator information
        const embed = new EmbedBuilder()
            .setColor('#0099ff')
            .setTitle(operator.name)
            .addFields({ name: 'Description:', value: `Role: ${operator.role}\nOrg: ${operator.org}\nSquad: ${operator.squad}`, inline: true})
            .addFields({ name: 'Ratings:', value: `Health: ${operator.ratings.health}\nSpeed: ${operator.ratings.speed}\nDifficulty: ${operator.ratings.difficulty}`, inline: true})
            .addFields({ name: 'Meta', value: `Gender: ${operator.meta.gender}\nCountry: ${operator.meta.country}\nSeason: ${operator.meta.season}\nHeight: ${operator.meta.height}\nWeight: ${operator.meta.weight}`, inline: true})
            .addFields({ name: 'Pricing:', value: `Price: ${operator.meta.price.renown}\nr6credits: ${operator.meta.price.r6credits}`, inline: true})
            .addFields({ name: 'Bio', value: `RealName: ${operator.bio.real_name}\nBirthplace: ${operator.bio.birthplace}`, inline: true})
            .setThumbnail(im)

        await interaction.reply({ embeds: [embed] });
    },
};

I NEED TO KNOW HOW TO GET THE LOGOS TO BE DISPLAYED IN THE SETTHUMBNAIL FOR WHATVER OP THEY INPUT

marcopixel commented 3 months ago

@izexi7

I've looked at your code and your problem seems to be that Discord.js doesn't allow SVGs as a thumbnail. So you probably have to convert it before sending it to the user, though i can't help you there.

I suggest going to the Discord.js community for help as we only supply SVG files within the code base to keep it low on the file size.