Search code examples
node.jsdiscorddiscord.jsnode-sqlite3

Can't find a way to pin messages


I'm trying to create a bot discord, and I would like to make sure that the message sent "msg.channel.send(exampleEmbed)" will be pinned immediately when sent from the bot. I tried to look at the documentation but I can't find anything useful.

Has anyone got any idea on how to do it?

        db.each('SELECT * FROM BossTable', function (err, output) {
            //msg.channel.send(`\`\`\` CH: ${output.channel} Map: ${output.map} Location: ${output.location} HP: ${output.hp}\`\`\``);
            const exampleEmbed = new Discord.MessageEmbed()
            .setColor('#FDA50F')
            .setTitle(output.channel)
            .setThumbnail('https://icon2.cleanpng.com/20180927/qkl/kisspng-poring-ragnarok-online-clip-art-image-window-5bad7a5208e587.3708730015380956980365.jpg')
            .addFields(
        { name: 'Map', value: output.map, inline: true  },
        { name: 'Location', value: output.location+(" oclock") },
        { name: 'HP', value: output.hp,inline: true  },
        )
        .setTimestamp();
        msg.channel.send(exampleEmbed)
        });

Solution

  • You can achieve this using Message.pin()

    msg.channel.send(exampleEmbed).then((msg) => msg.pin())