Passa al contenuto principale

Type conversions for Discord objects

Treat a user or an interaction as a more specific type so that you can use its extra values.

Treat user as server member​

Resolve a Discord user to their server member. Returns nothing if the user is not a member of the given server.

Inputs

NameTypeRequiredDetails
UserUserYesUser to resolve.

Outputs

NameTypeDetails
MemberServer memberResolved server member, or empty if not a member of that server. May be empty.

Treat interaction as button click​

Narrow a generic interaction to a button click. Returns nothing if the interaction is a different kind.

Inputs

NameTypeRequiredDetails
InteractionInteractionYesInteraction to narrow.

Outputs

NameTypeDetails
Button interactionButton clickNarrowed button click, or empty if not a button click. May be empty.

Treat interaction as dropdown​

Narrow a generic interaction to a dropdown submission. Returns nothing if the interaction is a different kind.

Inputs

NameTypeRequiredDetails
InteractionInteractionYesInteraction to narrow.

Outputs

NameTypeDetails
Dropdown interactionDropdown interactionNarrowed dropdown submission, or empty if not a dropdown. May be empty.

Treat interaction as user dropdown​

Narrow a generic interaction to a user dropdown submission. Returns nothing if the interaction is a different kind.

Inputs

NameTypeRequiredDetails
InteractionInteractionYesInteraction to narrow.

Outputs

NameTypeDetails
User dropdown interactionUser dropdown interactionNarrowed member select submission, or empty if not a member select. Its picked values come back as real members, not as IDs. May be empty.

Treat interaction as role dropdown​

Narrow a generic interaction to a role dropdown submission. Returns nothing if the interaction is a different kind.

Inputs

NameTypeRequiredDetails
InteractionInteractionYesInteraction to narrow.

Outputs

NameTypeDetails
Role dropdown interactionRole dropdown interactionNarrowed role select submission, or empty if not a role select. Its picked values come back as real roles, not as IDs. May be empty.

Treat interaction as channel dropdown​

Narrow a generic interaction to a channel dropdown submission. Returns nothing if the interaction is a different kind.

Inputs

NameTypeRequiredDetails
InteractionInteractionYesInteraction to narrow.

Outputs

NameTypeDetails
Channel dropdown interactionChannel dropdown interactionNarrowed channel select submission, or empty if not a channel select. Its picked values come back as real channels, not as IDs. May be empty.

Treat interaction as user-or-role dropdown​

Narrow a generic interaction to a user-or-role dropdown submission. Returns nothing if the interaction is a different kind.

Inputs

NameTypeRequiredDetails
InteractionInteractionYesInteraction to narrow.

Outputs

NameTypeDetails
User-or-role dropdown interactionUser-or-role dropdown interactionNarrowed member-or-role select submission, or empty if not one. Picked members and picked roles are kept in two separate lists. May be empty.

Treat interaction as modal submit​

Narrow a generic interaction to a modal submission. Returns nothing if the interaction is a different kind.

Inputs

NameTypeRequiredDetails
InteractionInteractionYesInteraction to narrow.

Outputs

NameTypeDetails
Modal submit interactionModal submitNarrowed modal submission, or empty if not a modal submit. May be empty.

Treat interaction as slash command​

Narrow a generic interaction to a slash command invocation. Returns nothing if the interaction is a different kind.

Inputs

NameTypeRequiredDetails
InteractionInteractionYesInteraction to narrow.

Outputs

NameTypeDetails
Slash command interactionSlash commandNarrowed slash command, or empty if not a slash command. May be empty.
Need more help?
Can't find what you're looking for? Our team is happy to help.