Skip to content

$hasComponents

$hasComponents checks if a message has components, returns boolean.

$hasComponents[channelID?;messageID?;type?]

FieldTypeDescriptionRequired
channelID?numberThe channel ID of where the message is.false
messageID?numberThe ID of the message.false
type?stringComponent Types.false

TypeDescription
any (default)Any component type
ActionRowContainer for other components
ButtonButton component
SelectMenuAny select menus
StringSelectSelect menu for picking from defined text options
ChannelSelectSelect menu for channels
RoleSelectSelect menu for roles
UserSelectSelect menu for users
MentionableSelectSelect menu for mentionables (users and roles)
TextInputText input component

This will return false since the message does not have a button:

1
client.command({
2
name: "hasComponents",
3
code: `$hasComponents[$channelID;$messageID;Button]`
4
});