Search code examples
argumentsdiscord.jsargs

Discord.js @everyone / @here issues with message


I have the code here for my embed announce feature, if a role is mentioned then it sends that role mention to the channel and then sends the rest of the message in an embed, i also have a variation for user mentions. How do i adapt this to do the same for @everyone & @here? they dont have ID's like roles. Either that or i cant find the ID of @everyone & @here. typing @everyone results in @everyone being returned, not an ID

if (args[1].startsWith('<@&') && args[1].endsWith('>')) {
                            message.channel.send(args[1])
                            const embed = new Discord.MessageEmbed()
                                .setTitle(`${(args.slice(2).join(" "))}`)
                                .setColor(0x320b52)
                                .setTimestamp()
                                .setFooter('Requested by ' + message.author.tag)
                            message.channel.send(embed);

Solution

  • Correct, @everyone and @here do not have IDs. Simply check whether either of them matches args[1].